extraction with [:]
Publié : jeu. avr. 25, 2019 10:42 pm
Hello BP
a:=["foo","bar","baz","qux","quux","corge"]
a[:4].extend(a[4:]) [enter]
".(a[0:4],extend(a[4 .. -1]))
Error: Invalid dimension"
expected
["foo","bar","baz","qux","quux","corge"]
a[0:6:2] [enter]
["foo", "baz", "quux"] # ok
a[1:6:2] [enter]
["bar", "qux", "corge"] # ok
a[6:0:-2] [enter]
[]
expected
["corge", "qux", "bar"]
a[::-1] [enter]
["corge", "quux", "qux", "baz", "bar", "foo"] # ok
a:=["foo","bar","baz","qux","quux","corge"]
a[:4].extend(a[4:]) [enter]
".(a[0:4],extend(a[4 .. -1]))
Error: Invalid dimension"
expected
["foo","bar","baz","qux","quux","corge"]
a[0:6:2] [enter]
["foo", "baz", "quux"] # ok
a[1:6:2] [enter]
["bar", "qux", "corge"] # ok
a[6:0:-2] [enter]
[]
expected
["corge", "qux", "bar"]
a[::-1] [enter]
["corge", "quux", "qux", "baz", "bar", "foo"] # ok