
On Sat, 27 Feb 2016 07:17:13 +0100, Rustom Mody
On Fri, Feb 26, 2016 at 11:11 PM, Rein Henrichs
wrote: Pointfree is good for reasoning about *composition*. It can often be more readable than pointful code when the focus of the function is on composition of other functions. For example, take this function from Bird's *Pearls of Functional Algorithm Design*:
boxes = map ungroup . ungroup . map cols . group . map group
And better if you read it in the right (ie left to right order)
boxes = map group >>> group >>> map cols >> ungroup >>> map ungroup (From Control.Arrow)
Even better if the 3-char clunky >>> is reduced to the 1-char ⋙ map group ⋙ group ⋙ map cols ⋙ ungroup ⋙ map ungroup (From Control.Arrow.Unicode)
You can also use & from Data.Function (since base 4.8.0.0) map group & group & map cols & ungroup & map ungroup Regards, Henk-Jan van Tuyl -- Folding@home What if you could share your unused computer power to help find a cure? In just 5 minutes you can join the world's biggest networked computer and get us closer sooner. Watch the video. http://folding.stanford.edu/ http://Van.Tuyl.eu/ http://members.chello.nl/hjgtuyl/tourdemonad.html Haskell programming --