labashki/std/string/array/duplicate.lb

53 lines
394 B
Plaintext
Raw Permalink Normal View History

2024-06-19 17:21:26 +00:00
@ 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