Re: How do a pe-salt an array inside an object?

2021-07-06 Thread ToddAndMargo via perl6-users
On Tue, 6 Jul 2021 at 10:55, ToddAndMargo via perl6-users mailto:perl6-us...@perl.org>> wrote: Hi All, On creation, I would like to salt some of the values inside an object when the variable inside is an array: First a concept test: $ p6 'class AA { has Str @.I is rw;

Re: How do a pe-salt an array inside an object?

2021-07-06 Thread Fernando Santagata
Hello, I think that that was exactly what Norman was trying to show. Probably you've been mislead by the first value they assigned in their example: my $CC = AA.new( I => [Str,"abc"] ); > Here the 'Str' is the "empty" or "undefined" value, since the array was declared as a Str array. Try this:

Re: How do a pe-salt an array inside an object?

2021-07-06 Thread ToddAndMargo via perl6-users
On Tue, Jul 6, 2021 at 9:39 AM ToddAndMargo via perl6-users I am confused. What I am after it pre-salting $CC.I with $CC.[0] = "abc" $CC.[1] = "def" with the ".new" functions when I create $CC -T On 7/6/21 12:52 AM, Fernando Santagata wrote: Hello, I thin

Re: How do a pe-salt an array inside an object?

2021-07-06 Thread Fernando Santagata
Hi, for your last question, let's use again what Norman showed you earlier: > class AA { has Str @.I is rw } (AA) > my $CC = AA.new(I => [Str, Str, 'two', Str, 'four']) AA.new(I => Array[Str].new(Str, Str, "two", Str, "four")) > say $CC.I[0] (Str) > say $CC.I[2] two > say $CC.I[4] four In this ca

Re: How do a pe-salt an array inside an object?

2021-07-06 Thread ToddAndMargo via perl6-users
On Tue, Jul 6, 2021 at 10:42 AM ToddAndMargo via perl6-users mailto:perl6-us...@perl.org>> wrote: >> On Tue, Jul 6, 2021 at 9:39 AM ToddAndMargo via perl6-users >> I am confused. >> >> What I am after it pre-salting $CC.I with >> $CC.[0] = "abc" >>

Re: How do a pe-salt an array inside an object?

2021-07-06 Thread Tom Browder
On Tue, Jul 6, 2021 at 14:53 ToddAndMargo via perl6-users < perl6-us...@perl.org> wrote: ... > writing out 2000 skips is not practical. Todd, why don't you tell us what you're really trying to do, i.e., what is your use case? Maybe the experts can suggest a better class design. -Tom

Re: How do a pe-salt an array inside an object?

2021-07-06 Thread Bruce Gray
> On Jul 6, 2021, at 3:10 PM, Tom Browder wrote: > > On Tue, Jul 6, 2021 at 14:53 ToddAndMargo via perl6-users > wrote: > ... > writing out 2000 skips is not practical. > > Todd, why don't you tell us what you're really trying to do, i.e., what is > your use case? Maybe the experts can sug

Re: How do a pe-salt an array inside an object?

2021-07-06 Thread ToddAndMargo via perl6-users
On 7/6/21 1:10 PM, Tom Browder wrote: On Tue, Jul 6, 2021 at 14:53 ToddAndMargo via perl6-users mailto:perl6-us...@perl.org>> wrote: ... writing out 2000 skips is not practical. Todd, why don't you tell us what you're really trying to do, i.e., what is your use case? Maybe the experts ca

Re: How do a pe-salt an array inside an object?

2021-07-06 Thread ToddAndMargo via perl6-users
On 7/6/21 1:23 PM, Bruce Gray wrote: On Jul 6, 2021, at 3:10 PM, Tom Browder wrote: On Tue, Jul 6, 2021 at 14:53 ToddAndMargo via perl6-users wrote: ... writing out 2000 skips is not practical. Todd, why don't you tell us what you're really trying to do, i.e., what is your use case? Mayb