From 53e16944a19d329d20c49f674adcbbf4794d84bf Mon Sep 17 00:00:00 2001 From: primo-ppcg Date: Sun, 13 Aug 2023 00:49:20 +0700 Subject: [PATCH] rework `reverse`, again --- src/boot/boot.janet | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/boot/boot.janet b/src/boot/boot.janet index 53004eda..9701f1b0 100644 --- a/src/boot/boot.janet +++ b/src/boot/boot.janet @@ -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