[Haskell-cafe] Strange subtract operator behavior - and lazy
dbenbenn at gmail.com
Wed Oct 17 21:23:07 EDT 2007
On 10/17/07, John Meacham <john at repetae.net> wrote:
> 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.
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?
More information about the Haskell-Cafe