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

Use PresentLink for verbatim patterns #1882

Closed
ngeiswei opened this issue Oct 10, 2018 · 11 comments
Closed

Use PresentLink for verbatim patterns #1882

ngeiswei opened this issue Oct 10, 2018 · 11 comments

Comments

@ngeiswei
Copy link
Member

ngeiswei commented Oct 10, 2018

I wonder if we could use PresentLink to avoid most quotations.

For instance, currently

(cog-execute! (Get (Present (Evaluation (GroundedPredicate "dummy") (Variable "$X")))))

raises an exception because it attempts to run the grounded predicate.

Wouldn't it be cool if it were instead equivalent to

(cog-execute! (Get (Quote (Evaluation (GroundedPredicate "dummy") (Unquote (Variable "$X"))))))

?

@ngeiswei ngeiswei changed the title Use PresentLink as verbatim pattern Use PresentLink for verbatim patterns Oct 10, 2018
@linas
Copy link
Member

linas commented Oct 10, 2018

Knee-jerk reaction is that it's a good idea.

Be forewarned that the code the code that implements AbsentLink is very old, predating most of the newer theory for the pattern matcher. There's another bug that shujing opened that pointed out that NotLink PresentLink is broken, and etc. I tried to fix this and making everything consistent, efficient, and kept breaking half-a-dozen unit tests no matter how I rearranged the code. Then I ran out of time.

So, sure, what you propose sounds like a pretty good idea, at the moment. Not sure just how easy or hard it would be to hack it. Making all the booleans work correctly with present/absent won't be easy.

@linas
Copy link
Member

linas commented Oct 10, 2018

Here is my half-finished attempt to cleanup/modernize absentlink https://github.com/linas/atomspace/tree/absent-link-rework

@linas
Copy link
Member

linas commented Oct 10, 2018

See also #1596

@ngeiswei
Copy link
Member Author

Cool! I'll have a look at your old branch see if I can take a stab at it.

@linas
Copy link
Member

linas commented Jan 26, 2019

@linas
Copy link
Member

linas commented May 20, 2019

I think this is fixed in pull req #2172 -- a minimal proof that it works is in PresentLinkUTest

@ngeiswei
Copy link
Member Author

Excellent, will test it in more depth as I port my code to use PresentLink over the next few weeks.

@linas
Copy link
Member

linas commented May 23, 2019

OK, please close this issue as soon as you see fit; if you find problems, please open a new issue.

@ngeiswei
Copy link
Member Author

@leungmanhin @amebel @Necr0x0Der @vsbogd and others, I give you the green-light to use PresentLink in your patterns. It makes patterns more readable, quotation less needed and helps the forward chainer to select rule premises.

@leungmanhin
Copy link
Contributor

Awesome! I'll try it out

@linas
Copy link
Member

linas commented Jun 28, 2019

@ngeiswei -- next step: use FormulaLink instead of GroundedPredicate "scm:foo" for the arithmetic formulas. I think it will make the PLN formulas more readable. Faster too, as it will avoid a C++-to-guile transition.

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

3 participants