[Haskell-cafe] haltavista - look for functions by example
Roel van Dijk
vandijk.roel at gmail.com
Sun Sep 19 14:40:32 EDT 2010
Impressive! I didn't think you could implement it so quickly.
Now someone needs to add this functionality to Leksah or hack
something up for Emacs.
Regards,
Roel
On Sun, Sep 19, 2010 at 8:27 PM, Paul Brauner <paul.brauner at inria.fr> wrote:
> It works:
>
> brauner at worf:/tmp$ cat test.hs
> import Test.QuickCheck
> import Test.QuickCheck.Arbitrary
> import Control.Monad(forM_)
>
> intMul :: Integer -> Integer -> Integer
> intMul x n | n < 0 = -(intMul x $ abs n)
> | n == 0 = 0
> | n > 0 = x + intMul x (n - 1)
>
> main = do xs <- sample' arbitrary
> ys <- sample' arbitrary
> zip xs ys `forM_` \(x,y) ->
> putStrLn (show x ++ " " ++ show y ++ " " ++ (show $ intMul x y))
>
>
> brauner at worf:/tmp$ runghc test.hs | haltavista
> Prelude (*)
>
> I will include this functionality in the next version. Thank you for
> this nice idea.
>
> Paul
More information about the Haskell-Cafe
mailing list