home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / teach.zip / TEACH8A.ATF < prev    next >
Text File  |  1997-09-18  |  76KB  |  933 lines

  1. XNÉIO 0 1                                                                      °
  2. XNÉCT 0 1E²13                                                                  °
  3. XCÉFC 1 6 .,*0_²                                                               °
  4. XNÉRL 0 16807                                                                  °
  5. XCÉPR 1 1                                                                      °
  6. XCÉLX 1 5 TEACH                                                                °
  7. *(1997 9 14 12 30 44 504)                                                      °
  8. XFDISCLAIMER ÉFX 'DISCLAIMER' 'Σ Copyright statement' 'disclaimer'             °
  9. *(1996 4 6 16 3 42 348)                                                        °
  10.  FDISPLAY ÉFX 'D╜S DISPLAY A;ÉIO;R;C;HL;HC;HT;HB;VL;VB;V;W;N;B'                °
  11.   'Σ DISPLAY A GENERAL ARRAY IN PICTORIAL FORM'                                °
  12.   'Σ  NORMAL CALL IS MONADIC.  DYADIC CALL USED ONLY IN'                       °
  13.   'Σ    RECURSION TO SPECIFY DISPLAY RANK, SHAPE, AND DEPTH.' 'ÉIO╜0'          °
  14.   '»(0=ÉNC ''S'')/''S╜µA''' 'R╜╞µ,S                   Σ PSEUDO RANK.'          °
  15.   'C╜''┐┌└┘''                 Σ UR, UL, LL, AND LR CORNERS.'                   °
  16.   'HL╜''─''                   Σ HORIZONTAL LINE.'                              °
  17.   'HC╜HL,''Θ╕'',HL,''~+ε''      Σ HORIZONTAL BORDERS.'                         °
  18.   'HT╜HC[(0<R)⌡1+0<╞²1╞,S]' 'ΣW╜,0╧■╞0µΓ(1⌐µA)╞A'                              °
  19.   'HB╜HC[3+3╛(''2⌡~A╧«A'' ÉEA ''1+╞ε0⌡(1⌐⌡/µA)╞,A'')+3⌡1<µµS]'                 °
  20.   'VL╜''│''                   Σ VERTICAL LINE.'                                °
  21.   'VB╜VL,''Φ╟''               Σ VERTICAL BORDER.'                              °
  22.   'V╜VB[(1<R)⌡1+0<²1╞²1╟,S]'                                                   °
  23.   '»(0εµA)/''A╜(1⌐µA)µΓ╞A''   Σ SHOW PROTOTYPE OF EMPTIES.'                    °
  24.   '╕(1<╧A)/GEN' '╕(2<µµA)/D3'                                                  °
  25.   'D╜«A                     Σ SIMPLE ARRAYS.' 'W╜1╞µD╜(²2╞1 1,µD)µD'           °
  26.   'N╜²1+1╟µD' '╕(0=µµA)/SS'                                                    °
  27.   'D╜(C[1],V,((W-1)µVL),C[2]),((HT,NµHL),[0]D,[0]HB,NµHL),C[0],(WµVL),C[       °
  28.  3]' '╕0' 'SS:HB╜((0 '' '')=╞0µΓA)/'' -'''                                     °
  29.   'D╜'' '',('' '',[0]D,[0]HB,Nµ'' ''),'' ''' '╕0'                              °
  30.   'GEN:D╜«DISPLAY■A          Σ ENCLOSED ...' 'N╜Dδ.⌠'' '''                     °
  31.   'D╜(Nδ~1ΦN)≡D' 'D╜(δ≡~''  ''╤D)/D' 'D╜((1,µS)µS)DISPLAY D'                   °
  32.   '╕(2≥µ,S)╟D3E,0' 'D3:D╜0 ²1╟0 1╟«ΓA         Σ MULT-DIMENSIONAL ...'          °
  33.   'W╜1╞µD' 'N╜²1+1╟µD'                                                         °
  34.   'D╜(C[1],V,((W-1)µVL),C[2]),((HT,NµHL),[0]D,[0]HB,NµHL),C[0],(WµVL),C[       °
  35.  3]' 'D3E:N╜²2+µ,S'                                                            °
  36. X 'V╜C[Nµ1],[0]VB[1+0<²2╟,S],[0](((²3+╞µD),N)µVL),[0]C[Nµ2]' 'D╜V,D'           °
  37. *(1996 4 6 16 3 42 348)                                                        °
  38.  FEXIT ÉFX 'EXIT' 'Σ Exit from function' '''To log off type:   )OFF'''         °
  39. X '╕'                                                                          °
  40. *(1996 4 6 16 3 42 348)                                                        °
  41.  FGO ÉFX 'GO;T;E;B' 'Σ Expression driver' 'L0:B╜E╜''''' 'æ╜''      '''         °
  42.   'T╜æ' '╕(^/'' ''=T)/L0' '╕((^/'')OFF ''=5╞6╟T)doif ''EXIT'')/0'              °
  43.   '╕(('':''εT)doif ''B╜evaldd (+/^\'''' ''''=T)╟T'')/L0'                       °
  44.   '''E╜ÉEM'' ÉEA T' '╕(0=µ,E)/L0' '╕B/L0'                                      °
  45.   '''This is not a valid APL2 expression''' 'æ╜''*'''                          °
  46. X '╕(''?''⌠╞1╟æ)/L0' 'E' '╕L0'                                                 °
  47. *(1997 8 15 12 29 26 428)                                                      °
  48.  FHELP ÉFX 'HELP;N;I;T' 'Σ Help to student' '''WHAT TO DO'',r'                 °
  49.   '''  ° To get out of the lesson''' '''       ENTER: EXIT'''                  °
  50.   '''  ° To log off APL2'''                                                    °
  51.   '''       FIRST, ENTER: EXIT  THEN ENTER: )OFF'''                            °
  52.   '''  ° To get help''' '''       ENTER: HELP'''                               °
  53.   '''  ° When you see the prompt on a blank line'''                            °
  54.   '''       ENTER AN APL2 EXPRESSION - OR JUST PRESS: ENTER''' 'do'            °
  55.   '''  ° If you get this line'',r'                                             °
  56.   '''This is not a valid APL2 expression'',r,''*'',r'                          °
  57.   '''        YOU CAN EITHER''' '''           A. PRESS: ENTER'''                °
  58.   '''           B. PRESS: ? and then ENTER to see what was incorrect'''        °
  59.   '''              in your expression causing that response'',r' 'do'          °
  60.   '''HINTS'',r'                                                                °
  61.   '''This lesson is made up of '',(«N╜7),'' components named TEACHx, whe       °
  62.  re''' '''the x stands for a digit:'',r' 'I╜0'                                 °
  63.   'L0:T╜''TEACH'',(«I╜I+1)' 'T,'' '',1╟notb(ÉCR T)[2;]' '╕(N>I)/L0'            °
  64.   'do'                                                                         °
  65.   '''You may review either of these components separately. To do that,''       °
  66.  '                                                                             °
  67.   '''first enter EXIT (and RETURN), then enter the name of the lesson.''       °
  68.  ' '''component (e.g. TEACH4).'',r'                                            °
  69.   '''To re-start the lesson, just enter TEACH'',r'                             °
  70.   '''When the screen fills up, it is a good idea to move the cursor to''       °
  71.  ' '''the start of a convenient paragraph, and press ENTER'',r'                °
  72.   '''You may also wish to press PAGE UP to review the prevous pages.'''        °
  73.   'do' '''RESOURCES'',r'                                                       °
  74.   '''You may also enter ONE of the following words at a time'',r'              °
  75. X '''REVIEW  To review the contents of the preceeding lesson''' 'endd'         °
  76. XAP╜0µΓ0 0                                                                     °
  77. *(1997 5 29 12 58 21 568)                                                      °
  78.  FREVIEW ÉFX 'REVIEW' 'Σ Review lesson 7 on depth'                             °
  79.   '''APL2 supports a wide diversity of data structures. The mechanism'''       °
  80.   '''for this is called nesting. We have seen in lesson 6 that data can'       °
  81.  '' '''be organized into rectangular arrangements called arrays. The'''        °
  82.   '''elements of these arrays are scalars (or rank 0 arrays).''' 'do'          °
  83.   '''Simple scalars were defined to be numbers or single characters. As        °
  84.  an'''                                                                         °
  85.   '''extension of the concept of a scalar, APL2 supports a process calle       °
  86.  d'''                                                                          °
  87.   '''ENCLOSE, that converts arbitrary data structures into objects that'       °
  88.  ''                                                                            °
  89.   '''have all the properties of a scalar. With this extension it is now'       °
  90.  '' '''possible to generate data structures of arbitrary complexity.'''        °
  91.   'do'                                                                         °
  92.   '''To support the manipulation of nested data structures, it is necess       °
  93.  ary'''                                                                        °
  94.   '''to supply primitive functions. Three of these primitive functions w       °
  95.  ere'''                                                                        °
  96.   '''introduced in lesson 7. Depth (╧) is a monadic function that return       °
  97.  s''' '''the amount of nesting in a data structure'',r'                        °
  98.   'show ''DISPLAY ((1 2) (3 4)) (5 6) 7'' ''╧((1 2) (3 4)) (5 6) 7'''          °
  99.   '''The enclose (with or without axis specification) is a monadic primi       °
  100.  tive''' '''function that increases the depth of a structure'',r'              °
  101.   'show ''DISPLAY 2 2µ∞4'' ''DISPLAY Γ2 2µ∞4'' ''DISPLAY Γ[1]2 2µ∞4'''         °
  102.   '''The monadic disclose is a primitive APL2 function that removes one'       °
  103.  '' '''level of nesting from a data structure'',r'                             °
  104.   'show ''DISPLAY (1 2) (3 4)'' ''DISPLAY π(1 2) (3 4)'''                      °
  105.   '''When the data has a depth of one or less, disclose has no effect.''       °
  106.  '                                                                             °
  107.   'show ''DISPLAY 2 2µ∞4'' ''DISPLAY π2 2µ∞4'' ''DISPLAY ,5'' ''DISPLAY        °
  108.  π,5'''                                                                        °
  109.   '''Both the enclose and the disclose symbols exist as dyadic primitive       °
  110.  '''                                                                           °
  111.   '''functions. The dyadic disclose is called PICK. It allows the extrac       °
  112.  tion'''                                                                       °
  113.   '''of the contents of a nested structure. The left argument is a vecto       °
  114.  r'''                                                                          °
  115.   '''called ACCESS VECTOR. Its elements must be valid access vectors'',r       °
  116.  '                                                                             °
  117.   'show ''DISPLAY 1 (2 2µ1 2 (3 4 5) 6) 7'' ''2 (2 1) 3π1 (2 2µ1 2 (3 4        °
  118.  5) 6) 7'''                                                                    °
  119.   '''The dyadic enclose is called PARTITION. The left argument is an int       °
  120.  eger'''                                                                       °
  121.   '''vector of the same length as the vector right argument. A zero in t       °
  122.  he'''                                                                         °
  123.   '''left argument is allowed, and acts to suppress the corresponding ri       °
  124.  ght'''                                                                        °
  125.   '''argument element. The boundaries where the left argument increases'       °
  126.  '' '''become the boundaries of nesting'',r'                                   °
  127.   'show ''TEXT╜''''ONE TWO THREE'''''' ''DISPLAY TEXT'' ''DISPLAY (TEXT⌠       °
  128. X'''' '''')ΓTEXT''' 'endd'                                                     °
  129. *(1997 5 31 11 59 20 572)                                                      °
  130.  FRULE ÉFX 'V RULE W' 'Σ Display rules' '╕(2=ÉNC ''V'')/L0'                    °
  131. X '2 rule W ╪ ╕0' 'L0:V rule W'                                                °
  132. *(1997 7 4 11 53 15 428)                                                       °
  133.  FTEACH ÉFX 'TEACH' 'Σ Start eight lesson in APL2 by Zdenek V JIZBA'           °
  134.   'exit ''TEACH''' 'initialize'                                                °
  135.   'TEACH1 Σ Take and drop; fill elements and prototypes'                       °
  136.   'TEACH2 Σ Take and drop with axis specification' 'TEACH3 Σ First'            °
  137.   'TEACH4 Σ Enlist and text processing'                                        °
  138.   'TEACH5 Σ More on enlist and ravel'                                          °
  139.   'TEACH6 Σ Catenation of arrays; lamination'                                  °
  140. X 'TEACH7 Σ Reverse, rotate and transpose' 'problems'                          °
  141. *(1997 6 5 13 37 50 512)                                                       °
  142.  FTEACH1 ÉFX 'TEACH1' 'Σ Processing nested data structures'                    °
  143.   'exit ''TEACH1'''                                                            °
  144.   '''As before, you may review previous lesson by entering REVIEW.'''          °
  145.   'do'                                                                         °
  146.   '''In this lesson we will concentrate on those features of APL2 that''       °
  147.  '                                                                             °
  148.   '''will support every possible manipulation of data structures. We alr       °
  149.  eady'''                                                                       °
  150.   '''know how to generate data with a great deal of complexity. We now n       °
  151.  eed''' '''some more tools in our toolbox.'',r'                                °
  152.   '''We will begin with two new primitive dyadic functions called TAKE a       °
  153.  nd''' '''DROP. Let us see first how these functions work on vectors'''        °
  154.   'do'                                                                         °
  155.   '''The Take function does what it''''s name implies. It takes from the       °
  156.   right'''                                                                     °
  157.   '''argument the number of elements specified by its left argument'',r'       °
  158.   'show ''DISPLAY 2╞(1 2) (3 4) (5 6)'''                                       °
  159.   '''For a vector right argument, the left argument should be a vector o       °
  160.  f'''                                                                          °
  161.   '''length one. However a scalar will work as well, but this is the onl       °
  162.  y'''                                                                          °
  163.   '''exception. The right argument vector can contain arbitrary data'''        °
  164.   '''structures. When the left argument integer is positive, the right h       °
  165.  and'''                                                                        °
  166.   '''components are taken from left to right. When the left argument'''        °
  167.   '''negative, the components are taken from right to left'',r'                °
  168.   'show ''DISPLAY ²2╞(1 2) (3 4) (5 6)'''                                      °
  169.   '''The left argument also allows a zero value'',r'                           °
  170.   'show ''DISPLAY 0╞(1 2) (3 4) (5 6)'''                                       °
  171.   '''The result of this expression is an empty array, but one that conta       °
  172.  ins''' '''a vector of two FILL ITEMS.''' 'do'                                 °
  173.   '''            FILL ELEMENTS AND PROTOTYPES'',r'                             °
  174.   '''Let us experiment with this some more'',r'                                °
  175.   'show ''DISPLAY 0╞''''AB'''' ''''CD'''''' ''DISPLAY 0╞(1 2) ''''AB''''       °
  176.  '''                                                                           °
  177.   '''In the first example, the fill elements are two blanks. In the seco       °
  178.  nd'''                                                                         °
  179.   '''example the fill elements are two zeros. Clearly the fill elements'       °
  180.  ''                                                                            °
  181.   '''are taken from the pattern of the first element of the right argume       °
  182.  nt.''' 'do'                                                                   °
  183.   '''If this is true, then the structure of the vector past the first'''       °
  184.   '''element should be immaterial. Let us see if this happens'',r'             °
  185.   'show ''DISPLAY 0╞(1 2) (3 (4 5)) 6'''                                       °
  186.   '''The vector inside the empty box is a kind of generalized FILL eleme       °
  187.  nt.'''                                                                        °
  188.   '''It is called a PROTOTYPE. Why is this concept important? Consider t       °
  189.  he''' '''following two expressions'',r'                                       °
  190.   'show ''DISPLAY 5µ(1 2) (3 4) (5 6)'' ''DISPLAY 5╞(1 2) (3 4) (5 6)'''       °
  191.   '''In the first expression a vector is shaped by taking the elements''       °
  192.  '                                                                             °
  193.   '''of the right argument from left to right in cyclic order. In the'''       °
  194.   '''second expression when more elements are asked for than there are''       °
  195.  ' '''in the right argument, these are filled in by prototypes.''' 'do'        °
  196.   '''What will we get if we use negative integers in the left argument?'       °
  197.  ',r' 'show ''DISPLAY ²5╞(1 2) 3 4'''                                          °
  198.   '''Clearly we get the same prototype as the fill element.''' 'do'            °
  199.   '''So far we have applied the Take function to nested vectors. What'''       °
  200.   '''about rank 0 arrays and arrays of rank 2 and greater?'',r'                °
  201.   'show ''DISPLAY 3╞Γ(1 2) 3'' ''DISPLAY 2 4╞3 3µ∞9'''                         °
  202.   '''The Take of a rank 0 array will generate a vector with prototypes i       °
  203.  n all'''                                                                      °
  204.   '''but the first element. The Take of a rank 2 array requires the left       °
  205.   argument'''                                                                  °
  206.   '''to be a vector of length 2. More generally, the length of the left'       °
  207.  '' '''argument must be the same as the rank of the right argument.'''         °
  208.   'do'                                                                         °
  209.   '''The left argument axis specification can have negative integers'',r       °
  210.  ' 'show ''DISPLAY 2 ²4╞3 3µ∞9'' ''DISPLAY ²2 4╞3 3µ∞9'''                      °
  211.   '''What will a zero do in the left argument of Take for arrays?'',r'         °
  212.   'show ''DISPLAY 2 2µ(1 2) 3 ''''AB'''''' ''DISPLAY 0 3╞2 2µ(1 2) 3 '''       °
  213.  'AB'''''''                                                                    °
  214.   '''Note that even in a rank 2 array, the prototype is determined from        °
  215.  the''' '''first element of the first row.''' 'do'                             °
  216.   '''DROP is a dyadic APL2 primitive complementary to Take'',r'                °
  217.   'show ''DISPLAY 2╟(1 2) (3 4) (5 6)'' ''DISPLAY ²3╟(1 2) (3 4) 5 6 7''       °
  218.  '                                                                             °
  219.   '''Since Drop removes elements from an array, the prototype enters the       °
  220.  ''' '''picture when nothing is left after the Drop'',r'                       °
  221.   'show ''DISPLAY 2╟(1 2) (3 4)'' ''DISPLAY 100╟(1 2) (3 4)'''                 °
  222.   '''For arrays Drop works the same way as for Take'',r'                       °
  223.   'show ''2 2╟4 4µ∞16'' ''2 ²3╟4 4µ∞16'''                                      °
  224.   '''We can summarize our finding about Take and Drop'',r' '0 RULE 30'         °
  225. X 'endd'                                                                       °
  226. *(1997 6 5 13 38 17 384)                                                       °
  227.  FTEACH2 ÉFX 'TEACH2;A;B' 'Σ First and drop and take with axis'                °
  228.   'exit ''TEACH2''' '''     TAKE AND DROP WITH AXIS SPECIFICATION'',r'         °
  229.   '''Both Take and Drop allow axis specification. For an array, any axis       °
  230.  '''                                                                           °
  231.   '''may be specified. Axes not specified will be left unchanged.'',r'         °
  232.   'show ''DISPLAY 2╞∞9'' ''DISPLAY ²2╞[1]∞9'''                                 °
  233.   '''Although the axis specification clearly works for a vector, it does       °
  234.  '''                                                                           °
  235.   '''not appear to be of any practical import. For arrays, we have'',r'        °
  236.   'show ''DISPLAY ²2 3╞3 3µ∞9'' ''DISPLAY ²2╞[1]3 3µ∞9'''                      °
  237.   '''For the Drop, the analogous expressions are'',r'                          °
  238.   'show ''DISPLAY 1 0╟3 3µ∞9'' ''DISPLAY 1╟[1]3 3µ∞9'''                        °
  239.   '''The first expression using Drop contains a zero. This indicates tha       °
  240.  t''' '''that axis should be left unchanged.''' 'do'                           °
  241.   '''Axis specification in Take and Drop is most useful when used with''       °
  242.  '                                                                             °
  243.   '''arrays of rank greater than two. Note that the ordering of axes'''        °
  244.   '''within the axis specification does not alter the original'''              °
  245.   '''allocation of axes in the right argument.'',r' 'do'                       °
  246.   'show ''A╜1 2 3µ∞6'' ''DISPLAY 2 1╞[2 1]A'' ''DISPLAY 1 2╞[1 2]A'''          °
  247.   '''Take and Drop with axis specification leads to the next rule'',r'         °
  248.   '0 RULE 31' 'do'                                                             °
  249.   '''Before we leave Take and Drop, let us look at some more examples.''       °
  250.  '                                                                             °
  251.   '''To become familiar with these two primitive functions, it is very''       °
  252.  '                                                                             °
  253.   '''instructive to try any number of special situations. On the other''       °
  254.  '                                                                             °
  255.   '''hand, the mere knowledge of the wide flexibility available with'''        °
  256.   '''Take and Drop is sufficient. When a practical need arises in the'''       °
  257.   '''future, you can always refresh your memory by trying out different'       °
  258.  '' '''cases. So here goes'',r'                                                °
  259.   'show ''A╜3 2µ1 2 ''''A'''' 3'' ''DISPLAY A'' ''DISPLAY 3╞[2]A'''            °
  260.   '''The third column of the last expression reproduces the prototype'''       °
  261.   '''of the first column.''' 'do'                                              °
  262.   'show ''B╜1 2 (3 4)'' ''╧B'' ''╧2╞B'''                                       °
  263.   '''The depth of the result need not be the same depth as that of the''       °
  264.  ' '''right argument.'',r' 'show ''(∞0)╞[∞0]A'' ''(∞0)╟[∞0]A'''                °
  265.   '''Null vectors in Take and Drop leave the right argument unchanged.''       °
  266. X' 'endd'                                                                      °
  267. *(1997 6 3 12 44 55 548)                                                       °
  268.  FTEACH3 ÉFX 'TEACH3' 'Σ Pick and the prototype' 'exit ''TEACH3'''             °
  269.   '''           FIRST'',r'                                                     °
  270.   '''Earlier we defined the prototype as the fill element for the Take''       °
  271.  '                                                                             °
  272.   '''and Drop primitives. Using Drop to generate a null vector, we get''       °
  273.  ' '''the prototype enclosed in a null box!'',r'                               °
  274.   'show ''DISPLAY ²3╟(1 2) (3 4)'''                                            °
  275.   '''Is there a way to retrieve just the prototype? We can try the discl       °
  276.  ose'',r' 'show ''P╜²3╟(1 2) (3 4)'' ''DISPLAY πP'''                           °
  277.   '''Attempting to disclose the null box, returns a null vector. What'''       °
  278.   '''we want is to somehow obtain'',r' 'show ''DISPLAY 0 0'''                  °
  279.   '''This is possible to do with the tools available to us so far, but''       °
  280.  ' '''may be inefficient for large arrays'',r'                                 °
  281.   'show ''DISPLAY 3π3╞(1 2) (3 4)'''                                           °
  282.   '''There is a special APL2 primitive function that will do this. It is       °
  283.  ''' '''called FIRST, and is none other than monadic Take'',r'                 °
  284.   'show ''DISPLAY ╞P'''                                                        °
  285.   '''Therefore the idiom that will retrieve the prototype from an array'       °
  286.  '' '''is "╞0╞"'',r' 'show ''DISPLAY ╞0╞(1 2) ''''ABCD'''''''                  °
  287.   '''To answer your next question, as of now, monadic DROP is undefined.       °
  288.  ''' 'do'                                                                      °
  289.   '''Of course First can also be used to extract the first element from'       °
  290.  '' '''a vector'',r'                                                           °
  291.   'show ''DISPLAY 1π(1 2) (3 4)'' ''DISPLAY ╞(1 2) (3 4)'''                    °
  292.   '''So for NON-NULL APL2 vectors, First is equivalent to 1π. What about       °
  293.  ''' '''arrays?'',r' 'show ''DISPLAY ╞2 2µ(1 2) (3 4)'''                       °
  294.   '''This gives us the following rule'',r' '0 RULE 32'                         °
  295.   '''As a corollary, one could say that the prototype of any array is'''       °
  296. X '''the same as the prototype of First of that array.''' 'endd'               °
  297. *(1997 6 5 13 41 29 444)                                                       °
  298.  FTEACH4 ÉFX 'TEACH4;WORDS;PUNCTS;PHRASE' 'Σ The EACH opreator'                °
  299.   'exit ''TEACH4'''                                                            °
  300.   '''In the previous lesson we used the dyadic enclose function to'''          °
  301.   '''generate a vector of vectors from a character string'',r'                 °
  302.   'show ''PHRASE╜''''Once upon a time, there was an elf.'''''''                °
  303.   'show ''WORDS╜(~PHRASEε'''' ,.;:'''')ΓPHRASE'''                              °
  304.   'show ''PUNCTS╜(PHRASEε'''' ,.;:'''')ΓPHRASE'' ''DISPLAY WORDS'' ''DIS       °
  305.  PLAY PUNCTS'''                                                                °
  306.   '''The nested vectors WORDS and PUNCTS contain exactly the same inform       °
  307.  ation'''                                                                      °
  308.   '''as PHRASE. But now the elements of WORDS are in a form that can be'       °
  309.  ''                                                                            °
  310.   '''manipulated for their semantics, while the elements of PUNCTS provi       °
  311.  de'''                                                                         °
  312.   '''information about the phrase syntax. Since PHRASE is equivalent to'       °
  313.  ''                                                                            °
  314.   '''WORDS and PUNCTS, one must ask how could we do the inverse operatio       °
  315.  n,''' '''namely combine WORDS and PUNCTS to reproduce PHRASE.''' 'do'         °
  316.   '''To do just that, we now introduce a new APL2 operator. It is called       °
  317.  ''' '''EACH, and is represented by the symbol ■'',r'                          °
  318.   'show ''DISPLAY WORDS,■PUNCTS'''                                             °
  319.   '''This is not exactly what we want. We have managed to combine the'''       °
  320.   '''elements of WORDS and PUNCTS, but we still have a nested vector.'''       °
  321.   'do'                                                                         °
  322.   '''To convert a nested vector to a simple vector, there is a monadic''       °
  323.  ' '''function called ENLIST. It is represented by the symbol ε'',r'           °
  324.   'show ''DISPLAY εWORDS,■PUNCTS'''                                            °
  325.   '''The resulting vector is identical to the original PHRASE.''' 'do'         °
  326.   '''Let us take a closer look at the Each operator.'' r'                      °
  327.   'show ''5+∞5'' ''5+■∞5'''                                                    °
  328.   '''In the next example, the Each operator also has no effect.'',r'           °
  329.   'show ''5 10+(1 2) (3 4)'' ''5 10+■(1 2) (3 4)'''                            °
  330.   '''In these examples even though the right argument is nested, the'''        °
  331.   '''each operator still has no effect. This will be true even when'''         °
  332.   '''both the left and right argument are nested'',r'                          °
  333.   'show ''(Γ1 2)⌡(1 2) (3 4)'' ''(Γ1 2)⌡■(1 2) (3 4)'''                        °
  334.   '''One may ask, when is the Each operator useful. Here is one example'       °
  335.  ',r' 'show ''DISPLAY ∞■∞4'''                                                  °
  336.   '''One would be tempted at this point to generalize that expressions''       °
  337.  ' '''containing only scalar functions are not affected by the Each'''         °
  338.   '''operator. But this is not quite true, as we can see from the follow       °
  339.  ing''' '''example'',r' 'show ''+/∞5'' ''+/■∞5'''                              °
  340.   '''In the second expression, the reduction is performed on each'''           °
  341.   '''element of the vector. Since these elements are simple scalars'''         °
  342.   '''the result of each reduction is the scalar unchanged''' 'do'              °
  343.   '''Let''''s see how Each behaves with a non scalar function in reducti       °
  344.  on'',r' 'show ''DISPLAY ,/∞5'' ''DISPLAY ,/■∞5'''                             °
  345.   '''Can you explain why the first expression returns a scalar?''' 'do'        °
  346.   '''We can summarize our findings on the each operator'',r'                   °
  347.   '0 RULE 33' 'do' '''Let us try a few more examples'',r'                      °
  348.   'show ''DISPLAY ε■((1 2) (3 4)) (''''ONE'''' ''''TWO'''')'''                 °
  349.   '''In this example we used each on a monadic primitive function'''           °
  350.   'do' 'show ''+/■2 2µ(1 2) (3 4) (5 6) (7 8)'''                               °
  351.   '''When Each is applied to an array, it will process each element of''       °
  352. X' '''that array.''' 'endd'                                                    °
  353. *(1997 6 5 13 42 29 448)                                                       °
  354.  FTEACH5 ÉFX 'TEACH5;A' 'Σ Enlist and ravel' 'exit ''TEACH5'''                 °
  355.   '''ENLIST and RAVEL'',r'                                                     °
  356.   '''In lesson 4 we introduced the comma as a primitive function. As a''       °
  357.  '                                                                             °
  358.   '''monadic function it is called RAVEL, and as a dyadic function it is       °
  359.  '''                                                                           °
  360.   '''called CATENATE. In this lesson we also introduced the monadic'''         °
  361.   '''function called ENLIST. Let us study now how these three primitive'       °
  362.  '' '''functions work on nested arrays.''' 'do'                                °
  363.   '''First, let us compare enlist to ravel. Ravel converts the contents'       °
  364.  ''                                                                            °
  365.   '''of any array to a vector. Enlist converts the contents of any array       °
  366.  '''                                                                           °
  367.   '''to a vector of simple scalars. The difference between these two'''        °
  368.   '''functions is visible only for APL2 objects of depth 2 or greater'',       °
  369.  r' 'show ''DISPLAY ,2 2µ∞4'' ''DISPLAY ε2 2µ∞4'''                             °
  370.   '''In these two examples, enlist and ravel produce the same result,'''       °
  371.   '''because the array is a simple one (all elements are simple scalars)       °
  372.  '',r' 'show ''DISPLAY ,2 2µ2,/∞5'' ''DISPLAY ε2 2µ2,/∞5'''                    °
  373.   '''In the first expression, ravel keeps the non-simple scalars intact,       °
  374.  '''                                                                           °
  375.   '''while in the second expression all components of the array are'''         °
  376.   '''disclosed into a vector of simple scalars.''' 'do'                        °
  377.   '''There are many practical uses of enlist. Consider the following two       °
  378.  ''' '''arrays'',r' 'show ''2 2µ1 2 3 ''''4'''''' ''2 2µ∞4'''                  °
  379.   '''These appear identical, but the first one contains the character 4'       °
  380.  ''                                                                            °
  381.   '''instead of the scalar integer 4. Function DISPLAY does distinguish'       °
  382.  ''                                                                            °
  383.   '''between these two arrays, but fails to identify the component that        °
  384.  is''' '''not an integer'',r'                                                  °
  385.   'show ''DISPLAY 2 2µ1 2 3 ''''4'''''' ''DISPLAY 2 2µ∞4'''                    °
  386.   '''The + sign on the bottom line of the box of the first array indicat       °
  387.  es'''                                                                         °
  388.   '''that it is a mixed array containing both characters and numbers.'''       °
  389.   'do'                                                                         °
  390.   '''We can extract the enlist of the prototype from this array,'',r'          °
  391.   'show ''DISPLAY ε╞0µΓ2 2µ1 2 3 ''''4'''''''                                  °
  392.   '''The resulting vector then can be used not only to tell if the array       °
  393.  '''                                                                           °
  394.   '''is mixed, but also identify those elements that are characters.'''        °
  395.   '''The expression ε╞0µΓ is an idiom, but is not the only one that'''         °
  396.   '''produces this result. You should try to find another expression tha       °
  397.  t''' '''will have the same effect.''' 'do'                                    °
  398.   '''Before we leave ravel, here are some examples of using ravel with''       °
  399.  ' '''axis specification'',r'                                                  °
  400.   'show ''DISPLAY ,A╜2 2 2µ∞8'' ''DISPLAY ,[1 2]A'' ''DISPLAY ,[1 2 3]A'       °
  401. X'' 'endd'                                                                     °
  402. *(1997 6 5 13 43 26 440)                                                       °
  403.  FTEACH6 ÉFX 'TEACH6;A;B;C;D;V;W' 'Σ Catenation' 'exit ''TEACH6'''             °
  404.   '''CATENATION OF ARRAYS'',r'                                                 °
  405.   '''We studied catenation as a primitive function that operates on'''         °
  406.   '''vectors. Catenation can be a very powerful function in the'''             °
  407.   '''construction of arrays and nested APL2 objects. We will begin with'       °
  408.  '' '''the catenation of simple arrays'',r'                                    °
  409.   'show ''7,2 3µ∞6'' ''(2 3µ∞6),7'' ''(2 3µ∞6),6+∞2'' ''(2 3µ∞6),2 2µ6+∞       °
  410.  4''' '''Catenation can be done also with axis specification'',r'              °
  411.   'show ''7,[1]2 3µ∞6'' ''(2 3µ∞6),[1]6+∞3'' ''(2 3µ∞6),[1]3 3µ6+∞9'''         °
  412.   '''These results can be summarized with the following rule'',r'              °
  413.   '0 RULE 34' 'do'                                                             °
  414.   '''We also displayed an expression catenating a rank 2 array to a'''         °
  415.   '''vector. The rule for that process is illustrated with the following       °
  416.  ''' '''example'',r'                                                           °
  417.   'show ''µ(2 3 4µ∞1),2 3µ2'' ''µ(2 3 4µ1),[1]3 4µ2'' ''µ(2 3 4µ1),[2]2        °
  418.  4µ2''' '0 RULE 35' 'do' '''Here are some examples of catenation'',r'          °
  419.   'show ''DISPLAY ,/(1 2 3) (4 5 6)'' ''DISPLAY (1 2 3),■(4 5 6)'''            °
  420.   'show ''DISPLAY (1 2),(3 4) (5 6)'' ''DISPLAY (1 2),■(3 4) (5 6)'''          °
  421.   '''As an exercise try to use some of the primitives we have studied'''       °
  422.   '''so far to generate the following structures starting with the simpl       °
  423.  e''' '''vectors  V╜∞4 and W╜4+∞4'',r' 'V╜∞4' 'W╜4+V' 'A╜V,(πV,■W),W'          °
  424.   'B╜2,/■V W' 'C╜1,+/■2,/V,W' 'D╜Γ[2]4 2µV,W'                                  °
  425.   'show ''DISPLAY A'' ''DISPLAY B'' ''DISPLAY C'' ''DISPLAY D''' 'do'          °
  426.   '''    LAMINATION'',r'                                                       °
  427.   '''The axis specification need not be an integer. When it is not,'''         °
  428.   '''the function has another name. It is called LAMINATION. Here is'''        °
  429.   '''an example of lamination'',r'                                             °
  430.   'show ''DISPLAY V,[0.5]W'' ''DISPLAY V,[1.5]W'''                             °
  431.   '''Lamination provides for the extension of rank. The two arguments'''       °
  432.   '''must have the same shape and rank, or one of them must be a scalar.       °
  433. X''' 'endd'                                                                    °
  434. *(1997 6 5 13 44 32 468)                                                       °
  435.  FTEACH7 ÉFX 'TEACH7;NOS' 'Σ Reverse, rotate and transpose'                    °
  436.   'exit ''TEACH7''' '''    REVERSE, ROTATE AND TRANSPOSE'',r'                  °
  437.   '''There are two important structural functions that complete the'''         °
  438.   '''APL2 toolbox. The first one of these is called REVERSE in its'''          °
  439.   '''monadic form. When used, it reverses the order of elements in'''          °
  440.   '''an array'',r' 'show ''Φ∞5'' ''Φ3 3µ∞9'' ''Φ[1]3 3µ∞9'''                   °
  441.   '''As any other function, it can be used with the Each operator'',r'         °
  442.   'show ''Φ(1 2) (3 4) (5 6)'' ''Φ■(1 2) (3 4) (5 6)'''                        °
  443.   '''There is also a form of reverse to operate on the first axis. This'       °
  444.  '' '''form uses the symbol Θ'',r'                                             °
  445.   'show ''NOS╜2 3µ''''ONE'''' ''''TWO'''' ''''THREE'''' ''''FOUR'''' '''       °
  446.  'FIVE'''' ''''SIX''''''' 'show ''ΦNOS'' ''ΘNOS'''                             °
  447.   '''When used as a dyadic function, Φ is called rotate. The left argume       °
  448.  nt'''                                                                         °
  449.   '''is an integer. It specifies the number of elements to be rotated'''       °
  450.   '''from left to right. A negative value produces a rotation from right       °
  451.  ''' '''to left'',r' 'show ''1Φ∞5'' ''2Φ∞5'' ''²1Φ∞5'''                        °
  452.   '''For arrays of rank 2 or greater, the axis specification can be used       °
  453.  .''' '''Default is the last axis'',r'                                         °
  454.   'show ''1Φ3 3µ∞9'' ''2Φ[1]3 3µ∞9'''                                          °
  455.   '''For arrays of rank 2 or greater, the left argument may be a non-sca       °
  456.  lar.'''                                                                       °
  457.   '''The dimension of the left argument must be equal to ²1╟µR, where R        °
  458.  is'''                                                                         °
  459.   '''the right argument. This is best illustrated for an array of rank 2       °
  460.  '',r' 'show ''0 1 2Φ3 4µ∞12'' ''0 1 2 3Φ[1]3 4µ∞12'''                         °
  461.   '''For arrays of rank greater than 2 we have'',r'                            °
  462.   'show ''(2 3µ∞4)Φ2 3 4µ∞24'' ''(2 4µ∞4)Φ[2]2 3 4µ∞24'' ''(3 4µ∞4)Φ[1]2       °
  463.   3 4µ∞24'''                                                                   °
  464.   '''The second structural function is called TRANSPOSE, and it''''s sym       °
  465.  bol'''                                                                        °
  466.   '''is φ (upper case 6). Transpose has a monadic as well as a dyadic fo       °
  467.  rm.''' '''Transpose interchanges axes'',r'                                    °
  468.   'show ''φ3 3µ∞9'' ''φNOS'' ''µφ2 4µ∞8'''                                     °
  469.   '''For arrays of rank greater than 2, the monadic transpose reverses a       °
  470.  xes'',r' 'show ''µφ2 3 4µ2'' ''µφ1 2 3 4 5µ5'''                               °
  471.   '''The dyadic form of transpose has two versions:'',r'                       °
  472.   '''     1. The left argument specifies the desired ordering of the axe       °
  473.  s'',r' 'show ''µ2 1 3φ2 3 4µ5'' ''µ3 2 1φ2 3 4µ5'''                           °
  474.   '''In the first example the first axis is placed second, and the secon       °
  475.  d'''                                                                          °
  476.   '''one is placed first. In the second example the first axis is placed       °
  477.  '''                                                                           °
  478.   '''third, and the third axis is placed first. (This is the same result       °
  479.   as''' '''with monadic transpose.)''' 'do'                                    °
  480.   '''The second form of the dyadic transpose allows the repetition of ax       °
  481.  es.'''                                                                        °
  482.   '''This form is a powerful tool in certain applications of math dealin       °
  483.  g''' '''with tensors. Here are some examples of this second form'',r'         °
  484.   'show ''3 3µ∞9'' ''1 1φ3 3µ∞9'' ''1 1 2φ3 3 3µ∞27'' ''1 2 1φ3 3 3µ∞27'       °
  485. X'' 'endd'                                                                     °
  486. *(1997 7 13 12 28 49 504)                                                      °
  487.  Faddquote ÉFX 'u╜addquote w'                                                  °
  488.   'Σ Put quotes around a string, and double existing quotes'                   °
  489. X 'u╜ÉAV[40],((1+w=ÉAV[40])/w),ÉAV[40]'                                        °
  490. *(1997 7 24 13 20 38 476)                                                      °
  491.  Fav ÉFX 'av;A;N;I;ÉIO' 'Σ Display characters in ÉAV' 'ÉIO╜0'                  °
  492.   'A╜22 78µ'' ''' 'N╜3 0«φ12 22µ1+∞356' 'A[;,(6⌡∞12)°.+2 3 4]╜N'               °
  493.   'A[;6+6⌡∞12]╜φ12 22µÉAV' 'ΣA[8 10 13;6]╜'' ''' 'A[13;6]╜'' '''               °
  494. X 'A[14+∞8;68 69 70 72]╜'' ''' 'A'                                             °
  495. *(1991 11 11 8 25 13 316)                                                      °
  496.  Fdate ÉFX 'u╜date w' 'Σ Format date and time of day' 'u╜«6╞w'                 °
  497. X 'u╜('' ''⌠u)Γu' 'u╜εu,■''-- .. '''                                           °
  498. XCdig 1 10 1234567890                                                          °
  499. *(1997 9 9 13 0 45 372)                                                        °
  500.  Fdisclaimer ÉFX 'disclaimer' 'Σ Copyright statement'                          °
  501.   '(10µ'' ''),''Copyright, Z. V. Jizba, 1995,1996,1997'',r'                    °
  502.   ''' This and subsequent workspaces labelled TEACHxx are made available       °
  503.  '''                                                                           °
  504.   '''at no cost to anyone who desires to learn how to use effectively'''       °
  505.   '''the IBM/OS2 version of APL2.'',r'                                         °
  506.   '''This software is provided "AS IS" with no WARRANTY of any kind, eit       °
  507.  her'''                                                                        °
  508.   '''express or implied. Any risk in its use resides with you, the user        °
  509.  of''' '''these tutorials.'',r' '''     ACKNOWLEDGEMENTS'',r'                  °
  510.   ''' In writing these tutorials, I am greatly indebted to Roy Sykes, wh       °
  511.  ose'''                                                                        °
  512.   '''excellent lectures increased my understanding of the language.'''         °
  513.   '''Discussions with the late Harry Bertucelli clarified a number of'''       °
  514.   '''concepts and caused me to change some improper terminology that was       °
  515.  '''                                                                           °
  516.   '''used in previous versions of these tutorials. Mr. Benjamin Archer''       °
  517.  '                                                                             °
  518.   '''kindly checked out a nearly final version, bringing to my attention       °
  519.  ''' '''some ommisions, misspellings, and invalid terminology.'',r'            °
  520. X '''(PRESS ENTER to continue)'''                                              °
  521. *(1997 7 13 12 28 50 508)                                                      °
  522.  Fdo ÉFX 'do;T;E' 'Σ Expression driver' 'E╜''''' 'æ╜''      ''' 'T╜æ'          °
  523.   '╕(^/'' ''=T)/0'                                                             °
  524.   '╕(('':''εT)doif ''B╜evaldd (+/^\'''' ''''=T)╟T'')/2'                        °
  525.   '''E╜ÉEM'' ÉEA T' '╕(0=µ,E)/2'                                               °
  526.   '''This is not a valid APL2 expression''' 'æ╜''*''' '╕(''?''⌠╞1╟æ)/2'        °
  527. X 'E' '╕2'                                                                     °
  528. *(1997 7 13 12 28 50 508)                                                      °
  529.  Fdoif ÉFX 'U╢╜V╢ doif W╢;t╢' 'Σ Rule' '╕(^/~U╢╜V╢)/0'                         °
  530. X '''U╢╜V╢ doif■ W╢'' ÉEA ''»V╢/W╢'''                                          °
  531. *(1997 9 9 12 50 14 444)                                                       °
  532.  Fendd ÉFX 'endd' 'Σ end of special feature' '20µ''²'' ╪ ╕(4<µÉLC)/0'          °
  533. X 'do'                                                                         °
  534. *(1997 8 15 12 26 13 364)                                                      °
  535.  Ferase ÉFX 'erase;t;EXIT;GO;HELP;DISPLAY;REVIEW;RULE;DISCLAIMER'              °
  536.   'Σ Erase all global functions and variables' 't╜ÉNL 3'                       °
  537.   't╜(~t^.εlc,'' '')≡t' 't╜ÉEX(~t[;∞5]^.=''TEACH'')≡t' 't╜ÉNL 2'               °
  538. X 't╜ÉEX(~t^.εlc,'' '')≡t'                                                     °
  539. *(1997 7 27 13 47 41 608)                                                      °
  540.  Fevaldd ÉFX 'u╜evaldd w;c;n' 'Σ Evaluate direct definition' 'u╜0'             °
  541.   'n╜(w∞''Σ'')-1' 'c╜(((n╞w)⌠'':'')Γn╞w),Γ''ΣDD '',(n+1)╟w'                    °
  542.   '╕((1 label╞c)doif ''''''Invalid label'''''')/0'                             °
  543.   '╕((2=µc)doif ''u╜showdd 1╙c'')/0'                                           °
  544.   '╕((3=ÉNC╞c)doif ''u╜⌡µÉ╜(╞c),'''' is already defined.'''''')/0'             °
  545.   '╕((3=µc)doif ''u╜simdd c'')/0' 'c╜(Γ''α∙ aw'')replace■c'                    °
  546.   'u╜ε''u╜'',((''a''εεc[2 3 4])/''a ''),(╞c),'' w;t;b'''                       °
  547.   'u╜u(5πc)(''b╜(t╜'',(3πc),'')/'',addquote ''u╜'',4πc)'                       °
  548. X 'u╜u,''╕(t doif b)/0''(''u╜'',2πc)' 'u╜╧ÉFX u'                               °
  549. *(1997 7 25 13 27 52 564)                                                      °
  550.  Fexit ÉFX 'V exit W;T' 'Σ Exit if too many suspended functions'               °
  551.   '╕(0⌠ÉNC ''V'')/L0 ╪ V╜10' 'L0:╕(V>µÉLC)/0'                                  °
  552.   '''There are too many suspended functions''' '''Please enter '',W'           °
  553. X '╕'                                                                          °
  554. *(1997 7 26 12 33 39 536)                                                      °
  555.  Fget ÉFX 'U╜V get W;t;T;ÉPR' 'Σ Prompt for response from keyboard'            °
  556.   'ÉPR╜T╜ÉAV[ÉIO+255] ╪ ╕(0⌠ÉNC ''V'')/L0 ╪ V╜1' 'L0:V╜V╧1' 'æ╜W ╪ t╜æ'        °
  557.   'U╜(+/^\t=T)╟t' '╕(''╕''⌠╞U)/L1 ╪ ╕' 'L1:╕V/0' 't╜(U⌠'' '')ΓU'               °
  558. X 'U╜(µt),(ΓU),t'                                                              °
  559. *(1997 7 28 13 33 8 424)                                                       °
  560.  Fglobals ÉFX 'globals' 'Σ Initialize useful global variables'                 °
  561.   'uc╜''ABCDEFGHIJKLMNOPQRSTUVWXYZ'''                                          °
  562.   'lc╜''abcdefghijklmnopqrstuvwxyz''' 'dig╜''1234567890'''                     °
  563. X 'r╜ÉAV[13+ÉIO]' 'q╜'''''''''                                                 °
  564. *(1997 7 3 12 47 6 368)                                                        °
  565.  Finitialize ÉFX 'initialize;T' 'Σ Initialize workspace'                       °
  566.   '''AT ALL TIMES, TO CONTINUE, PRESS RETURN!'',r'                             °
  567.   '''To see disclaimers enter:'',r,''    disclaimer''' 'do' 'erase'            °
  568.   'globals'                                                                    °
  569.   '''Make sure the CAP LOCK light on your keyboard (upper right) is ON!'       °
  570. X'' 'endd'                                                                     °
  571. *(1997 7 27 13 14 33 444)                                                      °
  572.  Flabel ÉFX 'u╜v label w'                                                      °
  573.   'Σ Return 1 if label w does not begin with a cap'                            °
  574.   '╕(0⌠ÉNC ''v'')/L0 ╪ v╜0' 'L0:v╜v╧1 ╪ w╜εw ╪ ╕v/L1 ╪ ╕(u╜0⌠ÉNC w)/0'         °
  575. X 'L1:╕(u╜~^/wεlc,uc,dig)/0' 'u╜w[1]εlc,dig'                                   °
  576. XClc 1 26 abcdefghijklmnopqrstuvwxyz                                           °
  577. *(1997 7 13 12 28 55 528)                                                      °
  578.  Fnon ÉFX 'non;T;RC;ET;R' 'Σ Ignore keyboard entry' 'æ╜''      ''' 'T╜æ'       °
  579.   '╕(0=µ(T⌠'' '')/T)/0' '(RC ET R)╜ÉEC T' '╕(0=RC)/2'                          °
  580. X '╕((1=RC)doif ''R'')/2' '╕2'                                                 °
  581. *(1997 7 13 12 28 55 528)                                                      °
  582.  Fnotb ÉFX 'u╜notb w' 'Σ Remove trailing blanks'                               °
  583.   '╕((1<╧w)doif ''u╜notb■ w'')/0' '╕((1<µµw)doif ''u╜πnotb Γ[2]w'')/0'         °
  584. X 'u╜(1-(,'' ''⌠Φw)∞1)╟w'                                                      °
  585. *(1997 7 27 12 55 6 496)                                                       °
  586.  Fproblems ÉFX 'problems' 'Σ Problems'                                         °
  587.   '''That is all for this lesson. Remember, if you want to practice,'''        °
  588.   '''and plan to use direct definitions, be sure to first enter GO.'''         °
  589.   '''Direct definitions will then be accepted. To exit GO, enter EXIT.''       °
  590.  ,r'                                                                           °
  591.   '''To erase a previously defined DIRECT DEFINITION FUNCTION, enter'',r       °
  592.  ' '''       )ERASE functionname'',r'                                          °
  593. X '''WARNING! do not use )ERASE on other labels.'',r'                          °
  594. XCq 0 '                                                                        °
  595. XCr 0                                                                         °
  596. *(1997 7 13 12 28 56 532)                                                      °
  597.  Freplace ÉFX 'u╜v replace u;i;r;s' 'Σ Replace elements in v in u'             °
  598.   'i╜Γ∞µu' 's╜2πv╜(v⌠'' '')Γv' 'i╜⌡r╜i⌡■Γ[1]u°.=╞v'                            °
  599. X 'u[(εi)/εr]╜s[(εi)/εi⌡■∞µs]'                                                 °
  600. *(1997 7 13 12 28 56 532)                                                      °
  601.  Fround ÉFX 'U╜V round W' 'Σ Half adjust to V th decimal'                      °
  602. X 'U╜(╛0.5+W⌡10*V)÷10*V'                                                       °
  603. *(1997 6 5 13 40 14 380)                                                       °
  604.  Frule ÉFX 'V rule W' 'Σ Additional remarks on rules'                          °
  605.   '╕(2=ÉNC ''V'')/L ╪ V╜0' 'L:╕(~(╞W)ε∞8)/LA ╪ V rulea╞W ╪ ╕L0'                °
  606.   'LA:╕(~(╞W)ε9 10 11)/LB ╪ V ruleb╞W ╪ ╕L0'                                   °
  607.   'LB:╕(~(╞W)ε11+∞8)/LC ╪ V rulec╞W ╪ ╕L0'                                     °
  608.   'LC:╕(~(╞W)ε19+∞10)/LD ╪ V ruled╞W ╪ ╕L0'                                    °
  609.   'LD:╕(30 31 32 33 34 35=╞W)/L30,L31,L32,L33,L34,L35'                         °
  610.   '''This rule number is undefined'' ╪ ╕' '╕(0=V)/L0' 'L30:╕(V>1)/L30X'        °
  611.   '''    RULE 30. The length of left argument to both TAKE and DROP must       °
  612.  '''                                                                           °
  613.   '''            equal the rank of the right argument. The exception: a'       °
  614.  ''                                                                            °
  615.   '''            scalar left argument can be applied to a right argument       °
  616.  ''' '''            vector.'',2µr' '╕(0=V)/L0'                                 °
  617.   'L30X:''A zero is permissible on both take and drop. A null vector is        °
  618.  not.''' '╕L0' 'L31:╕(V>1)/L31X'                                               °
  619.   '''   RULE 31. For TAKE and DROP with axis specification, every'''           °
  620.   '''            integer in the left argument must be matched with'''          °
  621.   '''            a valid axis in brackets. Axes may not be duplicated.''       °
  622.  '                                                                             °
  623.   '''            The length of the left argument may be less than the'''       °
  624.   '''            rank of the right argument with axis specification.'',2       °
  625.  µr' '╕(0=V)/L0' 'L31X:''Any axes not specified are left unchanged.'''         °
  626.   '╕L0' 'L32:╕(V>1)/L32X'                                                      °
  627.   '''   RULE 32. Monadic Take extracts the contents of the first scalar'       °
  628.  ''                                                                            °
  629.   '''            (rank 0 array) in an array, regardless of its rank.'''        °
  630.   '''            It is called FIRST.'',2µr' '╕(0=V)/L0'                        °
  631.   'L32X:''The FIRST of an empty array returns the prototype.''' '╕L0'          °
  632.   'L33:╕(V>1)/L33X'                                                            °
  633.   '''   RULE 33. The each operator can be placed to the right of a'''          °
  634.   '''            function, or to the right of an operator. When used,'''       °
  635.   '''            it applies the combined function separately to every'''       °
  636.   '''            element of the argument.'',2µr' '╕(0=V)/L0'                   °
  637.   'L33X:''This operator is so powerful that it is tempting to over-use i       °
  638.  t.'''                                                                         °
  639.   '''As you excercise your APL2 skills, try to solve problems without'''       °
  640.   '''the EACH operator as much as possible.''' '╕L0' 'L34:╕(V>1)/L34X'         °
  641.   '''   RULE 34. A rank 0 array, or another array can be catenated to an       °
  642.  '''                                                                           °
  643.   '''            array. When two arrays are catenated, the matching dime       °
  644.  nsion''' '''            of the two arrays must be the same.'',2µr'            °
  645.   '╕(0=V)/L0'                                                                  °
  646.   'L34X:''Catenation does not increase depth. The result will have the d       °
  647.  epth''' '''of the component of greatest depth.'',r'                           °
  648.   'show ''╧3 3µ∞9'' ''╧Γ∞5'' ''╧(3 3µ∞9),Γ∞5''' '╕L0' 'L35:╕(V>1)/L35X'        °
  649.   '''   RULE 35. Two arrays can be catenated if their rank differs by 1.       °
  650.  '''                                                                           °
  651.   '''            The shapes of dimensions not catenated MUST MATCH!'',2µ       °
  652.  r' '╕(0=V)/L0'                                                                °
  653.   'L35X:''Naturally, to catenate along other than the last dimension, an       °
  654.   axis''' '''specification can also be used here.''' 'L0:do'                   °
  655. X '╕(0=µW╜1╟W)/0' '╕L'                                                         °
  656. *(1997 6 1 12 42 53 524)                                                       °
  657.  Frulea ÉFX 'V rulea W' 'Σ Additional remarks on rules'                        °
  658.   '╕(2=ÉNC ''V'')/L ╪ V╜0' 'L:╕(W=∞8)/L1,L2,L3,L4,L5,L6,L7,L8'                 °
  659.   '''For rules not described in this lesson, see workspace INDEX'''            °
  660.   '╕0' 'L1:╕(V>1)/L1X'                                                         °
  661.   '''RULE 1. For arithmetic operations a vector must be matched with a''       °
  662.  ' '''        scalar, or another vector of the same length.'',2µr'             °
  663.   '╕(0=V)/0'                                                                   °
  664.   'L1X:''This is the first of many rules dealing with the concept of'''        °
  665.   '''CONFORMABILITY. This means that elements to be processed by APL2'''       °
  666.   '''must in some ways match.''' '╕0' 'L2:╕(V>1)/L1X'                          °
  667.   '''RULE 2. The reduction operator places the function, (specified to''       °
  668.  '                                                                             °
  669.   '''        its left), between all pairs of the vector. It then evaluat       °
  670.  es''' '''        the resulting expression.'',2µr' '╕(0=V)/0'                  °
  671.   'L2X:''There is more to this, but at this stage the rule is essentiall       °
  672.  y''' '''correct.''' '╕0' 'L3:╕(V>1)/L1X'                                      °
  673.   '''RULE 3. All APL2 expressions are evaluated from right to left'',2µr       °
  674.  ' '╕(0=V)/0'                                                                  °
  675.   'L3X:''This rule is valid in APL, which is the earlier version of APL2       °
  676.  .'''                                                                          °
  677.   '''For APL2, the rule has been restated in a totally different way.'''       °
  678.   '''However until we introduce some concepts that are new to APL2, the'       °
  679.  '' '''newer form reduces to RULE 3 as stated.''' '╕0' 'L4:╕(V>1)/L1X'         °
  680.   '''RULE 4. Vectors in APL2 can have lengths of zero and one.'',2µr'          °
  681.   '╕(0=V)/0'                                                                   °
  682.   'L4X:''This is the first concept that begins to introduce the idea tha       °
  683.  t no'''                                                                       °
  684.   '''matter what the APL expression, if it is valid, it must produce a''       °
  685.  '                                                                             °
  686.   '''valid APL2 object. (Shades of which came first, the chicken or the        °
  687.  egg)''' '╕0' 'L5:╕(V>1)/L1X'                                                  °
  688.   '''RULE 5. The shape of a variable is a vector. The shape of a vector'       °
  689.  '' '''        is a vector of length 1. The shape of a scalar is a'''          °
  690.   '''        vector of length zero.'',2µr' '╕(0=V)/0'                          °
  691.   'L5X:''The left argument of RESHAPE is by definition a vector. If APL2       °
  692.   is'''                                                                        °
  693.   '''to be internally consistent, the inverse operation to RESHAPE (whic       °
  694.  h''' '''is indeed SHAPE) MUST return the same type of object.''' '╕0'         °
  695.   'L6:╕(V>1)/L1X'                                                              °
  696.   '''RULE 6. Reduction of a scalar returns that scalar REGARDLESS of'''        °
  697.   '''        the function to the left of the reduction operator.'',2µr'        °
  698.   '╕(0=V)/0'                                                                   °
  699.   'L6X:''Reduction BY DEFINITION reduces the RANK by one. The exception        °
  700.  is'''                                                                         °
  701.   '''for objects whose rank is zero. Since there is no such thing as'''        °
  702.   '''negative rank, reduction is undefined for scalars, and therefore'''       °
  703.   '''the result is to leave the APL2 object unchanged.''' '╕0'                 °
  704.   'L7:╕(V>1)/L1X'                                                              °
  705.   '''RULE 7. The reduction of a null vector produces the identity'''           °
  706.   '''        element of the function.'',2µr' '╕(0=V)/0'                        °
  707.   'L7X:''A null vector may be empty, but it still has rank equal to one.       °
  708.  '''                                                                           °
  709.   '''Therefore its reduction MUST be a scalar. Since there is no data'''       °
  710.   '''in a null vector, the scalar must be such that it has no effect'''        °
  711.   '''on the operation performed by the function: Zero added to anything'       °
  712.  ''                                                                            °
  713.   '''has no effect in addition; one multiplied by anything has no effect       °
  714.  ''' '''in multiplication; and so on.''' '╕0' 'L8:╕(V>1)/L1X'                  °
  715.   '''RULE 8. Parentheses can (and should) be used to modify the right'''       °
  716.   '''        to left rule to improve efficiency'',2µr' '╕(0=V)/0'              °
  717.   'L8X:''Parentheses are used in APL2 for other purposes as well, but fo       °
  718.  r'''                                                                          °
  719.   '''now, we will use them just to modify the right to left rule (RULE 3       °
  720.  ).'''                                                                         °
  721.   '''If you place parentheses where they are not needed, APL2 will ignor       °
  722. Xe''' '''them.'''                                                              °
  723. *(1997 6 1 12 49 37 488)                                                       °
  724.  Fruleb ÉFX 'V ruleb W' 'Σ Additional remarks on rules'                        °
  725.   '╕(2=ÉNC ''V'')/L ╪ V╜0' 'L:╕(9 10 11=╞W)/L9,L10,L11 ╪ ╕0'                   °
  726.   'L9:╕(V>1)/L9X'                                                              °
  727.   '''   RULE 9: To produce a quote inside a character string, enter'''         °
  728.   '''           the quote twice.'',2µr' '╕(0=V)/0'                             °
  729.   'L9X:''This is used in most other programming languages.''' '╕0'             °
  730.   'L10:╕(V>1)/L10X'                                                            °
  731.   ''' RULE 10: In replication the left argument must contain only'''           °
  732.   '''          integers. The length of the left argument must be'''            °
  733.   '''          the same as the length of the right argument.'',2µr'            °
  734.   '╕(0=V)/0'                                                                   °
  735.   'L10X:''The left argument may also have negative integers. Only the nu       °
  736.  mber'''                                                                       °
  737.   '''of positive integers and zeros must add up to the length of the rig       °
  738.  ht'''                                                                         °
  739.   '''argument. Replicate with negative integers is not discussed here be       °
  740.  cause'''                                                                      °
  741.   '''the explanation requires concepts that have not yet been mentioned.       °
  742.  '',r' 'show ''1 1 2 ²1 0 1 1 1 ²1 1 0 1 1/''''CALIFORNIAN''''''' '╕0'         °
  743.   'L11:╕(V>1)/L11X'                                                            °
  744.   '''   RULE 11: The expression inside square brackets must return'''          °
  745.   '''            positive integers in the range of the length of'''            °
  746.   '''            the indexed vector. If the expression is MISSING,'''          °
  747.   '''            the result is as if the brackets were missing.'',2µr'         °
  748.   '╕(0=V)/0'                                                                   °
  749.   'L11X:''The expression in brackets need not be a vector. It could be a       °
  750.  n''' '''array as in the next example'',r'                                     °
  751. X 'show ''''''CALIFORNIA''''[3 3µ?9µ10]'' ''(∞4)[3 3µ∞4]'''                    °
  752. *(1997 6 2 12 11 17 260)                                                       °
  753.  Frulec ÉFX 'V rulec W' 'Σ Additional remarks on rules'                        °
  754.   '╕(2=ÉNC ''V'')/L ╪ V╜0'                                                     °
  755.   'L:╕((11+∞8)=╞W)/L12,L13,L14,L15,L16,L17,L18,L19' 'L12:╕(V>1)/L12X'          °
  756.   '''   RULE 12. A scalar function is one that will produce a result on'       °
  757.  ''                                                                            °
  758.   '''            every scalar element of a vector or array. EXAMPLES:'''       °
  759.   '''            + - ⌡ ÷ * are numeric scalar functions. , µ ∞ are NOT''       °
  760.  ' '''            scalar functions.'',r' '╕(0=V)/0'                            °
  761.   'L12X:''This distinction will become clearer when we study more genera       °
  762.  lized''' '''arrays.''' '╕0' 'L13:╕(V>1)/L13X'                                 °
  763.   '''   RULE 13. Scalars that work with vectors also work with arrays.''       °
  764.  ,r' '╕(0=V)/0'                                                                °
  765.   'L13X:''No problem with simple scalars, but this rule may need modific       °
  766.  ation'''                                                                      °
  767.   '''when we deal with "rank zero arrays" that are not simple scalars.''       °
  768.  ' '╕0' 'L14:╕(V>1)/L14X'                                                      °
  769.   '''   RULE 14. Arrays with the same shape can be processed with scalar       °
  770.  ''' '''functions.'',r' '╕(0=V)/0'                                             °
  771.   'L14X:''Arrays with distinct shapes can be processed as we shall see,        °
  772.  but'''                                                                        °
  773.   '''there will be restrictions, and we will use new operators.''' '╕0'        °
  774.   'L15:╕(V>1)/L15X'                                                            °
  775.   '''   RULE 15. The number of semicolons inside brackets must equal the       °
  776.  ''' '''            rank of the array MINUS 1.'',r' '╕(0=V)/0'                 °
  777.   'L15X:''There is no further generalization to this rule.''' '╕0'             °
  778.   'L16:╕(V>1)/L16X'                                                            °
  779.   '''   RULE 16. An axis specification can be a scalar, a vector or a'''       °
  780.   '''            null vector.'',r' '╕(0=V)/0'                                  °
  781.   'L16X:''Recall that null array is the ONLY bracket specification that'       °
  782.  ''                                                                            °
  783.   '''makes sense for a scalar. We will use that property when dealing wi       °
  784.  th''' '''rank 0 arrays.''' '╕0' 'L17:╕(V>1)/L17X'                             °
  785.   '''   RULE 17. An axis specification can be any array containing'''          °
  786.   '''            valid integers.'',r' '╕(0=V)/0'                               °
  787.   'L17X:''With this rule, you can generate an APL2 object of arbitrary''       °
  788.  ' '''rank.''' '╕0' 'L18:╕(V>1)/L18X'                                          °
  789.   '''   RULE 18. The shape of the result of axis specification is the'''       °
  790.   '''            catenation of the shapes of expressions inside brackets       °
  791.  .'''                                                                          °
  792.   '''            If the expression for an axis is missing, the shape for       °
  793.  ''' '''            that axis is unchanged.'',r' '╕(0=V)/0'                    °
  794.   'L18X:''This is merely the rule for implementation of rule 17.'''            °
  795.   '╕0' 'L19:╕(V>1)/L19X'                                                       °
  796.   '''   RULE 19. Simple reduction of arrays removes its last dimension.'       °
  797. X',r' '╕(0=V)/0' 'L19X:''This is a generalization of rule 2.''' '╕0'           °
  798. *(1997 6 3 12 4 29 284)                                                        °
  799.  Fruled ÉFX 'V ruled W' 'Σ Additional remarks on rules'                        °
  800.   '╕(2=ÉNC ''V'')/L ╪ V╜0'                                                     °
  801.   'L:╕(W=19+∞10)/L20,L21,L22,L23,L24,L25,L26,L27,L28,L29'                      °
  802.   '''This rule number is undefined'' ╪ ╕' 'L20:╕(V>1)/L20X'                    °
  803.   '''   RULE 20. The depth of an APL array is defined as the maximum'''        °
  804.   '''            depth to reach a simple scalar.'',2µr' '╕(0=V)/0'             °
  805.   'L20X:''The concept of depth provides the means of building complex da       °
  806.  ta'''                                                                         °
  807.   '''structures. This is the first of several rules dealing with depth.'       °
  808.  '' '╕0' 'L21:╕(V>1)/L21X'                                                     °
  809.   '''   RULE 21. No APL2 expression can generate a depth 1 object contai       °
  810.  ning'''                                                                       °
  811.   '''            ONLY a scalar. (Or, a scalar can not have depth 1.)'',2       °
  812.  µr' '╕(0=V)/0'                                                                °
  813.   'L21X:''This rule can be treated as an axiom of APL2. In theory it is'       °
  814.  ''                                                                            °
  815.   '''possible to enclose a scalar, but that would lead to a significantl       °
  816.  y'''                                                                          °
  817.   '''different language. EXAMPLE: The reduction of a vector must return'       °
  818.  ''                                                                            °
  819.   '''a scalar. Doing repeated reduction could produce enclosed scalars''       °
  820.  '                                                                             °
  821.   '''that would require removal of such depths before allowing compariso       °
  822.  ns.''' '╕0' 'L22:╕(V>1)/L22X'                                                 °
  823.   '''   RULE 22. The depth of an array is given by the maximum length of       °
  824.  '''                                                                           °
  825.   '''            the access vector associated with that array.'',2µr'          °
  826.   '╕(0=V)/0'                                                                   °
  827.   'L22X:''When you use function DISPLAY, depth can be obtained by counti       °
  828.  ng'''                                                                         °
  829.   '''the number of boxes you must cross from outside to reach the innerm       °
  830.  ost''' '''scalar.''' '╕0' 'L23:╕(V>1)/L23X'                                   °
  831.   '''   RULE 23. Null elements of an access vector must be included to''       °
  832.  ' '''            match corresponding rank zero arrays.'',2µr'                 °
  833.   '╕(0=V)/0'                                                                   °
  834.   'L23X:''The access vector works from left to right. The leftmost eleme       °
  835.  nt'''                                                                         °
  836.   '''removes the outermost box, and the rightmost element removes the'''       °
  837.   '''innermost box.''' '╕0' 'L24:╕(V>1)/L24X'                                  °
  838.   '''   RULE 24. The monadic disclose of a rank 0 array reveals the cont       °
  839.  ents''' '''            of that array.'',2µr' '╕(0=V)/0'                       °
  840.   'L24X:''This is a consequence of rule 21. A simple scalar is immune to       °
  841.  ''' '''to the process of enclosure or disclosure.''' '╕0'                     °
  842.   'L25:╕(V>1)/L25X'                                                            °
  843.   '''   RULE 25. The monadic disclose (without axis specification) reduc       °
  844.  es'''                                                                         °
  845.   '''            depth by one, by adding a new last axis to the disclose       °
  846.  d'''                                                                          °
  847.   '''            elements. FILL elements are used to complete the array.       °
  848.  '',2µr' '╕(0=V)/0'                                                            °
  849.   'L25X:''The fill element for numberic arrays is zero. The fill element       °
  850.   for'''                                                                       °
  851.   '''character arrays is a blank. The fill element for mixed arrays in''       °
  852.  ' '''APL2 will be discussed in later sessions.''' '╕0'                        °
  853.   'L26:╕(V>1)/L26X'                                                            °
  854.   '''   RULE 26. Simple disclose requires that all components of a neste       °
  855.  d'''                                                                          °
  856.   '''            array have the same rank (or be rank 0 arrays).'',2µr'        °
  857.   '╕(0=V)/0'                                                                   °
  858.   'L26X:''We use the phrase ''''simple disclose'''' because, as we will        °
  859.  learn'''                                                                      °
  860.   '''later, you can define your own rules on how to disclose nested'''         °
  861.   '''arrays.''' '╕0' 'L27:╕(V>1)/L27X'                                         °
  862.   '''   RULE 27. Forms can be equivalent only if all rank 0 arrays conta       °
  863.  in'''                                                                         °
  864.   '''            the same rank and shape (or rank 0 arrays)--recursively       °
  865.  --'',2µr' '╕(0=V)/0'                                                          °
  866.   'L27X:''Earlier we discussed functions that are dual. These are one to       °
  867.  '''                                                                           °
  868.   '''one transformations of data. Equivalent forms can be thought of as'       °
  869.  '' '''a kind of dual representation of data structures.''' '╕0'               °
  870.   'L28:╕(V>1)/L28X'                                                            °
  871.   '''   RULE 28. A zero in a partition vector will remove the associated       °
  872.  ''' '''            element.'',2µr' '╕(0=V)/0'                                 °
  873.   'L28X:''The components of a partition vector must be positive integers       °
  874.   or'''                                                                        °
  875.   '''zero. The presence of a zero is treated much the same as in boolean       °
  876.  ''' '''reduction.''' '╕0' 'L29:╕(V>1)/L29X'                                   °
  877.   '''   RULE 29. Each place in the partition vector, where the value'''        °
  878.   '''            INCREASES marks a partition.'',2µr' '╕(0=V)/0'                °
  879.   'L29X:''A partition must ocurr BETWEEN two consecutive elements. These       °
  880.  ''' '''need not be simple scalars'',r'                                        °
  881. X 'show ''DISPLAY (1 1 2 2)Γ(1 2) ''''AB'''' (3 4) ''''C''''''' '╕0'           °
  882. *(1997 7 13 12 28 57 536)                                                      °
  883.  Fshow ÉFX '╢V show ╢W;╢T;╢B' 'Σ Display and execute ╢W'                       °
  884.   '╢T╜(0=ÉNC ''╢V'')doif ''╢V╜0'''                                             °
  885.   '╕((0=╧╢W)doif ''show ╢W,'''' '''''')/0'                                     °
  886.   '╕((1<╧╢W)doif ''╢V show ■╢W'')/0' '''      '',╢W'                           °
  887. X '╕((╢V^'':''ε╢W)doif ''╢T╜evaldd ╢W'')/L0' '''ÉEM'' ÉEA ╢W' 'L0:do'          °
  888. *(1997 7 13 12 28 57 536)                                                      °
  889.  Fshowdd ÉFX 'u╜showdd w;a;b;c;r'                                              °
  890.   'Σ Display a direct definition function'                                     °
  891.   '╕((1=╧w)doif ''u╜showdd Γw'')/u╜0'                                          °
  892.   '╕((3⌠ÉNC╞w)doif ''(ε╞w),'''' is not a function'''''')/0'                    °
  893.   'c╜Γ[2]ÉCR╞w' 'c╜notb(2╞c),(Γ''aw α∙'')replace■2╟c'                          °
  894.   '╕((~''ΣDD''╧3╞2πc)doif ''''''Not a direct definition function'''''')/       °
  895.  0' 'u╜1' 'b╜('' ''⌠╞c)Γ╞c' 'a╜''      ''' 'r╜2╟3πc'                           °
  896.   '╕((3=µc)doif ''a,(╞w),'''':'''',r,(3<µ2πc)/''''   Σ'''',3╟2πc'')/0'         °
  897.   'a╜a,(╞w),'':'',(2╟5πc),'':''' 'b╜(+\r=''('')-+\r='')''' 'b╜b∞0'             °
  898. X 'a╜a,(²3╟(b-1)╞3╟r),'':'',2╟»(b+2)╟r' 'a,(3<µ2πc)/''  Σ'',3╟2πc'             °
  899. *(1997 7 13 12 28 57 536)                                                      °
  900.  Fshowfn ÉFX 'U╜V showfn W;F;N;T;ÉIO' 'Σ Simulate ╖W[É]'                       °
  901.   'T╜(0=ÉNC ''V'')doif ''V╜0''' 'ÉIO╜0'                                        °
  902.   'U╜r,''      '',''╖'',W,''[É]'',(╞V)╞''╖''' 'N╜1╞µF╜ÉCR W' 'N╜«∞N'           °
  903.   'N╜(N⌠'' '')ΓN' 'F╜(π''['',■N,■Γ''] ''),F'                                   °
  904.   'T╜(1<µ,V)doif ''F╜F[1╟V;]'' ''U╜''''''''''' 'U╜²1╟U,r,,F,r'                 °
  905. X 'U╜((-+/^\'' ''=ΦU)╟U),('' ╖'')[╞V],r'                                       °
  906. *(1997 7 13 12 28 58 540)                                                      °
  907.  Fsimdd ÉFX 'u╜simdd w;e' 'Σ Direct definition mode' 'u╜0'                     °
  908.   '╕((0⌠ÉNC╞w)doif ''''''Already defined'''''')/0' 'e╜''α''ε2πw'               °
  909.   'w[2]╜Γ''u╜'',''α∙ aw'' replace 2πw' 'w╜w[1 3 2]'                            °
  910. X 'w[1]╜Γε''u╜'',(e/''a ''),w[1],'' w''' 'u╜╧ÉFX w'                            °
  911. *(1992 6 3 9 59 17 424)                                                        °
  912.  Ftab ÉFX 'U╜V tab W;T;A;B;C;D;E;F;G;M;ÉPW' 'Σ Tabulate list W'                °
  913.   'T╜(0=ÉNC ''V'')doif ''V╜0''' 'M╜''Invalid data for tabulation'''            °
  914.   'V╜4╞V' 'ÉPW╜130╛30⌐G╜V[2]+79⌡V[2]=0'                                        °
  915.   'L1:╕((1<╧W)doif ''''''W╜∞0'''' ÉEA ''''W╜πW'''''')/L1'                      °
  916.   '╕(((0=µεW)δ2<µµW)doif ''U╜(~V╧4╞0)/M'')/0'                                  °
  917.   'T╜(1≥µµU╜«W)doif ''U╜πW╜(U⌠'''' '''')ΓU'''                                  °
  918.   'T╜(0<V[1])doif ''U╜(«(Φ1,╞µW)µ(V[3]µ'''' ''''),∞(╞µW)-V[3]),'''' ''''       °
  919.  ,U''' '╕(G<30)/0' 'T╜(F╜µεV[4])+C╜1╟B╜µA╜(V[3],0)╟U'                          °
  920.   'T╜⌐(1╞B)÷1⌐╛(ÉPW+F)÷T' 'U╜(E╜(V[3],C)╞U),[1](B╜T,1╟B)╞A'                    °
  921.   '''D╜εV[4]'' ÉEA ''D╜ÉAV[εV[4]+33⌡V[4]=0]''' 'L0:A╜(T,0)╟A'                  °
  922. X '╕(0=1╞µA)/0' 'U╜U,(((T+V[3]),µD)µD),E,[1]B╞A' '╕L0'                         °
  923. *(1997 7 13 12 28 59 544)                                                      °
  924.  Ftest ÉFX 'U╜V test W;P'                                                      °
  925.   'Σ Describe problem in W, (correct answer in V)' 'U╜2' 'L1:W'                °
  926.   'É╜''      ''' 'P╜æ' '''╕L0'' ÉEA ''P╜»P''' '╕(V╧P)/0'                       °
  927. X 'L0:╕(0=U╜U-1)/0' '''Incorrect. Try again''' '╕L1'                           °
  928. XCuc 1 26 ABCDEFGHIJKLMNOPQRSTUVWXYZ                                           °
  929. *(1996 4 6 16 3 43 352)                                                        °
  930.  Fvec ÉFX 'U╜vec' 'Σ Draw 2d vector in plane'                                  °
  931.   'U╜r,r,''2-        +'',r '':      °'',r,''1-    °'',r'                       °
  932. X 'U╜U,'' :  °'',r,''0|....|....|'',r,'' 0    1    2'',r'                      °
  933.