[Haskell-cafe] An interesting curiosity
Dan Piponi
dpiponi at gmail.com
Thu Sep 18 17:07:05 EDT 2008
On Thu, Sep 18, 2008 at 11:59 AM, Andrew Coppin
<andrewcoppin at btinternet.com> wrote:
> foo :: Int -> Maybe Int
> foo x = do
> 4 <- return x
> return (2*x)
>
> Now, if only I could find a use for all this
> that borders on "useful"...! ;-)
It seems a lot less weird when you write something like:
[x | (x,0) <- map (`divMod` n) [1..20]]
which picks out 1/nth of each of the elements of [1..20] that are
divisible by n.
--
Dan
More information about the Haskell-Cafe
mailing list