Skip to content

Commit 4636ee7

Browse files
authored
Merge pull request #274 from sogaiu/tweak-slice-examples
Tweak slice examples
2 parents 0b05264 + e50cbd8 commit 4636ee7

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

examples/slice.janet

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
(slice @[1 2 3]) # -> (1 2 3) (a new array!)
1+
(slice @[1 2 3]) # -> (1 2 3)
22
(slice @[:a :b :c] 1) # -> (:b :c)
33
(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
4+
(slice [:a :b :c :d :e] 2 -1) # -> (:c :d :e)
5+
(slice [:a :b :c :d :e] 2 -2) # -> (:c :d)
6+
(slice [:a :b :c :d :e] 2 -4) # -> ()
7+
(slice [:a :b :c :d :e] 2 -10) # -> error: end index -10 out of range [-6,5]
88
(slice "abcdefg" 0 2) # -> "ab"
99
(slice @"abcdefg" 0 2) # -> "ab"
1010

0 commit comments

Comments
 (0)