Jump to content

Zig-zag matrix: Difference between revisions

added RPL
(→‎{{header|ALGOL 68}}: Produce the same output regardless of whether formatted transput is used or not)
(added RPL)
Line 6,025:
 
[http://kepkezelo.com/images/kk86ng7p4gcl7z3p7vo1.jpg Zig-Zag matrix]
 
=={{header|RPL}}==
{{works with|RPL|HP-48}}
Turtle's way.
« 1 -1 → n way val
« n DUP 2 →LIST 0 CON
2 n DUP + '''FOR''' s
n s 1 - MIN s OVER -
'''IF''' way 0 > '''THEN''' SWAP '''END'''
'''FOR''' j
j s OVER - 2 →LIST 'val' INCR PUT
way '''STEP'''
'way' SNEG
'''NEXT'''
» » '<span style="color:blue">ZIGZAG</span>' STO
 
6 <span style="color:blue">ZIGZAG</span>
{{out}}
<pre>
1: [[0 2 3 9 10 20]
[1 4 8 11 19 21]
[5 7 12 18 22 29]
[6 13 17 23 28 30]
[14 16 24 27 31 34]
[15 25 26 32 33 35]]
</pre>
 
=={{header|Ruby}}==
1,150

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.