HaloO,
Daniel Ruoso wrote:
That being said, we should note that this example looks simple because
we have almost no lazyness implied (since there's an assignment in the
first line), every list access requires the evaluation of the flatenning
of the list.
my @@a = ((),(1,2,3),());
Mustn't that be written as (();(1,2,3);()) to produce a three
element outer view?
# the following will require a flatenning to get the actual index
say @a[3];
Could we not shift the problem into a more complicated form
of the size of the array? Here it has size 0+3+0 but each of the
summands could be lazy and hence infinite or at least finite with
unknown value. In any case the flat view @a has to step at most
the first iterator in the array whereas @@a can look beyond that
when indexed with a slice, that is something with semicolon in it.
An out of bounds access like @a[3] can be answered without flattening,
right?
In general I'm in favor of making @a and @@a distinct because
otherwise the first @ in @@a feels like an operator instead like
a twigil that belongs to the variable like $ belongs to $a which
is also distinct from @a. Since one could also go with a shaped
@a I think the choice of @@a versus @a is a bit like the choice
between a @a and an anonymous array in a $ var ala $a = [] which
can be handled through $a almost like @a.
@a =!= @@a :test;
BTW, what does the :test mean there?
Regards, TSa.
--
"The unavoidable price of reliability is simplicity" -- C.A.R. Hoare
"Simplicity does not precede complexity, but follows it." -- A.J. Perlis
1 + 2 + 3 + 4 + ... = -1/12 -- Srinivasa Ramanujan