Skip to content

Commit

Permalink
Merge pull request #617 from luketpeterson/modules
Browse files Browse the repository at this point in the history
Adding `add-reduct` operation, to merge atoms from a src space into a dst
  • Loading branch information
vsbogd authored Mar 13, 2024
2 parents 3af6c90 + b2f1db1 commit aafa9a8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/src/metta/runner/stdlib.metta
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,9 @@
(let $pattern $atom (let* $tail $template))
$template )))

(: add-reduct (-> Grounded %Undefined% (->)))
(= (add-reduct $dst $atom) (add-atom $dst $atom))

(: car-atom (-> Expression Atom))
(= (car-atom $atom)
(eval (if-decons-expr $atom $head $_
Expand Down
2 changes: 2 additions & 0 deletions lib/src/metta/runner/stdlib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1466,6 +1466,8 @@ mod non_minimal_only_stdlib {
(= (if False $then $else) $else)
(: Error (-> Atom Atom ErrorType))
(: add-reduct (-> Grounded %Undefined% (->)))
(= (add-reduct $dst $atom) (add-atom $dst $atom))
; quote prevents atom from being reduced
(: quote (-> Atom Atom))
Expand Down

0 comments on commit aafa9a8

Please sign in to comment.