Hi, 
 
Luke Palmer <luke <at> luqui.org> writes: 
> Stevan Little writes: 
> > One tests shows $pair.kv returning an array with two elements (the key  
> > and value of the pair). (This is also how Pugs currently implements  
> > this.) 
>  
> The former is certainly correct.  When all else fails, consider a pair 
> to be a one-element hash. 
 
then the S29 draft (http://www.rodadams.net/Perl/S29.html) needs 
updating, as currently it states: 
> What is returned at each element of the iteration varies 
> with function. values returns the value of the associated 
> element; **kv returns a 2 element list in (index, value) 
> order**, pairs a Pair(index, value). 
 
Unless, of course, I misunderstand any(S29, Luke) :) -- 
Is the following correct? 
  my @array = <a b c>; 
  my @kv    = @array.kv; 
  say [EMAIL PROTECTED];              # 6 
  say [EMAIL PROTECTED];              # 0 a 1 b 2 c 
 
FYI, before your post, my assumption was: 
  my @array = <a b c>; 
  my @kv    = @array.kv; 
  say [EMAIL PROTECTED];              # 3 
  say [EMAIL PROTECTED];           # 0 a 
  say [EMAIL PROTECTED];           # 1 b 
  say [EMAIL PROTECTED];           # 2 c 
  # That means, @kv = ([0, a], [1, b], [2, c]) 
 
 
--Ingo 
 
--  
Linux, the choice of a GNU | Life would be so much easier if we could 
generation on a dual AMD   | just look at the source code. 
Athlon!                    | -- Dave Olson   

Reply via email to