Bend/examples/fusing_not.bend
2024-05-22 19:48:53 +02:00

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^24-1 times and prints the result.
((to_church 0xFFFFFF) fusing_not) # try replacing 'fusing_not' by 'not'. Will it still work?