Mosaic matrix: Difference between revisions
Content added Content deleted
mNo edit summary |
(→{{header|RPL}}: stack-based variant) |
||
Line 1,440: | Line 1,440: | ||
1 n '''FOR''' c |
1 n '''FOR''' c |
||
r c 2 →LIST r c + 2 MOD NOT PUT '''NEXT NEXT''' |
r c 2 →LIST r c + 2 MOD NOT PUT '''NEXT NEXT''' |
||
≫ ≫ |
≫ ≫ '<span style="color:blue">'''MOZTX'''</span>' STO |
||
4 <span style="color:blue">'''MOZTX'''</span> |
4 <span style="color:blue">'''MOZTX'''</span> |
||
Line 1,450: | Line 1,450: | ||
[ 0 1 0 1 ]] |
[ 0 1 0 1 ]] |
||
</pre> |
</pre> |
||
'''Another approach''' |
|||
This stack-only one-liner can run only on HP-48G and newer models, due to the presence of the <code>∑LIST</code> instruction: |
|||
⚫ | |||
The 1-0-1-.. sequence is created in the stack, then converted into a matrix. |
|||
⚫ | |||
« → n |
|||
⚫ | |||
« 1 n '''FOR''' j |
|||
j 2 MOD |
|||
2 n '''START''' 1 OVER - '''NEXT''' |
|||
'''NEXT''' |
|||
n DUP 2 →LIST →ARRY |
|||
⚫ | |||
⚫ | |||
⚫ | |||
=={{header|Sidef}}== |
=={{header|Sidef}}== |