On 12-Mar-1999, Craig Dickson <[EMAIL PROTECTED]> wrote:
> Steve Frampton wrote:
> 
> >1. Can I perform multiple statements on one line?  Eg.
> >   foo :: Int -> [Char]
> >   foo 0 = []
> >   foo x = b = x - 5 * 3; c = b * 5; foo(x - b * c)
> >
> >   (The above is just a silly example...but you catch my meaning)
> 
> That would be something like:
> 
> foo x = let b = x - 5 * 3
>             c = b * 5
>         in foo (x - b * c)

You can write that on one line as

        foo x = let { b = x - 5 * 3; c = b - 5 * 3; } in c = b * 5

> or
> 
> foo x = foo (x - b * c) where
>             b = x - 5 * 3
>             c = b * 5

Likewise with that:

        foo x = foo (x - b * c) where { b = x - 5 * 3; c = b - 5 * 3; }

-- 
Fergus Henderson <[EMAIL PROTECTED]>  |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>  |  of excellence is a lethal habit"
PGP: finger [EMAIL PROTECTED]        |     -- the last words of T. S. Garp.


Reply via email to