1
1
mirror of https://github.com/anoma/juvix.git synced 2024-12-12 14:28:08 +03:00
juvix/tests/VampIR/positive/Core/test006.jvc
Łukasz Czajka 336a934d18
Normalization by Evaluation (#2038)
* Closes #2032.
* Adds the `juvix dev core normalize` command.
* Adds the `:n` command in JuvixCore REPL.
* Adds the `--normalize` flag to `juvix dev core read` and `juvix dev
core from-concrete`.
* Adds `pipeline-normalize` which denotes pipeline steps necessary
before normalization.
* Adds normalization tests in `tests/VampIR/positive/Core`.
2023-05-15 18:01:40 +02:00

20 lines
531 B
Plaintext

-- arithmetic
def f : Int -> Int -> Int := \(x : Int) \(y : Int) x + y;
def g : Int -> Int -> Int := \(x : Int) \(y : Int) (x + 1) - (y * 7);
def h : (Int -> Int -> Int) -> Int -> Int -> Int := \(f : Int -> Int -> Int) \(y : Int) \(z : Int) f y y * z;
def vx : Int := 30;
def vy : Int := 7;
\(x : Int) \(y : Int) \(z : Int) \(u : Int)
let func : Int -> Int := \(x : Int) x + 4
in
func (y / x) + -- 17 div 5 + 4 = 7
(z * x + y) + -- 17
(vx + vy * (z + 1)) + -- 37
f (h g u 3) 4 -- -29
-- result: 32