We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 0b05264 + e50cbd8 commit 4636ee7Copy full SHA for 4636ee7
examples/slice.janet
@@ -1,10 +1,10 @@
1
-(slice @[1 2 3]) # -> (1 2 3) (a new array!)
+(slice @[1 2 3]) # -> (1 2 3)
2
(slice @[:a :b :c] 1) # -> (:b :c)
3
(slice [:a :b :c :d :e] 2 4) # -> (:c :d)
4
-(slice [:a :b :d :d :e] 2 -1) # -> (:c :d :e)
5
-(slice [:a :b :d :d :e] 2 -2) # -> (:c :d)
6
-(slice [:a :b :d :d :e] 2 -4) # -> ()
7
-(slice [:a :b :d :d :e] 2 -10) # -> error: range error
+(slice [:a :b :c :d :e] 2 -1) # -> (:c :d :e)
+(slice [:a :b :c :d :e] 2 -2) # -> (:c :d)
+(slice [:a :b :c :d :e] 2 -4) # -> ()
+(slice [:a :b :c :d :e] 2 -10) # -> error: end index -10 out of range [-6,5]
8
(slice "abcdefg" 0 2) # -> "ab"
9
(slice @"abcdefg" 0 2) # -> "ab"
10
0 commit comments