[Haskell-cafe] Re: Shouldn't this loop indefinitely => take (last [0..]) [0..]

Don Stewart dons at galois.com
Fri Apr 4 17:45:36 EDT 2008


ndmitchell:
> Hi
> 
> >  We can however write function like this:
> >
> >  eqLengths [] [] = True
> >  eqLengths (x:xs) (y:ys) = eqLengths ys xs
> >  eqLengths _ _ = False
> >
> >  which looks just fine for me.
> 
> I have this defined function. I also have lenEq1, lenGt1, and a few
> other variants. It works, but it just doesn't feel elegant.
> 
> Note: In case anyone gets the wrong impression, I am not suggesting
> lazy naturals be the standard numeric type in Haskell, just that by
> not going that way we have paid a cost in terms of elegance.
> 

I'd be happy if we had an (unbounded) Nat type in the first place...

-- Don


More information about the Haskell-Cafe mailing list