Fractran: Difference between revisions
Content added Content deleted
(add RPL) |
|||
Line 4,024: | Line 4,024: | ||
</pre> |
</pre> |
||
Output note: There are intermediary numbers (that aren't powers of two) that are hundreds of digits long. <br><br> |
Output note: There are intermediary numbers (that aren't powers of two) that are hundreds of digits long. <br><br> |
||
=={{header|RPL}}== |
|||
≪ → text |
|||
≪ "{'" 1 text SIZE '''FOR''' j |
|||
text j DUP SUB |
|||
'''IF''' DUP " " == '''THEN''' DROP "' '" '''END''' + |
|||
'''NEXT''' |
|||
"'}" + STR→ |
|||
≫ ≫ '<span style="color:blue">PRECOMPIL</span>' STO <span style="color:grey">@ ( "fractions" → { 'fractions' } )</span> |
|||
≪ SWAP 20 → prog steps |
|||
≪ {} SWAP |
|||
1 steps '''FOR''' n |
|||
1 CF |
|||
1 prog SIZE '''FOR''' j |
|||
prog j GET OVER * EVAL RND |
|||
'''IF''' DUP FP '''THEN''' DROP '''ELSE''' |
|||
SWAP DROP SWAP OVER + SWAP |
|||
prog SIZE 'j' STO 1 SF '''END''' |
|||
'''NEXT''' |
|||
'''IF''' 1 FC?C '''THEN''' steps 'n' STO '''END''' |
|||
'''NEXT''' DROP |
|||
≫ ≫ '<span style="color:blue">RUN20</span>' STO <span style="color:grey">@ ( { 'fractions' } n → { results } )</span> |
|||
"17/91 78/85 19/51 23/38 29/33 77/29 95/23 77/19 1/17 11/13 13/11 15/14 15/2 55/1" <span style="color:blue">PRECOMPIL</span> |
|||
2 <span style="color:blue">RUN20</span> |
|||
{{out}} |
|||
<pre> |
|||
1: { 15 825 725 1925 2275 425 390 330 290 770 910 170 156 132 116 308 364 68 4 30 } |
|||
</pre> |
|||
=={{header|Ruby}}== |
=={{header|Ruby}}== |