[Haskell-cafe] Very crazy

Neil Mitchell ndmitchell at gmail.com
Tue Sep 25 05:16:33 EDT 2007


Hi

> show_system =
>   unlines .
>   zipWith
>     (\l ms ->
>       "Eq" ++
>       show l ++
>       ": " ++
>       (concat $ intersperse " + " $ zipWith (\n x -> x ++ " x" ++ show
> n) [1..] (init ms)) ++
>       " = " ++
>       last ms
>     )
>     [1..] .
>   map (map (take 8 . show))
>
> And people complain that *Perl* is bad? This function is quite obviously
> absurd. I mean, it works, but can *you* figure out what it does without
> running it?

No. Can you say what the intention of this code is? Maybe a few
examples? The type signature? That way I think people will be more
able to give you hints.

Generally, I find list comprehensions to be a good way out of general
listy mess.

Thanks

Neil


More information about the Haskell-Cafe mailing list