[Haskell-cafe] Very crazy
Andrew Coppin
andrewcoppin at btinternet.com
Tue Sep 25 05:53:55 EDT 2007
Tristan Allwood wrote:
>
> Just to follow those sentiments, the version I knocked out quickly
> looked like:
> (It's not quite the same as the original function, I think I'm lacking a
> map (map (take 8)) on the first line).
>
> showSystems :: Show a => [[a]] -> String
> showSystems = unlines . zipWith showSystem [1..]
> where
> showSystem n as = "Eq" ++ (show n) ++ ": " ++ sum ++ " = " ++ val
> where
> sum = concat . intersperse " + " . zipWith showNum [1..] $ (init as)
> val = show . last $ as
> showNum n a = show a ++ " x" ++ show n
>
>
I'm puzzled - do we have 2 seperate where clauses?
> Pointsfree and explicit lambda notation I find can be very concise in
> places, but make it quite hard to reuse or refactor code later - if you
> can't read it, make a function/variable with a useful name so you can
> later.
>
Mmm, so just like every other programming language. Theoretically you
could write a ten thousand line Pascal program on 1 line - but please
don't! Hehe.
More information about the Haskell-Cafe
mailing list