|
|
|
|
|
by Tarean
2724 days ago
|
|
You can name things like (\id. ...) (\x. x)
This names the identity function id. You can make this slightly prettier like (\let. ...) (\def body. body def)
Which lets you do let (\x. x) \id. ...
Booleans are also functions let (\t f. t) \true.
let (\t f. f) \false.
let (\x. x) \then.
let (\x. x) \else.
let (\b thenLit ift elseLit iff. b ift iff) \if.
Which lets you write if true then foo else bar
Where then and else are thrown away, without them it is basically lisp syntax. You could make this slightly fancier - translate into cps to support `else if` and require `end` at the end.Tl;dr: with hacks |
|