mirror of
https://github.com/HigherOrderCO/Bend.git
synced 2024-09-11 11:56:54 +03:00
17 lines
492 B
Plaintext
17 lines
492 B
Plaintext
# Example of a boolean 'not' function that fuses inifinitely through composition..
|
|
|
|
true = λt λf t
|
|
false = λt λf f
|
|
|
|
not = λboolean (boolean false true)
|
|
fusing_not = λboolean λt λf (boolean f t)
|
|
|
|
# Creates a Church numeral out of a native number
|
|
to_church n = switch n {
|
|
0: λf λx x
|
|
_: λf λx (f (to_church n-1 f x))
|
|
}
|
|
main =
|
|
# Self-composes `not` 2^23-1 times and prints the result.
|
|
((to_church 0x7FFFFF) fusing_not) # try replacing 'fusing_not' by 'not'. Will it still work?
|