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
On Thu, Nov 20, 2003 at 07:27:56PM -0600, Jonathan Scott Duff wrote:
: On Thu, Nov 20, 2003 at 03:26:36PM -0700, Luke Palmer wrote:
: > One wonders what the return value of a loop will be:
: >
: > my $what = do {
: > while $cond {...}
: > }
:
: I would expect it to be the value of
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
* 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
* 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
[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++;
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
On Thu, Nov 20, 2003 at 03:26:36PM -0700, Luke Palmer wrote:
> No. gather{} is a generator (assuming nothing about its name or
> existance whatsoever). It runs some code, gathering up each pick()
> (same assumption) into a list, and returning that.
Thanks for the post Luke. I'd seen what Larry