It seems that the scalar itself is a list of one element:
> "foo"[1] Index out of range. Is: 1, should be in 0..0 in block <unit> at <unknown file> line 5 > "foo"[0] foo > "foo"[*-1] foo
I call the list a list because lists do not seem to have a range of indices:
> (0, 1, 2)[3] Nil
What's going on here. What I do not understand about the operator [].
[]
This is a function Any. From the docs :
Any
Because Perl 6 intentionally mixes items and lists from a single item, most methods are Anyalso present in the class Listand are enforced on Listor on the list type.
List
, , , Any AT-POS, , 0.
AT-POS
Nil .
Nil
, Nil - , . , "" - , , , , .
, Array , Any , -.
Array
,
, , , , .
[] .
( Positional, - , ) "", " ".
.
# Value treated as list shape Indexing range 'a scalar value' (1) 0..0 (0,1,2) (*) 0..Inf my @a (*) 0..Inf my @b[42] (42) 0..41
( (, (0,1,2))), , (*). (3) ( 3- ), , ? (, ?))
(0,1,2)
(*)
(3)
Source: https://habr.com/ru/post/1657198/More articles:error int Failed to set referrer policy - javascripthttps://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1657194/aggregatebykey-fails-to-compile-when-it-is-in-an-abstract-class&usg=ALkJrhgJ2Uq6F-VZ8zdcf3rqMItC9aAP6ACan a Redux Store Lead a Memory Leak? - memory-leaksUWP support for opengl - c ++Marshalling "EGLRenderResolutionScaleProperty" for ANGLE from C # using P / Invoke - c #How to detect jenkins build trigger in jenkinsfile to start building after another job - jenkins-pipelineDjango drops from 1.9 to 1.8 - pythonAngular2 - Add Json with file - javascriptJava - How to double only vowels - javaWhy does `set_index` create an index label for the column name? - pythonAll Articles