
17 Jun
2012
17 Jun
'12
4:30 a.m.
Thanks, that worked!
Note that this isn't quite the right way to represent a poly if you want to get to a canonical representation.
Can you expand a bit more on this? It is not classic poly, but
combination of symbolic vars,sums,products and exponentiation
operations (in fact, auto-random-generated)
2012/6/17 Chaddaï Fouché
On Sun, Jun 17, 2012 at 9:36 AM, Chaddaï Fouché
wrote: normalize (Sum xs) = case sort . filter (/= I 0) . map normalize $ xs of [] -> I 0 [a] -> a ys -> sumPrefix ys where sumPrefix (I n : I m : ys) = sumPrefix $ I (n+m) : ys sumPrefix ys = ys
Sorry I did this a bit too fast...
normalize (Sum xs) = case sumPrefix . sort . filter (/= I 0) . map normalize $ xs of [] -> I 0 [a] -> a ys -> Sum ys