Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Anonymous variables in GetLink BindLink #2602

Open
linas opened this issue May 12, 2020 · 4 comments
Open

Support Anonymous variables in GetLink BindLink #2602

linas opened this issue May 12, 2020 · 4 comments

Comments

@linas
Copy link
Member

linas commented May 12, 2020

Currently, the pattern matcher requires that all things to be searched for have to be given a name, by using a VariableNode or a GlobNode. But this is not really needed: it could be done anonymously, thus making the patterns more compact and a bit easier to read. For example, a current search is of the form:

(Get
   (TypedVariable (Variable "X") (Type 'ConceptNode))
   (Present
      (Evaluation (Predicate "P")
         (List (Concept "foo") (Variable "X")))))

It could be done anonlymously:

(Get
   (Present
      (Evaluation (Predicate "P")
         (List (Concept "foo") (Signature (Type 'ConceptNode))))))

with the SignatureLink indicating what to look for.

Implementing this should be pretty easy: scan the clauses for SignatureLinks, and under the covers, create a corresponding type VariableNode with some UUID variable name. Do NOT put the variable into the main atomspace; but when the search is to be run, poke it into the transient atomspace, and do the search. ... and pretty much that's it ... everything else runs as before.

This is somewhat related to enhancment request #2599 which scans for variable declarations not in the VariableList ... this is effectively doing the same thing, only it scans for SignatureLinks, and treats them like variables... Huh.

@ngeiswei
Copy link
Member

ngeiswei commented May 12, 2020

That's nice.

How would you represent queries involving repeated occurrences of the same variable though, like

(Get
  (TypedVariable (Variable "$X") (Type 'ConceptNode))
  (Present
    (Inheritance (Variable "$X") (Concept "A"))
    (Inheritance (Variable "$X") (Concept "B"))))

?

@ngeiswei
Copy link
Member

I guess one would need to introduce adequate combinators, as in combinatory logic.

@linas
Copy link
Member Author

linas commented May 12, 2020

How would you represent

Sometimes, things do need to be named. In order to say "I want this thing to be the same as that thing", you need to point: either with a finger, or a variable.

combinators

I'm doubtful, having seen them in lambda calculus. But I don't know how one might write graphs in this fashion, maybe something interesting happens.

@linas
Copy link
Member Author

linas commented May 12, 2020

Anyway, this is maybe part of an effort to sheaf-ify everything. In case its not clear, plugging things into variables is just a special case of connecting together sheaf sections. (I started writing a PDF about this and then got bored.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants