mirror of
https://github.com/anoma/juvix.git
synced 2025-01-07 16:22:14 +03:00
22 lines
451 B
Plaintext
22 lines
451 B
Plaintext
|
-- functions returning functions with variable capture
|
||
|
module test008;
|
||
|
|
||
|
open import Stdlib.Prelude;
|
||
|
open import Stdlib.Data.Nat.Ord;
|
||
|
|
||
|
f : Nat → Nat → Nat;
|
||
|
f x := if (x == 6)
|
||
|
λ{_ := 0}
|
||
|
(if (x == 5)
|
||
|
λ{_ := 1}
|
||
|
(if (x == 10)
|
||
|
λ{_ := λ{x := x} 2}
|
||
|
λ{x := x}));
|
||
|
|
||
|
main : Nat -> Nat -> Nat;
|
||
|
main x y :=
|
||
|
f x (x + 1) +
|
||
|
f (x + 1) x +
|
||
|
f y x +
|
||
|
f (y + 1) x;
|