Re: s/// in string context should return the string

2003-11-25 Thread Mark J. Reed
On 2003-11-25 at 19:53:09, Piers Cawley wrote: > Is that how Ruby does it then? =begin RubyDigression Ruby's String class has the methods sub (replace once) and gsub (replace all), which leave the invocant alone and return the result of the substitution, and sub! and gsub!, which modify the invoc

Re: s/// in string context should return the string

2003-11-25 Thread Piers Cawley
"Mark J. Reed" <[EMAIL PROTECTED]> writes: > On 2003-11-25 at 18:17:04, Piers Cawley wrote: >>aString replace: aPattern with: aString. >> >>aString replaceAll: aPattern with: aString. > > Stop! Stop that at once! No small talk; we're here for > serious discussions! > > :) > >> Except...

Re: s/// in string context should return the string

2003-11-25 Thread Mark J. Reed
On 2003-11-25 at 18:17:04, Piers Cawley wrote: >aString replace: aPattern with: aString. > >aString replaceAll: aPattern with: aString. Stop! Stop that at once! No small talk; we're here for serious discussions! :) > Except... the second argument isn't strictly a string because it's >

Re: s/// in string context should return the string

2003-11-25 Thread Piers Cawley
Jonathan Scott Duff <[EMAIL PROTECTED]> writes: > On Wed, Nov 19, 2003 at 08:23:30PM +, Smylers wrote: >> This, however, is irritating: >> >> my @new = map { s:e/$pattern/$replacement/; $_ } @old; >> >> I forget the C<; $_> far more often than I like to admit and end up with >> an array of

Re: s/// in string context should return the string

2003-11-22 Thread Luke Palmer
David Chan writes: > Hmmm. When doing multiple substitutions, it would be nice to avoid a > hard-to-read nested function call which reads backwards, a la python: > > return re.sub('>','>',re.sub('<','<',re.sub('&','&',text))) > > ... but to also avoid multiple statements like this: > > my $

Re: s/// in string context should return the string

2003-11-22 Thread David Chan
[EMAIL PROTECTED] wrote: > Smylers wrote: >> This, however, is irritating: >> >> my @new = map { s:e/$pattern/$replacement/; $_ } @old; >> >> So I'd like a more elegant way of writing that -- but I don't think >> making the return value of C more complicated (and duplicating >> data in the proces

Re: s/// in string context should return the string

2003-11-21 Thread Larry Wall
On Fri, Nov 21, 2003 at 01:26:18PM +, Piers Cawley wrote: : Simon Cozens <[EMAIL PROTECTED]> writes: : : > [EMAIL PROTECTED] (Luke Palmer) writes: : >> $substituted = ($text ~~ s/$pattern/$replacement/) but nothing; : > : > Surely "no buts"? :) : > : >> What I really want is a functional v

Re: s/// in string context should return the string

2003-11-21 Thread Piers Cawley
Simon Cozens <[EMAIL PROTECTED]> writes: > [EMAIL PROTECTED] (Luke Palmer) writes: >> $substituted = ($text ~~ s/$pattern/$replacement/) but nothing; > > Surely "no buts"? :) > >> What I really want is a functional version of s///. Like: >> my $substituted = $text.s(/$pattern/, { $replace

Re: s/// in string context should return the string

2003-11-21 Thread A. Pagaltzis
* A. Pagaltzis <[EMAIL PROTECTED]> [2003-11-21 13:16]: > But that without nested for modifiers (will those work?) this > isn't be applicable in the middle of a map map map map chain.. I shouldn't edit my stuff so heavily.. what a mess. -- Regards, Aristotle "If you can't laugh at yourself, you

Re: s/// in string context should return the string

2003-11-21 Thread A. Pagaltzis
* Smylers <[EMAIL PROTECTED]> [2003-11-20 11:50]: > This, however, is irritating: > > my @new = map { s:e/$pattern/$replacement/; $_ } @old; > > I forget the C<; $_> far more often than I like to admit and > end up with an array of integers instead of modified strings. > So I'd like a more eleg

Re: s/// in string context should return the string

2003-11-21 Thread Simon Cozens
[EMAIL PROTECTED] (Luke Palmer) writes: > $substituted = ($text ~~ s/$pattern/$replacement/) but nothing; Surely "no buts"? :) > What I really want is a functional version of s///. Like: > my $substituted = $text.s(/$pattern/, { $replacement }); > Without modifying $text. $rubyometer++;

Re: s/// in string context should return the string

2003-11-21 Thread Piers Cawley
Luke Palmer <[EMAIL PROTECTED]> writes: > Smylers writes: >> Perl 5 C currently returns the number of substitutions made. >> This has its uses, so Perl 6 C should probably continue to do >> this. >> >> Can we have a return value that stringifies to the result of the >> substitution but numifies to

Re: s/// in string context should return the string

2003-11-20 Thread Luke Palmer
Smylers writes: > Piers Cawley writes: > > > Stèphane Payrard <[EMAIL PROTECTED]> writes: > > > > > s/// in string context should return the string after substituion. > > > > Surely it should return the string after substitution, but with an >

Re: s/// in string context should return the string

2003-11-20 Thread Jonathan Scott Duff
On Wed, Nov 19, 2003 at 08:23:30PM +, Smylers wrote: > This, however, is irritating: > > my @new = map { s:e/$pattern/$replacement/; $_ } @old; > > I forget the C<; $_> far more often than I like to admit and end up with > an array of integers instead of modified strings. That one gets m

Re: s/// in string context should return the string

2003-11-20 Thread Smylers
Piers Cawley writes: > Stéphane Payrard <[EMAIL PROTECTED]> writes: > > > s/// in string context should return the string after substituion. > > Surely it should return the string after substitution, but with an > appropriate 'but true' or 'but false

Re: [perl] RE: s/// in string context should return the string

2003-11-19 Thread Simon Cozens
[EMAIL PROTECTED] (Allison Randal) writes: > We talked about this today. Our current thought is to retroactively > write the Synopses and keep those up-to-date (with notes in the outdated > parts of the A's and E's pointing to the relevant section of the > S's). To be honest, I don't care how it's

Re: [perl] RE: s/// in string context should return the string

2003-11-19 Thread Allison Randal
Simon wrote: > > How should we go about bringing A3 up to match current reality? It is, after > all, over two years old now. We talked about this today. Our current thought is to retroactively write the Synopses and keep those up-to-date (with notes in the outdated parts of the A's and E's pointi

Re: [perl] RE: s/// in string context should return the string

2003-11-19 Thread Jonathan Scott Duff
On Wed, Nov 19, 2003 at 06:17:33PM +, Simon Cozens wrote: > [EMAIL PROTECTED] (Larry Wall) writes: > > Sigh. There's no =~ operator in Perl 6. > > How should we go about bringing A3 up to match current reality? It is, after > all, over two years old now. Isn't Allison the maintainer? Just p

Re: [perl] RE: s/// in string context should return the string

2003-11-19 Thread Simon Cozens
[EMAIL PROTECTED] (Larry Wall) writes: > Sigh. There's no =~ operator in Perl 6. How should we go about bringing A3 up to match current reality? It is, after all, over two years old now. -- End July 2001 - Alpha release for demonstration at TPC

Re: [perl] RE: s/// in string context should return the string

2003-11-19 Thread Larry Wall
On Wed, Nov 19, 2003 at 09:03:38AM -0500, Austin Hastings wrote: : : : > -Original Message- : > From: Joe Gottman [mailto:[EMAIL PROTECTED] : > Sent: Tuesday, November 18, 2003 9:58 PM : > To: Perl6 : > Subject: Re: [perl] RE: s/// in string context should re

RE: [perl] RE: s/// in string context should return the string

2003-11-19 Thread Austin Hastings
> -Original Message- > From: Joe Gottman [mailto:[EMAIL PROTECTED] > Sent: Tuesday, November 18, 2003 9:58 PM > To: Perl6 > Subject: Re: [perl] RE: s/// in string context should return the string > > > - Original Message - > From: "Austin Ha

Re: [perl] RE: s/// in string context should return the string

2003-11-19 Thread Piers Cawley
"Joe Gottman" <[EMAIL PROTECTED]> writes: > - Original Message - > From: "Austin Hastings" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> > Sent: Tuesday, November 18, 2003 3:04 PM > Subject: [perl] RE:

Re: s/// in string context should return the string

2003-11-19 Thread Piers Cawley
Stéphane Payrard <[EMAIL PROTECTED]> writes: > s/// in string context should return the string after substituion. > It seems obvious to me but I mention it because I can't find it > in the apocalypses. Surely it should return the string after substitution, but with an a

Re: [perl] RE: s/// in string context should return the string

2003-11-18 Thread Joe Gottman
- Original Message - From: "Austin Hastings" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Tuesday, November 18, 2003 3:04 PM Subject: [perl] RE: s/// in string context should return the string > As a "Bvalue" whe

RE: s/// in string context should return the string

2003-11-18 Thread Austin Hastings
As a "Bvalue" where possible, so they can cascade and nest. =Austin > -Original Message- > From: Stephane Payrard [mailto:[EMAIL PROTECTED] > Sent: Tuesday, November 18, 2003 12:19 PM > To: [EMAIL PROTECTED] > Subject: s/// in string context should return th

s/// in string context should return the string

2003-11-18 Thread Stéphane Payrard
s/// in string context should return the string after substituion. It seems obvious to me but I mention it because I can't find it in the apocalypses. -- stef