mirror of
https://github.com/MartinThoma/LaTeX-examples.git
synced 2025-04-25 22:38:04 +02:00
some haskell / chruch numbers
This commit is contained in:
parent
0277f365eb
commit
2f943ff667
4 changed files with 58 additions and 3 deletions
|
@ -0,0 +1,8 @@
|
|||
type Church t = (t -> t) -> t -> t
|
||||
|
||||
int2church :: Integer -> Church t
|
||||
int2church 0 s z = z
|
||||
int2church n s z = int2church (n - 1) s (s z)
|
||||
|
||||
church2int :: Church Integer -> Integer
|
||||
church2int n = n (+1) 0
|
Loading…
Add table
Add a link
Reference in a new issue