Re: [Haskell-cafe] trivial function application question

2007-01-05 Thread Jules Bean
tphyahoo wrote: 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, But that's such a perler attitude. When all you have is a regex,

Re: [Haskell-cafe] trivial function application question

2007-01-05 Thread Chris Kuklewicz
tphyahoo wrote: 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).

Re: [Haskell-cafe] trivial function application question

2007-01-05 Thread Yitzchak Gale
tphyahoo wrote: There are various haskell regex libraries out there, Jules Bean wrote: But that's such a perler attitude. When all you have is a regex, everything looks like a s///! Not always, sometimes it is right to use regexes in Haskell also. If there are more than a few patterns to

Re: [Haskell-cafe] trivial function application question

2007-01-05 Thread Jules Bean
Yitzchak Gale wrote: You need to use a more sophisticated algorithm - building up trees of potential matches, backtracking in some cases, etc. Why re-invent the wheel? Just use the regex library, where that is already done. It's merely a question of selecting the right wheel. Some problems

Re: [Haskell-cafe] trivial function application question

2007-01-05 Thread Brandon S. Allbery KF8NH
On Jan 5, 2007, at 9:38 , Jules Bean wrote: Yitzchak Gale wrote: You need to use a more sophisticated algorithm - building up trees of potential matches, backtracking in some cases, etc. Why re-invent the wheel? Just use the regex library, where that is already done. It's merely a question

Re: [Haskell-cafe] trivial function application question

2007-01-05 Thread Bill Wood
It would seem that for a regular expression facility to constitute a parser it would have to be able to work on token streams. So my question is, does either the the perl6 generalization or any of the Haskell regex facilities support regular expressions over any free monoid other than finite

Re: [Haskell-cafe] trivial function application question

2007-01-05 Thread Chris Kuklewicz
Bill Wood wrote: It would seem that for a regular expression facility to constitute a parser it would have to be able to work on token streams. So my question is, does either the the perl6 generalization or any of the Haskell regex facilities support regular expressions over any free monoid

Re: [Haskell-cafe] trivial function application question

2007-01-05 Thread Donald Bruce Stewart
tphyahoo: 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; Simple patterns like this you'd just use a 'map' of course: main = print (clean abcdefg) clean = map (by . az) where by c = if c

[Haskell-cafe] trivial function application question

2007-01-04 Thread brad clawsie
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

Re: [Haskell-cafe] trivial function application question

2007-01-04 Thread Neil Mitchell
Hi Brad, i have a small problem that will be certainly trivial for almost everyone reading this, i would appreciate a little help If you have trivial problems, its often useful to ask on Haskell IRC (http://www.haskell.org/haskellwiki/IRC_channel) from which my intent is that a be replaced

Re: [Haskell-cafe] trivial function application question

2007-01-04 Thread J. Garrett Morris
On 1/4/07, brad clawsie [EMAIL PROTECTED] wrote: 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

Re: [Haskell-cafe] trivial function application question

2007-01-04 Thread tphyahoo
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?

Re: [Haskell-cafe] trivial function application question

2007-01-04 Thread J. Garrett Morris
Oops, I seem not to have proofread my message. On 1/4/07, J. Garrett Morris [EMAIL PROTECTED] wrote: On 1/4/07, brad clawsie [EMAIL PROTECTED] wrote: s = abcdefg patterns = [a,b] replacements = [Z,Y] I changed the name here so as not to conflict with the replace function. snip You can