entered in the display as you perform those keystrokes. First, we present the
steps necessary to produce program CRMC.
Lists represent columns of the matrix
The program @CRMC allows you to put together a p n matrix (i.e., p rows, n
columns) out of n lists of p elements each. To create the program enter the
following keystrokes:
Keystroke sequence:
‚ å
„°
@) S TACK! @@DUP@
‚ é # ~ „n
‚ å
1„°
@) S TACK! @SWAP
„°
@) B RCH! @) F OR@! @FOR@
~„j
„°
@) T YPE OBJ
ARRY@
„°
@) B RCH! @) @ IF@@ @@IF@@
~ „j#
~ „n
„°
@) T EST! @@@<@@@
„°
@) B RCH! @) @ IF@ @THEN
~ „j #1+
„°
L
@) S TACK!
„°
@) B RCH! @) @ IF@ @END
„°
@) B RCH! @) F OR@! @NEXT
„°
@) B RCH! @) @ IF@ @@IF@@
~ „n #1
„°
@) T EST! @@@>@@@
„°
@) B RCH! @@IF@ @THEN
1#
~ „n #1-
„°
@) B RCH! @) F OR@! @FOR@
~ „j #
~ „j #1+
„°
L
@) S TACK!
„°
@) B RCH! @) F OR@! @NEXT!
„°
@) B RCH! ) @ @IF@! @END@
@ROLL
@ROLL!
Produces:
«
DUP
n
<<
1 SWAP
FOR
j
OBJ
ARRY
IF
j
n
<
THEN
j 1 +
ROLL
END
NEXT
IF
n 1
>
THEN
1
n 1 -
FOR
j
j 1 +
ROLL
NEXT
END
Page 10-15