1
1
Fork 0
mirror of https://github.com/azur1s/bobbylisp.git synced 2024-10-16 02:37:40 -05:00
bobbylisp/test.hlm
2023-03-28 20:32:30 +07:00

47 lines
765 B
Plaintext

-- Source
fun make_add() : (num, num) -> num =
\a, b -> num = {
println(a + b);
return a + b;
};
let add = make_add();
fun main() = {
let foo = 34;
let bar = 35 in {
let r = add(foo, bar);
match r
| 69 -> println(r);
| 42 -> println("What");
| _ -> println("Unreachable");
};
};
--- Alpha
Convert `match` to `if-else`
Convert `let` to `call`
---
(fun make_add []
(lambda [a b] (do
(println (+ a b))
(+ a b)
)))
(fun add [a b] (+ a b))
(fun main [] (do
(def foo 34)
((lambda [bar] (do
(def r (add foo bar))
(if (= r 69) (println r)
(= r 42) (println "What")
true (println "Unreachable"))
)) bar)
))