
29 Sep
2008
29 Sep
'08
11:01 a.m.
par2 :: (a -> b -> c) -> a -> b -> c
par2 f x y = f x (par x y)
Here is the dual: 'par' implemented in terms of parallel application: a `par` b = par2 (\x y-> y) a b
($!) :: (a -> b) -> a -> b f $! x = x `seq` f x
It's terseness vs. maximum composability. I don't even want to think about implementing seq in terms of $!, makes my brain twist.
It's not so difficult. (And you may see some similarity with the above defn of par.) a `seq` b = (\x y-> y) $! a b Regards, Malcolm