Skip to content

Commit 4ebd2e8

Browse files
Paul Grahamnex3
authored andcommitted
Make the handling of negative values for `end' in cut 0-indexed rather than 1-indexed.
1 parent 3f5c668 commit 4ebd2e8

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

arc.arc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,7 @@
456456
; (nthcdr x y) = (cut y x).
457457

458458
(def cut (seq start (o end (len seq)))
459-
(let end (if (< end 0) (+ (len seq) end 1) end)
459+
(let end (if (< end 0) (+ (len seq) end) end)
460460
(if (isa seq 'string)
461461
(let s2 (newstring (- end start))
462462
(for i 0 (- end start 1)

0 commit comments

Comments
 (0)