[Haskell-cafe] haltavista - look for functions by example
Paul Brauner
paul.brauner at loria.fr
Sun Sep 19 14:30:19 EDT 2010
There's a timeout of 1.5 second right now..
On Sun, Sep 19, 2010 at 07:46:54PM +0200, Roel van Dijk wrote:
> In my haste to reply I made an error in my 'newby' multiplication
> function. Pesky negative numbers...
>
> intMul ∷ Integer → Integer → Integer
> intMul x n | n < 0 = -(intMul x $ abs n)
> | n == 0 = 0
> | n > 0 = x + intMul x (n - 1)
>
> I do wonder what happens when haltavista encounters a function that
> diverges. Like my original intMul applied to a negative number:
> "intMul 2 (-1)".
More information about the Haskell-Cafe
mailing list