Mar. 31st, 2005

fivemack: (Default)
What do you mean, it's computationally foolish to define arithmetic using the Peano axioms?

>pinc [] = [1]
>pinc [1] = [0,1]
>pinc (0:u:xs) =
> if (head (pinc xs) == 0) then (u+head (pinc xs) : drop 1 (pinc xs))
> else (u : pinc xs)
>pinc (1:t:xs) = 0:t+1:xs
>pinc (u:xs) = 0:1:u-1:xs

>pnums = iterate pinc []

March 2024

S M T W T F S
     12
3456789
10111213141516
17181920212223
24 252627282930
31      

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Aug. 10th, 2025 11:07 pm
Powered by Dreamwidth Studios