[Haskell-cafe] trivial function application question
clawsie at fastmail.fm
Thu Jan 4 16:37:55 EST 2007
greetings to this helpful and informative list
i have a small problem that will be certainly trivial for almost
everyone reading this, i would appreciate a little help
lets say i have a string
s = "abcdefg"
now i have two lists of strings, one a list of patterns to match, and
a list of replacement strings:
patterns = ["a","b"]
replace = ["Z","Y"]
from which my intent is that "a" be replaced by "Z", "b" by "Y" etc
now using the replace function from MissingH.Str (which i know is now
renamed), i wish to apply replace to s using (pattern, replace),
(pattern, replace)...(pattern[N], replace[N]).
i am sure there is an elegant way to apply replace to s for all of
these argument pairs without composing replace N times myself, but the
solution escapes me.
thanks in advance for any help you can provide for this trivial issue
More information about the Haskell-Cafe