-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
395 additions
and
151 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
Empty file.
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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--load=debug | ||
# --exec=skip | ||
--exec=debug | ||
--eval=debug | ||
--case=debug | ||
|
Empty file.
33 changes: 33 additions & 0 deletions
33
examples/features/debugging/hyperon_experimental_issue_481.metta
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 |
---|---|---|
@@ -0,0 +1,33 @@ | ||
; https://github.com/trueagi-io/hyperon-experimental/issues/481 | ||
|
||
;patham9 commented on Nov 1, 2023 • | ||
;Clearly there is no way for the following collapse to have any item: | ||
|
||
!(== () (collapse (let* (($L ()) | ||
($x (superpose $L))) | ||
$x))) | ||
;Yet: | ||
;Output: [False] | ||
;Expected: [True] | ||
|
||
;MeTTa leaves the let* expression unevaluated in this case, which leaves the collapse with a "pseudo-item", an expression with variables, which leads to the comparison to return false even though there cannot be any variable assignment that actually satisfies the let* expression. | ||
|
||
|
||
; vsbogd commented on Nov 2, 2023 | ||
|
||
|
||
;Regarding minimal MeTTa, we have Empty symbol there to represent an empty result. Using it we could potentially properly fix superpose to return Empty from (superpose Empty) call. Thus the example above will turn into: | ||
!(collapse (let $L Empty (let $x (superpose $L) $x))) | ||
|
||
|
||
;And collapse will return () in this case. One can "simulate" this on a current version of minimal MeTTa using additional parenthesis: | ||
!(collapse (let $L (Empty) (let $x (superpose $L) $x))) | ||
|
||
; vsbogd commented on Nov 2, 2023 | ||
; Thus if (superpose $T) is called with $T == Empty it will work. We should also fix collapse to return Empty instead of () to make it complete and allow collapse/superpose chains on Empty results. | ||
|
||
; patham9 commented on Nov 6, 2023 | ||
; I didn't yet get why "Empty" needs to be an explicit value. Either there is a value, which can be an empty tuple () or 42 as a special case, or there is no value, in which case backtracking should occur. What is it for? | ||
|
||
|
||
|
17 changes: 17 additions & 0 deletions
17
examples/features/debugging/hyperon_experimental_issue_492.metta
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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
|
||
|
||
; https://github.com/trueagi-io/hyperon-experimental/issues/492 | ||
|
||
|
||
(= (memb $X Nil) False) | ||
(= (memb $X (Cons $H $Tail)) | ||
(memb $X $Tail)) | ||
(= (memb $X (Cons $X $Tail)) | ||
True) | ||
|
||
|
||
!(let $res | ||
(and (memb $X (Cons 1 (Cons 2 Nil))) | ||
(memb $X (Cons 2 (Cons 3 Nil)))) | ||
(if $res $X None)) | ||
|
15 changes: 15 additions & 0 deletions
15
examples/features/debugging/hyperon_experimental_issue_500.metta
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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
|
||
; https://github.com/trueagi-io/hyperon-experimental/issues/500 | ||
|
||
|
||
(: all (-> Atom Bool)) | ||
(= (all $A) | ||
(if (== () $A) True | ||
(if (car-atom $A) | ||
(let $cdr (cdr-atom $A) (all $cdr)) | ||
False) | ||
) | ||
) | ||
|
||
(= (loop) (loop)) | ||
!(all (True False (loop) True)) |
17 changes: 17 additions & 0 deletions
17
examples/features/debugging/hyperon_experimental_issue_514.metta
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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
|
||
|
||
; https://github.com/trueagi-io/hyperon-experimental/issues/514 | ||
|
||
(= (loop) (loop)) | ||
|
||
; instead we can rewrite and via if | ||
|
||
(: and2 (-> Atom Atom Bool)) | ||
(= (and2 $X $Y) | ||
(if $X $Y False)) | ||
|
||
!(and2 False (loop)) | ||
|
||
!(and False (loop)) | ||
; Evaluating the second argument will harm the performance even if the second argument doesn't contain infinite loop | ||
|
Oops, something went wrong.