[Haskell-cafe] Point-free style

Benjamin Franksen benjamin.franksen at bessy.de
Mon Feb 14 22:10:30 EST 2005


On Monday 14 February 2005 17:08, Thomas Jäger wrote:
> > s' = flip flip (span ((0 ==) . fst) . zip [0..] . repeat) . ((.) .) . (id
> > .) . (uncurry .) . flip ((.) . flip (.) . (. (snd . head))) . (. (snd .
> > head))

This one is a little bit shorter and somewhat more 'elementary':

s = (.) (flip (.) (head . uncurry zip . splitAt 1 . replicate 2) . uncurry) . 
(flip (.) (flip (.)) . flip (.))

The really hard part was to find a nice & short point-less version of

\x -> (x,x)

i.e.

head . uncurry zip . splitAt 1 . replicate 2

This stuff is really crazy =8-)))

Ben


More information about the Haskell-Cafe mailing list