
18 Oct
2007
18 Oct
'07
1:23 a.m.
On 10/17/07, John Meacham
Oops, sorry, the version I posted was an intermediate one that had a different addition algorithm. here is a better one that fixes that issue:
Zero + y = y Sum x n1 + y = Sum x (y + n1)
note that it alternates the order in the recursive call, interleaving the elements of the two arguments.
Thanks. Have you thought at all about how to make "maximally lazy" Naturals? For example, a data type that can answer True to both genericLength (1:undefined) + genericLength (1:2:3:4:5:6:undefined) > (6 :: Nat) genericLength (1:2:3:4:5:6:undefined) + genericLength (1:undefined) > (6 :: Nat) Is that a desired feature?