On Wed, 13 Oct 2004 18:06:01 +0100, Malcolm Wallace <malcolm.wallace@cs.york.ac.uk> wrote:
"Jacques Carette" <carette@mcmaster.ca> writes:
-- |Apply list of functions to some value, returning list of results. -- It's kind of like an converse map. flist :: [a->b] -> a -> [b] flist fs a = map ($ a) fs
I have attempted, unsuccessfully, to write flist above in a point-free manner. Is it possible?
flist = flip (map . (flip ($)))
Note that if you define swing :: (((a -> b) -> b) -> c -> d) -> c -> a -> d swing f = flip (f . flip ($)) then you can get this sort of effect uniformly in a number of situations: swing map :: forall a b. [a -> b] -> a -> [b] swing any :: forall a. [a -> Bool] -> a -> Bool swing foldr :: forall a b. b -> a -> [a -> b -> b] -> b