1
0
mirror of https://github.com/janet-lang/janet synced 2024-11-24 17:27:18 +00:00

rework reverse, again

This commit is contained in:
primo-ppcg 2023-08-13 00:49:20 +07:00
parent 7475362c85
commit 53e16944a1

View File

@ -1447,9 +1447,11 @@
byte values, reversed.`
[t]
(var n (length t))
(def ret (array/new-filled n))
(forv i 0 n
(put ret i (in t (-- n))))
(def ret (if (bytes? t)
(buffer/new-filled n)
(array/new-filled n)))
(each v t
(put ret (-- n) v))
ret)
(defn invert