Balanced brackets: Difference between revisions
Content added Content deleted
(GDScript) |
m (→{{header|RPL}}: reformatting) |
||
Line 6,760: | Line 6,760: | ||
=={{header|RPL}}== |
=={{header|RPL}}== |
||
{{works with|Halcyon Calc|4.2.7}} |
{{works with|Halcyon Calc|4.2.7}} |
||
<syntaxhighlight lang="RPL"> |
|||
'BALBKT' |
|||
≪ |
≪ |
||
1 OVER SIZE |
1 OVER SIZE |
||
WHILE DUP2 * 0 > REPEAT |
'''WHILE''' DUP2 * 0 > '''REPEAT''' |
||
3 PICK OVER DUP SUB |
3 PICK OVER DUP SUB |
||
IF "[]" SWAP POS THEN |
'''IF''' "[]" SWAP POS '''THEN''' |
||
LAST 2 * 3 - |
LAST 2 * 3 - ROT + SWAP '''END''' |
||
ROT + SWAP |
|||
END |
|||
1 - |
1 - |
||
END |
'''END''' DROP |
||
⚫ | |||
DROP |
|||
≫ ''''BALBKT'''' STO |
|||
⚫ | |||
"OK" + |
|||
≫ |
|||
≪ { "" "[]" "[][]" "[[][]]" "][" "][][" "[]][[]" } → ts |
|||
'ASSERT' |
|||
≪ { |
|||
"" |
|||
"[]" |
|||
"[][]" |
|||
"[[][]]" |
|||
"][" |
|||
"][][" |
|||
"[]][[]" } |
|||
→ ts |
|||
≪ |
≪ |
||
1 ts SIZE |
1 ts SIZE '''FOR''' j |
||
⚫ | |||
FOR j |
|||
≫ ≫ ''''TASK'''' STO |
|||
⚫ | |||
NEXT |
|||
≫ |
|||
≫ |
|||
</syntaxhighlight> |
|||
{{out}} |
{{out}} |
||
<pre> |
<pre> |
||
ASSERT |
|||
" → OK" |
" → OK" |
||
"[] → OK" |
"[] → OK" |