lama_byterun/stdlib/Fun.lama

23 lines
261 B
Text
Raw Normal View History

import Ref;
public fun id (x) {
x
}
2020-01-21 22:03:11 +03:00
public infixl $ after := (f, x) {
f (x)
}
2020-01-21 22:03:11 +03:00
public infix # after * (f, g) {
fun (x) {
f (g (x))
}
}
public fun fix (f) {
2020-01-21 22:03:11 +03:00
local knot = ref ({});
2020-01-21 22:03:11 +03:00
knot ::= fun (x) {f (deref (knot)) (x)};
2020-01-21 22:03:11 +03:00
deref (knot)
}