Rep-string: Difference between revisions

add RPL
(New post in addition to an existing post which uses labels and 'goto' which many people consider inappropriate in modern programming.)
(add RPL)
Line 3,999:
00 -> 0
1 -> (none)
</pre>
 
=={{header|RPL}}==
≪ DUP SIZE → in lin
≪ ""
'''IF''' lin 1 > '''THEN'''
lin 2 / FLOOR 1 '''FOR''' lrep
in 1 lrep SUB DUP
'''DO''' OVER + '''UNTIL''' DUP SIZE lin ≥ '''END'''
'''IF''' 1 lin SUB in == '''THEN''' SWAP 0 ‘lrep’ STO '''END'''
DROP
-1 '''STEP'''
'''END'''
≫ ≫ '<span style="color:blue">REPSTR</span>' STO
≪ { "1001110011" "1110111011" "0010010010" "1010101010" "1111111111" "0100101101" "0100100" "101" "11" "00" "1" }
{ } 1 3 PICK SIZE '''FOR''' j
OVER j GET <span style="color:blue">REPSTR</span> +
'''NEXT''' SWAP DROP
≫ 'TASK' STO
{{out}}
<pre>
1: { "10011" "1110" "001" "1010" "11111" "" "010" "" "1" "0" "" }
</pre>
 
1,150

edits