Gregory, 2010/10/3 Gregory Crosswhite <gcr...@phys.washington.edu>: > On 10/3/10 1:45 PM, Dominique Devriese wrote: >> >> Additionally, you can't combine the functions (blowup . allButLast) >> and lastToTheLength into a function that returns a pair like you seem >> to attempt. You need a function like the following for that: >> >> comma :: (a -> b) -> (a -> c) -> a -> (b,c) >> comma f g x = (f x, g x) >> >> Then you could say: >> >> blowup = (uncurry (++)) . comma (blowup . allButLast) lastToTheLength > > It is worth noting that such a function already exists in the standard > libraries; it is the &&& operator in Control.Arrow: > > blowup = uncurry (++) . (blowup . allButLast &&& lastToTheLength)
Or you can write it as (liftA2 (,)) as I noted a few lines further in my mail ;) Dominique _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe