[Haskell-cafe] Very crazy

Lennart Augustsson lennart at augustsson.net
Tue Sep 25 16:11:27 EDT 2007


It's reasonably easy to read.
But you could make it more readable.  Type signatures, naming the first
lambda...

On 9/25/07, Andrew Coppin <andrewcoppin at btinternet.com> wrote:
>
> While using Haskell, I often find myself writing convoluted
> constructions such as this:
>
> 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? The question is, can anybody think of a better way to write
> this function? (And more generally, functions like it.)
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20070925/4818875f/attachment.htm


More information about the Haskell-Cafe mailing list