mirror of
https://github.com/ProgramSnail/Lama.git
synced 2025-12-06 23:08:46 +00:00
24 lines
272 B
Text
24 lines
272 B
Text
|
|
import Ref;
|
||
|
|
|
||
|
|
public fun id (x) {
|
||
|
|
x
|
||
|
|
}
|
||
|
|
|
||
|
|
public infixl $ after * (f, x) {
|
||
|
|
f (x)
|
||
|
|
}
|
||
|
|
|
||
|
|
public infix # at $ (f, g) {
|
||
|
|
fun (x) {
|
||
|
|
f (g (x))
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
public fun fix (f) {
|
||
|
|
local knot = ref (0);
|
||
|
|
|
||
|
|
knot ::= fun () {fun (x) {f (deref (knot) ()) (x)}};
|
||
|
|
|
||
|
|
|
||
|
|
deref (knot) ()
|
||
|
|
}
|