mirror of
https://github.com/anoma/juvix.git
synced 2025-01-05 22:46:08 +03:00
d576111241
* Closes #2035 * Depends on #2086 * Depends on #2096 * Adds end-to-end tests for the Juvix-to-VampIR compilation pipeline. --------- Co-authored-by: Jonathan Cubides <jonathan.cubides@uib.no>
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;
|