Bend/examples/fusing_not.bend

13 lines
397 B
Plaintext
Raw Normal View History

2024-01-11 21:32:41 +03:00
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
2024-04-03 21:47:47 +03:00
to_church n = switch n {
0: λf λx x
_: λf λx (f (to_church n-1 f x))
}
2024-01-11 21:32:41 +03:00
main =
2024-04-26 23:35:42 +03:00
// Self-composes `not` 2^24 times and prints the result.
2024-05-10 22:59:13 +03:00
((to_church 0xFFFFFF) fusing_not) // try replacing this by not. Will it still work?