Cistercian numerals: Difference between revisions

Line 1,744:
Save as file <tt>j.ijs</tt>, then invoke in a j session
<pre>
main'j_cistercianjc.svg'[load'jc.ijs'
open browser to /tmp/j_cistercianjc.svg
</pre>
The <tt>rc</tt> verb writes <tt>RC=. 0 1 20 300 666 4000 5555 6789</tt>
 
<lang J>
NB. http://rosettacode.org/wiki/Cistercian_numerals
Line 1,759:
 
pwd=:1!:43
rm=: 1!:55@boxopen ::empty
print=: echo@[ NB. debug
print=: (1!:3~,&LF)~ Dyad
Line 1,906:
for_i. }. i. 10000 do.
TPRMS=: (5 ,~ (5 + 15 * 125 | ]) , 5 + 25 * [: (<.) 125 *^:_1 ]) i
fo make_numeral i
end.
'</svg>' print fo
empty close fo
'open browser to {}/{}' format~ (pwd'') ; y
)
rc=: 3 :0 ::('Use: rc ''filename.svg'''"_)
scale=. 20
TPRMS=: 5 5 , scale
rm<y
fo=. open<y
svg_preamble fo
NB. for_i. }. i. 10000 do.
RC=. 0 1 20 300 666 4000 5555 6789
echo 'writing {}' format~ < RC
for_k. (,.~ i.@#) RC do.
'j i'=. k
TPRMS=: (scale ,~ (5 + scale * 15 * 125 | ]) , 5 + scale * 25 * [: (<.) 125 *^:_1 ]) j
fo make_numeral i
end.
Anonymous user