2024-05-22 20:47:40 +03:00
|
|
|
# Example of a boolean 'not' function that fuses inifinitely through composition..
|
|
|
|
|
2024-01-11 21:32:41 +03:00
|
|
|
true = λt λf t
|
|
|
|
false = λt λf f
|
2024-05-22 20:47:40 +03:00
|
|
|
|
2024-01-11 21:32:41 +03:00
|
|
|
not = λboolean (boolean false true)
|
|
|
|
fusing_not = λboolean λt λf (boolean f t)
|
2024-05-22 20:47:40 +03:00
|
|
|
|
2024-05-15 22:26:16 +03:00
|
|
|
# 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-07-08 19:02:53 +03:00
|
|
|
# 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?
|