forked from GitHub/gf-core
test case for lazy evaluation in the abstract syntax
This commit is contained in:
15
testsuite/runtime/eval/lazy.gf
Normal file
15
testsuite/runtime/eval/lazy.gf
Normal file
@@ -0,0 +1,15 @@
|
||||
abstract lazy = {
|
||||
|
||||
cat Nat ;
|
||||
data zero : Nat ;
|
||||
succ : Nat -> Nat ;
|
||||
|
||||
fun infinity : Nat ;
|
||||
def infinity = succ infinity ;
|
||||
|
||||
fun min : Nat -> Nat -> Nat ;
|
||||
def min zero _ = zero ;
|
||||
min _ zero = zero ;
|
||||
min (succ x) (succ y) = succ (min x y) ;
|
||||
|
||||
}
|
||||
2
testsuite/runtime/eval/lazy.gfs
Normal file
2
testsuite/runtime/eval/lazy.gfs
Normal file
@@ -0,0 +1,2 @@
|
||||
i -src testsuite/runtime/eval/lazy.gf
|
||||
pt -compute min infinity (succ (succ (succ zero)))
|
||||
2
testsuite/runtime/eval/lazy.gfs.gold
Normal file
2
testsuite/runtime/eval/lazy.gfs.gold
Normal file
@@ -0,0 +1,2 @@
|
||||
succ (succ (succ zero))
|
||||
|
||||
Reference in New Issue
Block a user