Sort:  

Oh snap, the simplify looks crazy! It would be so cool if you could make a post explaining how each little piece works in many details, once you are finished.

There are basically three transformations.

  1. sortOn snd poly
    poly is a list of tuples of two numbers for each polynomial term's coefficient and power. First step sorts the list of tuple by its second element which is power.
  2. groupBy ...
    We group all terms by their power. groupBy returns a list of lists. Each list represent a power value.
  3. map f
    For each list of lists we foldl the list which is basically reducing the list to a single value. For instance if we have 5x^2-3x^2+x^2 it evaluates to 3x^2.

Once you get used to functional programming, most things will look very clear. ;)
Take a look: http://learnyouahaskell.com

I would agree.

beep loves coding ? :D

Coin Marketplace

STEEM 0.35
TRX 0.12
JST 0.040
BTC 70638.80
ETH 3565.34
USDT 1.00
SBD 4.73