-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #114 from jazzbox35/main
sealing function ontology and test updates
- Loading branch information
Showing
2 changed files
with
33 additions
and
0 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
32 changes: 32 additions & 0 deletions
32
tests/baseline_compat/hyperon-mettalog_sanity/sealed_test.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,32 @@ | ||
!(assertEqualToResult (sealed ($x) (sealed ($a $b) (quote (= ($a $x $c) ($b))))) ((quote (= ($a $x $c) ($b))))) | ||
|
||
!(assertEqualToResult (sealed ($x $y) (quote (= ($y $z)))) ((quote (= ($y $z))))) | ||
|
||
; !(assertEqualToResult (let $x (input $x) (output $x)) (output (input $x))) | ||
|
||
; !(assertEqualToResult (let (quote ($sv $st)) (sealed ($x) (quote ($x (output $x)))) (let $sv (input $x) $st)) (output (input $x))) | ||
|
||
(: callsealer (-> Number Number Expression)) | ||
(= (callsealer $a $b) (sealed () (quote ((* (+ 40 $a) (/ 100 $b)))))) | ||
|
||
!(assertEqualToResult (callsealer $x $y) ((quote ((* (+ 40 $x) (/ 100 $y)))))) ; no sealing | ||
|
||
!(assertEqualToResult (callsealer 10 25) ((quote ((* (+ 40 10) (/ 100 25)))))) | ||
|
||
(: callsealer1 (-> Number Number Expression)) | ||
(= (callsealer1 $a $b) (sealed ($a) (quote ((* (+ 40 $a) (/ 100 $b)))))) | ||
|
||
!(assertEqualToResult (callsealer1 5 $y) ((quote ((* (+ 40 5) (/ 100 $y)))))) | ||
|
||
!(assertEqualToResult (callsealer1 $x $y) ((quote ((* (+ 40 $a) (/ 100 $y)))))) ; $x should be sealed | ||
|
||
(: callsealer2 (-> Number Number Expression)) | ||
(= (callsealer2 $a $b) (sealed ($a $b) (quote ((* (+ 40 $a) (/ 100 $b)))))) | ||
|
||
!(assertEqualToResult (callsealer2 $x 4 ) ((quote ((* (+ 40 $a) (/ 100 4 )))))) ;$x sealed | ||
|
||
!(assertEqualToResult (callsealer2 $x $y) ((quote ((* (+ 40 $a) (/ 100 $b)))))) ;both $x and $y sealed | ||
|
||
|
||
|
||
|