[Haskell-beginners] Help refactor monster function

Gesh gesh at gesh.uni.cx
Sun Apr 24 17:38:37 UTC 2016


On April 24, 2016 5:41:00 PM GMT+03:00, "Dániel Arató" <exitconsole at gmail.com> wrote:
>>> gatherRoots = chunk (partition (compare `on` root))
>
>That doesn't typecheck. I think you meant
>> gatherRoots = chunk $ \ l@(x:_) -> partition (\y -> root x == root y)
>l
>
You are correct, that was an error in transcription.
>> P.S. You would be correct in claiming that this rewrite is too
>distant from
>> the original to be of use. My apologies if this is the case.
>
>No, this helps a lot, thanks! Reading pro Haskell like this helps me
>improve. It's way more advanced than what I could possibly come up
>with though. I'm still working my way through it.
I'm glad it helped.

Gesh



More information about the Beginners mailing list