Skip to content

Commit

Permalink
Add ability to print buffers and buffer slots
Browse files Browse the repository at this point in the history
Examples:

print retrieval
print retrieval.word

Fixes #138
  • Loading branch information
asmaloney committed Aug 21, 2023
1 parent a7993a5 commit 5dbe851
Show file tree
Hide file tree
Showing 9 changed files with 815 additions and 714 deletions.
5 changes: 5 additions & 0 deletions actr/production.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,11 @@ type PrintStatement struct {
Values *[]*Value
}

// IsBufferOutput returns whether or not we have an argument list consisting of one ID.
func (p PrintStatement) IsBufferOutput() bool {
return len(*p.Values) == 1 && (*p.Values)[0].ID != nil
}

// RecallStatement is used to pull information from memory.
type RecallStatement struct {
Pattern *Pattern
Expand Down
8 changes: 5 additions & 3 deletions amod/amod.go
Original file line number Diff line number Diff line change
Expand Up @@ -943,11 +943,13 @@ func convertWithArg(w *withArg) *actr.Value {
}

func convertPrintArg(p *printArg) *actr.Value {
if p.Arg == nil {
return nil
if p.Arg != nil {
return convertArg(p.Arg)
}

return convertArg(p.Arg)
bufferRef := p.BufferRef.String()

return &actr.Value{ID: &bufferRef}
}

func convertPrintArgs(args []*printArg) *[]*actr.Value {
Expand Down
Loading

0 comments on commit 5dbe851

Please sign in to comment.