mirror of
https://github.com/janet-lang/janet
synced 2024-09-29 15:30:41 +00:00
parent
f2313b9959
commit
f647ac5631
@ -1047,11 +1047,12 @@
|
|||||||
(var i 0) (var nextn n)
|
(var i 0) (var nextn n)
|
||||||
(def len (length ind))
|
(def len (length ind))
|
||||||
(def ret (array/new (math/ceil (/ len n))))
|
(def ret (array/new (math/ceil (/ len n))))
|
||||||
|
(def slicer (if (bytes? ind) string/slice tuple/slice))
|
||||||
(while (<= nextn len)
|
(while (<= nextn len)
|
||||||
(array/push ret (tuple/slice ind i nextn))
|
(array/push ret (slicer ind i nextn))
|
||||||
(set i nextn)
|
(set i nextn)
|
||||||
(+= nextn n))
|
(+= nextn n))
|
||||||
(if (not= i len) (array/push ret (tuple/slice ind i)))
|
(if (not= i len) (array/push ret (slicer ind i)))
|
||||||
ret)
|
ret)
|
||||||
|
|
||||||
###
|
###
|
||||||
|
Loading…
Reference in New Issue
Block a user