mirror of
https://github.com/anoma/juvix.git
synced 2024-11-30 14:13:27 +03:00
98b1daec7d
Print JuvixCore InfoTable in such a way that it can be parsed back by the JuvixCore parser. * Depends on PR #1832 * Depends on PR #1862 * Closes #1841 * Adds "JuvixCore print" tests which read the files from Core/positive/*.jvc, print them, read them back and check if the evaluation results are preserved. --------- Co-authored-by: Jan Mas Rovira <janmasrovira@gmail.com>
16 lines
468 B
Plaintext
16 lines
468 B
Plaintext
-- foldl with match
|
|
|
|
type List {
|
|
nil : Π A : Type, List A;
|
|
cons : Π A : Type, A → List A → List A;
|
|
};
|
|
|
|
def foldl : Π A : Type, Π B : Type, (B → A → B) → B → List A → B :=
|
|
λ(A : Type) λ(B : Type) λ(f : B → A → B) λ(b : B) λ(l : List A)
|
|
match (l : List A) with : B {
|
|
nil _ := b;
|
|
cons _ (h : A) (hs : List A) := foldl A B f (f b h) hs
|
|
};
|
|
|
|
foldl Int Int (+) 0 (cons Int 1 (cons Int 2 (cons Int 3 (nil Int))))
|