develooper Front page | perl.perl6.language | Postings from June 2004

Re: Semantics of vector operations (Damian)

Thread Previous | Thread Next
From:
Matthew Walton
Date:
June 14, 2004 15:08
Subject:
Re: Semantics of vector operations (Damian)
Message ID:
40CE21CD.6030004@alledora.co.uk
Mark J. Reed wrote:

> On 2004-06-14 at 22:58:58, Matthew Walton wrote:
> 
>>'it would be better to explicitly just say
>>
>>(@list.grep value) = undef
>>
>>although I think that might be supposed to be
>>
>>(@list.grep value) »= undef;
> 
> 
> Those do different things according to my understanding.  The first
> removes all matching items from the list; the second replaces the 
> matching items with undef.
> 
> e.g. (please forgive any Perl6 syntax errors):
> 
> 	[1,2,3,4,5].grep { $_ % 2 } = undef
> 
> results in the list
> 
> 	[2,4]
> 
> while
> 
> 	[1,2,3,4,5].grep { $_ % 2 } »= undef
> 
> results in the list
> 
> 	[undef, 2, undef, 4, undef]

That's a very good point, and seems rather likely. I wasn't thinking of 
it that way. Quite cunning really.


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About