[Haskell-cafe] RE: [Haskell] is $ a no-op?

Graham Klyne GK at ninebynine.org
Wed Oct 13 15:26:59 EDT 2004


[Switched to haskell-cafe]

At 13:24 13/10/04 -0400, Jacques Carette wrote:
> > > --  It's kind of like an converse map.
> >
> > I have attempted, unsuccessfully, to write flist above in a point-free
> > manner.  Is it possible?
>
> > Of course it is, but why?
> > flist = flip (map . flip ($))
>
>Some functions are simpler point-free, others are simpler with points.  I
>was curious about this one (I like the pointwise version better).
>
>Also, the statement "It's kind of like a converse map" becomes quite clear
>from the point-free way to write it, while still not so obvious in the
>pointwise version.

The point-free form can be deduced thus, I think:

flist fs a = map ($ a) fs

(flip flist) a fs = map ($ a) fs        -- swap flist args
(flip flist) a = map ($ a)              -- redundant arg
(flip flist) a = map ((flip ($)) a)     -- expand section
(flip flist) a = (map . (flip ($))) a   -- definition of .
(flip flist) = map . (flip ($))         -- redundant arg
flist = flip (map . (flip ($)))         -- move flip to RHS

#g


------------
Graham Klyne
For email:
http://www.ninebynine.org/#Contact



More information about the Haskell-Cafe mailing list