using guile's load "some_file.scm" doesn't seem to produce the same results as if inputing on guile prompt

14 views
Skip to first unread message

Apil Tamang

unread,
Dec 11, 2016, 12:28:41 PM12/11/16
to opencog
Hi All,
Trying to get started by working out (and understanding) some of the examples on opencog/atomspace/examples/guile. I should have got started on it months ago, but I guess everything on its due time...

As I try to interface with the guile prompt, I find it hard to edit mistakes. Thus, I am trying an approach of defining most nodes/links in a file, loading it into guile, and running cog-execute! on some of the actions I'd like taken. Unfortunately, it isn't doing what I wanted. For example:

scheme@(guile-user)> (StateLink

... (PredicateNode "some property")

... (ListLink

...  (ConceptNode "thing A")

...  (ConceptNode "alt B")

... )

... )

$3 = (StateLink

   (PredicateNode "some property")

   (ListLink

      (ConceptNode "thing A")

      (ConceptNode "alt B")

   )

)


scheme@(guile-user)> (define get-state

... (GetLink

...  (StateLink

...   (PredicateNode "some property")

...   (VariableNode "$x")

...  )

... )

... )

scheme@(guile-user)> (cog-execute! get-state)

$4 = (SetLink

   (ListLink

      (ConceptNode "thing A")

      (ConceptNode "alt B")

   )

)



However, if I try to define 'StateLink' and 'get-state' in a file called '/opencog/apil/get-put.scm', then try the following:

scheme@(guile-user)> (load "/opencog/apil/get-put.scm")

$5 = (SetLink

)


scheme@(guile-user)> (cog-execute! get-state)

$6 = (SetLink

)

I get nothing when I run (cog-execute! get-state). Why is this the case? Also, I wasn't able to change the %load-path for guile to include '/opencog/apil' to default list. Is there a way to have to type '/opencog/apil' everytime I want to load a file in that dir?


Attached is the get-put.scm file I tried to use.

get-put.scm
Reply all
Reply to author
Forward
0 new messages