Add std/string/array/duplicate.lb

This commit is contained in:
bʰedoh₂ swé 2024-06-19 22:21:26 +05:00
parent e3aa95e790
commit 8f5047daf0

View File

@ -0,0 +1,52 @@
@ 0
args 0
size
#exec std/string/array/rev.lb
|#insert push
#insert swap
#insert |jmp
size
; |
; 'T
; 'e
; 's
; 't
; 4
; >
; |size string[size]> (size)
push 0
@ 1
; |index...> (size)
dup
push 2
jmp 255
@ 2
; |size index index...> (size)
sub
jz 254
; |index...> (size)
push 3
jmp 255
@ 3
#expr +
; |size-1 index...>
pick
swap
#expr +
jmp 1
@ 254
quit
@ 255