Re: order of input using Capture
You're passing `a` as a named arg, and `e` as a positional arg. .list only returns the positional args, and .elems only counts those. You can use .hash to get the named args. Alternatively, if you replace `a=>1` with `(a=>1)` or `'a'=>1`, it should show up in the .list and .elems counts. See: http://doc.perl6.org/type/Capture On Mon, Jan 11, 2016 at 3:56 PM mt1957wrote: > L.s. > > I've seen that the order of input to a Capture is not kept. Is this a bug? > > REPL interaction; > > > my Capture $c = \(a=>1,10,{w=>2},[2,3],(e=>2),(b=>3,),Buf.new(^3)) > \(10, {:w(2)}, [2, 3], :e(2), (:b(3),), Buf.new(0, 1, 2), :a(1)) > > > for $c.list -> $item { $item.WHAT.say;} > (Int) > (Hash) > (Array) > (Pair) > (List) > (Buf) > > Last item is missing, a pair :a(1). $c.elems reports 6 elements. I'm not > sure but there was a bug report about it I believe. > > Greetings > Marcel Timmerman >
Re: order of input using Capture
Sorry, that first sentence was imprecise: `a` is a named arg, as compared to the pair `(e=>2)`, which is a positional arg by virtue of the parens. On Mon, Jan 11, 2016 at 5:01 PM Philip Hazeldenwrote: > You're passing `a` as a named arg, and `e` as a positional arg. .list only > returns the positional args, and .elems only counts those. You can use > .hash to get the named args. Alternatively, if you replace `a=>1` with > `(a=>1)` or `'a'=>1`, it should show up in the .list and .elems counts. > > See: http://doc.perl6.org/type/Capture > > On Mon, Jan 11, 2016 at 3:56 PM mt1957 wrote: > >> L.s. >> >> I've seen that the order of input to a Capture is not kept. Is this a bug? >> >> REPL interaction; >> >> > my Capture $c = \(a=>1,10,{w=>2},[2,3],(e=>2),(b=>3,),Buf.new(^3)) >> \(10, {:w(2)}, [2, 3], :e(2), (:b(3),), Buf.new(0, 1, 2), :a(1)) >> >> > for $c.list -> $item { $item.WHAT.say;} >> (Int) >> (Hash) >> (Array) >> (Pair) >> (List) >> (Buf) >> >> Last item is missing, a pair :a(1). $c.elems reports 6 elements. I'm not >> sure but there was a bug report about it I believe. >> >> Greetings >> Marcel Timmerman >> >
order of input using Capture
L.s. I've seen that the order of input to a Capture is not kept. Is this a bug? REPL interaction; > my Capture $c = \(a=>1,10,{w=>2},[2,3],(e=>2),(b=>3,),Buf.new(^3)) \(10, {:w(2)}, [2, 3], :e(2), (:b(3),), Buf.new(0, 1, 2), :a(1)) > for $c.list -> $item { $item.WHAT.say;} (Int) (Hash) (Array) (Pair) (List) (Buf) Last item is missing, a pair :a(1). $c.elems reports 6 elements. I'm not sure but there was a bug report about it I believe. Greetings Marcel Timmerman
Re: order of input using Capture
On 01/11/2016 06:58 PM, mt1957 wrote: Thanks for the information I didn't know about this detail. What about the order of input, when a call is made and a Capture created the order is preserved otherwise the arguments would be bound to the wrong values isn't it? But the example shows otherwise. Aha, I understand now, named argument are repositioned to the back while the rest is still the same order but at the front
Re: order of input using Capture
Thanks for the information I didn't know about this detail. What about the order of input, when a call is made and a Capture created the order is preserved otherwise the arguments would be bound to the wrong values isn't it? But the example shows otherwise.