On Sun, Jul 12, 2009 at 9:29 AM, Minimiscience<minimiscie...@gmail.com> wrote:
> On Jul 12, 2009, at 12:07 AM, Chas. Owens wrote:
>>
>> Since grep is defined as returning a list of matching elements and first
>> is
>> defined as being the same as grep, I would say that it returns an empty
>> list
>> if nothing matches.  The empty list is one of the false values.
>
> Does the empty list count as undefined for the purposes of //?  Namely, does
> "(^5).first({ @data[$^i] == $something }) // -1" work as expected?

Let's try it
perl6
my @data=2..6;my $something=7;say (^5).first({ @data[$^i] ==
$something }) // -1;
-1
# set $something = 4 and the result is 2, correct, @data[2] == 4

Reply via email to