Implementing Peano Naturals

One way to explain what natural numbers are is to do define

\[ 0 := \left \{ \right \} \\ 1 := \left \{ \left \{ \right \}\right \} \\ 2 := \left \{ \left \{ \right \}, \left \{ \left \{ \right \} \right \}\right \} \\ \vdots \]

I want to implement them using Haskell Lists like this:

1
2
3
4
5
peano 0 = []
peano 1 = [[]]
peano 2 = [[], [[]]]
.
.

To do so, I write the following program:

1
2
peano 0 = []
peano n = map peano [0..n-1]

What can I do to fix this program?


Inspired by Peano Axioms

×

Problem Loading...

Note Loading...

Set Loading...