[Haskell-beginners] Re: multreplace

Daniel Fischer daniel.is.fischer at web.de
Fri Jul 2 03:54:11 EDT 2010


On Friday 02 July 2010 09:36:47, Daniel Fischer wrote:
> multRepl pats reps = foldr (.) id (zipWith replace pats reps)

Oops, wrong order of replacings.

We could use one of

foldr (flip (.)) id (zipWith replace pats reps)

foldr (.) id (reverse (zipWith replace pats reps)

multRepl pats reps string 
    = foldl (flip id) string (zipWith replace pats reps)

or many more.


More information about the Beginners mailing list