what is the difference betwen scheme_eval_h and scheme_eval?

37 views
Skip to first unread message

Eyob

unread,
Jan 6, 2018, 9:02:05 AM1/6/18
to opencog
Hi,

we have this from the opencog examaples

from opencog.scheme_wrapper import load_scm, scheme_eval, scheme_eval_h

When to use scheme_eval_h and when to use scheme_eval?

Linas Vepstas

unread,
Jan 6, 2018, 5:07:39 PM1/6/18
to opencog
scheme_eval_h returns an atom. Always.
scheme_eval returns a string.

I try to tell people to never-ever use scheme_eval, but they don't listen.

There is also scheme_eval_tv which returns a truth value.  Someday, we need to merge these, since  both truth values and atoms are special-cases of the same object (a value).

--linas
 

--
"The problem is not that artificial intelligence will get too smart and take over the world," computer scientist Pedro Domingos writes, "the problem is that it's too stupid and already has."

Eyob

unread,
Jan 6, 2018, 5:12:53 PM1/6/18
to opencog
tnx linas. whats wrong with using scheme_eval though?

Linas Vepstas

unread,
Jan 6, 2018, 5:22:28 PM1/6/18
to opencog
On Sat, Jan 6, 2018 at 4:12 PM, Eyob <edyi...@gmail.com> wrote:
tnx linas. whats wrong with using scheme_eval though?

Because you mostly should not be writing any programs in scheme!  Or python, for that matter!  Write everything in atomese! Or use the pattern matcher, the pattern minor, the chainer, PLN, or one of the other existing systems.

Of course, that is not strictly possible: there are certain core algorithms that have to be written in C++, and I do write a fair amount of scheme code, because its easier than C++. And you might like python because its easier than C++.  But these "core algorithms" really should be that: to implement some important ... algorithm .. that everyone might need.

if you feel you need to use scheme_eval, that mostly seems to suggest that you are being sloppy, or lazy, or confused, or not thinking clearly about what you are doing.   The result is just ad-hoc spaghetti code that is hard to understand, hard to maintain, hard to debug.   There is probably some simpler, easier, faster, better way of doing whatever its is you need scheme_eval for.

--linas

--
You received this message because you are subscribed to the Google Groups "opencog" group.
To unsubscribe from this group and stop receiving emails from it, send an email to opencog+unsubscribe@googlegroups.com.
To post to this group, send email to ope...@googlegroups.com.
Visit this group at https://groups.google.com/group/opencog.
To view this discussion on the web visit https://groups.google.com/d/msgid/opencog/24ac6669-36e5-4213-9d37-dcbb57503d1d%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Eyob

unread,
Jan 7, 2018, 9:31:15 AM1/7/18
to opencog
Well am building a web app in python which uses opencog. Seems I need to use scheme_eval_h or its infamous bro ;)


On Sunday, January 7, 2018 at 1:22:28 AM UTC+3, linas wrote:
On Sat, Jan 6, 2018 at 4:12 PM, Eyob <edyi...@gmail.com> wrote:
tnx linas. whats wrong with using scheme_eval though?

Because you mostly should not be writing any programs in scheme!  Or python, for that matter!  Write everything in atomese! Or use the pattern matcher, the pattern minor, the chainer, PLN, or one of the other existing systems.

Of course, that is not strictly possible: there are certain core algorithms that have to be written in C++, and I do write a fair amount of scheme code, because its easier than C++. And you might like python because its easier than C++.  But these "core algorithms" really should be that: to implement some important ... algorithm .. that everyone might need.

if you feel you need to use scheme_eval, that mostly seems to suggest that you are being sloppy, or lazy, or confused, or not thinking clearly about what you are doing.   The result is just ad-hoc spaghetti code that is hard to understand, hard to maintain, hard to debug.   There is probably some simpler, easier, faster, better way of doing whatever its is you need scheme_eval for.

--linas



On Sunday, January 7, 2018 at 1:07:39 AM UTC+3, linas wrote:


On Sat, Jan 6, 2018 at 8:02 AM, Eyob <edyi...@gmail.com> wrote:

Hi,

we have this from the opencog examaples

from opencog.scheme_wrapper import load_scm, scheme_eval, scheme_eval_h

When to use scheme_eval_h and when to use scheme_eval?

scheme_eval_h returns an atom. Always.
scheme_eval returns a string.

I try to tell people to never-ever use scheme_eval, but they don't listen.

There is also scheme_eval_tv which returns a truth value.  Someday, we need to merge these, since  both truth values and atoms are special-cases of the same object (a value).

--linas
 

--
"The problem is not that artificial intelligence will get too smart and take over the world," computer scientist Pedro Domingos writes, "the problem is that it's too stupid and already has."

--
You received this message because you are subscribed to the Google Groups "opencog" group.
To unsubscribe from this group and stop receiving emails from it, send an email to opencog+u...@googlegroups.com.

To post to this group, send email to ope...@googlegroups.com.
Visit this group at https://groups.google.com/group/opencog.
Reply all
Reply to author
Forward
0 new messages