-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update: this fixes the most pressing issues (as mentioned in issue #18)…
… regarding calling non-deterministic compiled code from the MeTTa interpreter
- Loading branch information
Showing
6 changed files
with
20 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,13 @@ | ||
!(extend-py! mettamorph) | ||
!(compile! " | ||
;supported as in no case does this function return 2 values | ||
;it just uses non-determinism machinery to execute, but always yields just 1 value | ||
;as the cases are exclusive, such functions can directly be called by Mettamorph | ||
;as they are deterministic: | ||
(= (Add $x Z) $x) | ||
(= (Add $x (S $y)) (Add (S $x) $y)) | ||
|
||
;This non-determinism however would need to backtrack into MeTTa | ||
;to yield all options, which does not work, | ||
;but with collapse it can be flattened: | ||
(= (Sub) 2) | ||
(= (Sub) 3) | ||
(= (SubWrap) (collapse (Sub))) | ||
(= (Mul) (superpose (4 5))) | ||
") | ||
|
||
!(Add (S (S (S Z))) (S (S (S Z)))) | ||
!(let $T (SubWrap) (superpose $T)) | ||
!(Sub) | ||
!(Mul) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters