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

Figure out how to handle output in all frameworks #32

Closed
asmaloney opened this issue Aug 18, 2021 · 4 comments
Closed

Figure out how to handle output in all frameworks #32

asmaloney opened this issue Aug 18, 2021 · 4 comments
Labels
bug Something isn't working investigate

Comments

@asmaloney
Copy link
Owner

asmaloney commented Aug 18, 2021

The "print" and "write" statements need to be implemented in pyactr and vanilla if possible.

If not possible, then they may need to be removed as "do statements".

@asmaloney asmaloney added bug Something isn't working investigate labels Aug 18, 2021
asmaloney added a commit that referenced this issue Aug 20, 2021
The print statement was using plain ids but we weren't determining if they were vars or not. It makes more sense and reads better to require vars with "?".

This also addresses #32 (output) for vanilla ACT-R.
@asmaloney
Copy link
Owner Author

asmaloney commented Aug 21, 2021

It looks like pyactr doesn't have the capability to output arbitrary text during a production.

It does, however, have a way to execute a function on a buffer:

!goal>
	show <slot name>

(This show command is limited to outputting one slot from the given buffer.)

So we might be able to make this work with some hacking by injecting a new method onto Buffer:

import types
from pyactr.buffers import Buffer

def print_text(self,text):
	print( text )

Buffer.print_text = types.MethodType(print_text, Buffer)

...and then calling it in the production like so:

!goal>
	print_text foo

In order to handle our print statement print 42, ?other, "blat", we need to:

  • handle numbers and strings (should be straightforward with some python magic?)
  • determine which vars are used and from which buffers
  • figure out how to access their values through python

I think we can do this by first determining which buffer the var is from, then figuring out the slot name the var relates to, and passing it in instead of the var name?

Not sure if this will work if we want to output vars from two different buffers in one print statement...

asmaloney added a commit that referenced this issue Sep 6, 2021
Can only print strings and only print once per production, so output warnings about variables and multiple print statements.

Partially addresses #32
@asmaloney
Copy link
Owner Author

vanilla now handles print properly as of d5303b9.

pyactr can now output simple strings (no variables), but only once per production. Will output warnings in the output.

@asmaloney
Copy link
Owner Author

Related pyactr issue: Output a variable within a production?

asmaloney added a commit that referenced this issue Oct 11, 2021
This will be used to handle print statements in pyactr (#32)
asmaloney added a commit that referenced this issue Oct 11, 2021
This will be used to handle print statements in pyactr (#32)
asmaloney added a commit that referenced this issue Oct 11, 2021
asmaloney added a commit that referenced this issue Oct 11, 2021
@asmaloney
Copy link
Owner Author

All but one thing (#66) working across all three frameworks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working investigate
Projects
None yet
Development

No branches or pull requests

1 participant