SoarGroup / Soar

Soar, a general cognitive architecture for systems that exhibit intelligent behavior.
http://soar.eecs.umich.edu
Other
322 stars 70 forks source link

print silently fails for variables created on RHS #466

Open garfieldnate opened 1 month ago

garfieldnate commented 1 month ago
sp {foo
    (state <s> ^superstate nil ^epmem <e1>) 
    -->
    (<s> ^a <a>)
    (<a> ^b b) 
    (write |Holy smokes!|)
    (write (cmd print --depth 2 <e1>)) # works!
    (write (cmd print --depth 3 <a>)) # does not work
}

The failing print does not give a warning, as I believe it should. The section in the manual on cmd contains an example of printing <s>, but does not mention the restriction to LHS variables: https://soar.eecs.umich.edu/soar_manual/03_SyntaxOfSoarPrograms/#user-defined-functions-and-interface-commands-as-rhs-actions.

I also find it strange that the manual section on print does not mention that it can print variables when run inside of a production. I find it pretty magical that this works. Does the command implementation detect that it's run inside a production, or does Soar translate the variable somehow before passing to the print call?