So the core question (speaking as a perler) is how do you write my $s= 'abcdefg'; $s =~ s/a/z/g; $s =~ s/b/y/g; print "$s\n";
in haskell? There are various haskell regex libraries out there, including ones that advertise they are PCRE (Perl Compatible Reg Ex). But which one to use? How hard to install? With the libs mentioned above, the "PCRE"-ness seems only to be for matching, not for substitutions. http://www.cs.chalmers.se/~d00nibro/harp/ http://repetae.net/john/computer/haskell/JRegex/ So, I would like to know a good answer to this as well. thomas. brad clawsie-2 wrote: > > 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[0], replace[0]), > (pattern[1], replace[1])...(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 > brad > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe@haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > > -- View this message in context: http://www.nabble.com/trivial-function-application-question-tf2922232.html#a8173692 Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com. _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe