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

  1. XNÉIO 0 1                                                                      °
  2. XNÉCT 0 1E²13                                                                  °
  3. XCÉFC 1 6 .,*0_²                                                               °
  4. XNÉRL 0 784558821                                                              °
  5. XCÉPR 1 1                                                                      °
  6. XCÉLX 1 5 TEACH                                                                °
  7. XCA 2 2 26 abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ                °
  8. XNARRAY 3 4 1 2 2 1 4 2 4 4 5 2                                                °
  9. *(1996 4 6 16 4 50 384)                                                        °
  10.  FBIND ÉFX 'BIND' 'Σ Binding rules of APL2'                                    °
  11.   '''  1. Brackets bind to the left'''                                         °
  12.   '''  2. Left arrow binds to the left'''                                      °
  13.   '''  3. Dyadic operator binds to the right'''                                °
  14.   '''  4. Strand notation binding'''                                           °
  15.   '''  5. Operator binds to its left'''                                        °
  16.   '''  6. Function binds to its left'''                                        °
  17.   '''  7. Function binds to its right'''                                       °
  18. X '''  8. Left arrow binds to its right'',r'                                   °
  19. XAD╜('ONE')('TWO')((1µ1)(1 2)(1 2 3))(2)                                       °
  20. *(1997 9 14 12 30 44 504)                                                      °
  21. XFDISCLAIMER ÉFX 'DISCLAIMER' 'Σ Copyright statement' 'disclaimer'             °
  22. *(1996 4 6 16 4 15 244)                                                        °
  23.  FDISPLAY ÉFX 'D╜S DISPLAY A;ÉIO;R;C;HL;HC;HT;HB;VL;VB;V;W;N;B'                °
  24.   'Σ DISPLAY A GENERAL ARRAY IN PICTORIAL FORM'                                °
  25.   'Σ  NORMAL CALL IS MONADIC.  DYADIC CALL USED ONLY IN'                       °
  26.   'Σ    RECURSION TO SPECIFY DISPLAY RANK, SHAPE, AND DEPTH.' 'ÉIO╜0'          °
  27.   '»(0=ÉNC ''S'')/''S╜µA''' 'R╜╞µ,S                   Σ PSEUDO RANK.'          °
  28.   'C╜''┐┌└┘''                 Σ UR, UL, LL, AND LR CORNERS.'                   °
  29.   'HL╜''─''                   Σ HORIZONTAL LINE.'                              °
  30.   'HC╜HL,''Θ╕'',HL,''~+ε''      Σ HORIZONTAL BORDERS.'                         °
  31.   'HT╜HC[(0<R)⌡1+0<╞²1╞,S]' 'ΣW╜,0╧■╞0µΓ(1⌐µA)╞A'                              °
  32.   'HB╜HC[3+3╛(''2⌡~A╧«A'' ÉEA ''1+╞ε0⌡(1⌐⌡/µA)╞,A'')+3⌡1<µµS]'                 °
  33.   'VL╜''│''                   Σ VERTICAL LINE.'                                °
  34.   'VB╜VL,''Φ╟''               Σ VERTICAL BORDER.'                              °
  35.   'V╜VB[(1<R)⌡1+0<²1╞²1╟,S]'                                                   °
  36.   '»(0εµA)/''A╜(1⌐µA)µΓ╞A''   Σ SHOW PROTOTYPE OF EMPTIES.'                    °
  37.   '╕(1<╧A)/GEN' '╕(2<µµA)/D3'                                                  °
  38.   'D╜«A                     Σ SIMPLE ARRAYS.' 'W╜1╞µD╜(²2╞1 1,µD)µD'           °
  39.   'N╜²1+1╟µD' '╕(0=µµA)/SS'                                                    °
  40.   'D╜(C[1],V,((W-1)µVL),C[2]),((HT,NµHL),[0]D,[0]HB,NµHL),C[0],(WµVL),C[       °
  41.  3]' '╕0' 'SS:HB╜((0 '' '')=╞0µΓA)/'' -'''                                     °
  42.   'D╜'' '',('' '',[0]D,[0]HB,Nµ'' ''),'' ''' '╕0'                              °
  43.   'GEN:D╜«DISPLAY■A          Σ ENCLOSED ...' 'N╜Dδ.⌠'' '''                     °
  44.   'D╜(Nδ~1ΦN)≡D' 'D╜(δ≡~''  ''╤D)/D' 'D╜((1,µS)µS)DISPLAY D'                   °
  45.   '╕(2≥µ,S)╟D3E,0' 'D3:D╜0 ²1╟0 1╟«ΓA         Σ MULT-DIMENSIONAL ...'          °
  46.   'W╜1╞µD' 'N╜²1+1╟µD'                                                         °
  47.   'D╜(C[1],V,((W-1)µVL),C[2]),((HT,NµHL),[0]D,[0]HB,NµHL),C[0],(WµVL),C[       °
  48.  3]' 'D3E:N╜²2+µ,S'                                                            °
  49. X 'V╜C[Nµ1],[0]VB[1+0<²2╟,S],[0](((²3+╞µD),N)µVL),[0]C[Nµ2]' 'D╜V,D'           °
  50. *(1996 4 6 16 4 15 244)                                                        °
  51.  FEXIT ÉFX 'EXIT' 'Σ Exit from function' '''To log off type:   )OFF'''         °
  52. X '╕'                                                                          °
  53. *(1996 4 6 16 4 15 244)                                                        °
  54.  FGO ÉFX 'GO;T;E;B' 'Σ Expression driver' 'L0:B╜E╜''''' 'æ╜''      '''         °
  55.   'T╜æ' '╕(^/'' ''=T)/L0' '╕((^/'')OFF ''=5╞6╟T)doif ''EXIT'')/0'              °
  56.   '╕(('':''εT)doif ''B╜evaldd (+/^\'''' ''''=T)╟T'')/L0'                       °
  57.   '''E╜ÉEM'' ÉEA T' '╕(0=µ,E)/L0' '╕B/L0'                                      °
  58.   '''This is not a valid APL2 expression''' 'æ╜''*'''                          °
  59. X '╕(''?''⌠╞1╟æ)/L0' 'E' '╕L0'                                                 °
  60. *(1997 8 15 12 55 31 552)                                                      °
  61.  FHELP ÉFX 'HELP;N;I;T' 'Σ Help to student' '''WHAT TO DO'',r'                 °
  62.   '''  ° To get out of the lesson''' '''       ENTER: EXIT'''                  °
  63.   '''  ° To log off APL2'''                                                    °
  64.   '''       FIRST, ENTER: EXIT  THEN ENTER: )OFF'''                            °
  65.   '''  ° To get help''' '''       ENTER: HELP'''                               °
  66.   '''  ° When you see the prompt on a blank line'''                            °
  67.   '''       ENTER AN APL2 EXPRESSION - OR JUST PRESS: ENTER''' 'do'            °
  68.   '''  ° If you get this line'',r'                                             °
  69.   '''This is not a valid APL2 expression'',r,''*'',r'                          °
  70.   '''        YOU CAN EITHER''' '''           A. PRESS: ENTER'''                °
  71.   '''           B. PRESS: ? and then ENTER to see what was incorrect'''        °
  72.   '''              in your expression causing that response'',r' 'do'          °
  73.   '''HINTS'',r'                                                                °
  74.   '''This lesson is made up of '',(«N╜6),'' components named TEACHx, whe       °
  75.  re''' '''the x stands for a digit:'',r' 'I╜0'                                 °
  76.   'L0:T╜''TEACH'',(«I╜I+1)' 'T,'' '',1╟notb(ÉCR T)[2;]' '╕(N>I)/L0'            °
  77.   'do'                                                                         °
  78.   '''You may review either of these components separately. To do that,''       °
  79.  '                                                                             °
  80.   '''first enter EXIT (and RETURN), then enter the name of the lesson.''       °
  81.  ' '''component (e.g. TEACH4).'',r'                                            °
  82.   '''To re-start the lesson, just enter TEACH'',r'                             °
  83.   '''When the screen fills up, it is a good idea to move the cursor to''       °
  84.  ' '''the start of a convenient paragraph, and press ENTER'',r'                °
  85.   '''You may also wish to press PAGE UP to review the prevous pages.'''        °
  86.   'do' '''RESOURCES'',r'                                                       °
  87.   '''You may also enter ONE of the following words at a time'',r'              °
  88. X '''BIND   To display the APL2 binding rules''' '''''' 'endd'                 °
  89. XCSEQUENCE 1 20 aAbBcCdDeEfFgGhHiIjJ                                           °
  90. *(1997 7 4 12 0 33 292)                                                        °
  91.  FTEACH ÉFX 'TEACH' 'Σ Start lesson 9; APL2 by Zdenek V JIZBA'                 °
  92.   'exit ''TEACH''' 'initialize' 'TEACH1 Σ Binding rules'                       °
  93.   'TEACH2 Σ Examples using binding rules'                                      °
  94.   'TEACH3 Σ Grade up and grade down'                                           °
  95.   'TEACH4 Σ Atomic vector; its usage in grade functions'                       °
  96.   'TEACH5 Σ Terminal control; atomic function'                                 °
  97. X 'TEACH6 Σ System commands' 'problems'                                        °
  98. *(1997 6 13 12 53 17 472)                                                      °
  99.  FTEACH1 ÉFX 'TEACH1' 'Σ Theory of APL2, Binding rules'                        °
  100.   'exit ''TEACH1'''                                                            °
  101.   '''The previous 8 lessons have covered many, but not all of the'''           °
  102.   '''elements of APL2. It is appropriate at this point to review some'''       °
  103.   '''of the theoretical foundations of the language.''' 'do'                   °
  104.   '''The original APL was designed as a compact notation to be used'''         °
  105.   '''by people to describe algorithms. The initial emphasis was mainly''       °
  106.  '                                                                             °
  107.   '''that of a mathematical-like notation. The objects that the language       °
  108.  '''                                                                           °
  109.   '''supported were to a large extent the types of constructs that are''       °
  110.  ' '''used in mathematics.'',r'                                                °
  111.   '''As the language evolved, the scope of applications expanded to'''         °
  112.   '''eventually cover many fields in Computer Science. This growth'''          °
  113.   '''resulted in ever increasing pressures to add new features to the'''       °
  114.   '''language. Fortunately, those who controlled these developments mana       °
  115.  ged'''                                                                        °
  116.   '''to resist the temptation to add on haphazardly. Instead growth was'       °
  117.  ''                                                                            °
  118.   '''contained in a strict theoretical boundary. Any changes had to stay       °
  119.  '''                                                                           °
  120.   '''within a consistent logical framework. To the extent that the initi       °
  121.  al'''                                                                         °
  122.   '''architecture proved inadequate, new, more general but still rigorou       °
  123.  s'''                                                                          °
  124.   '''foundations were laid. With very few exceptions, these changes kept       °
  125.  ''' '''earlier versions ''''upward compatible''''.''' 'do'                    °
  126.   '''APL2 is the most recent and also the most powerful implementation''       °
  127.  '                                                                             °
  128.   '''of the language. As we describe its structure, syntax and semantics       °
  129.  ,'''                                                                          °
  130.   '''we will also contrast the current features with some of the early''       °
  131.  ' '''approaches.''' 'do'                                                      °
  132.   '''APL2 is a computer language that supports three types of objects:''       °
  133.  ,r' ''' 1 DATA'',r,'' 2 FUNCTIONS'',r,'' 3 OPERATORS'',r'                     °
  134.   '''In addition, there are special symbols for control of syntax.'''          °
  135.   'do'                                                                         °
  136.   '''Data can be entered from the keyboard, can be generated by function       °
  137.  s'''                                                                          °
  138.   '''or can be read from files. There are two types of primitive data ty       °
  139.  pes:'''                                                                       °
  140.   '''NUMBERS and CHARACTERS. APL does not make distinctions between "int       °
  141.  egers",'''                                                                    °
  142.   '''"reals" and "complex" numbers. The APL2 processor recognizes these        °
  143.  numeric''' '''types and deals with them apropriately.'',r'                    °
  144.   '''Data can be stored in VARIABLES. The general name for data is ARRAY       °
  145.  .'''                                                                          °
  146.   '''The contents of data is a collection of items. DATA have three'''         °
  147.   '''important properties:'',r,r,'' SHAPE'',r,'' RANK'',r,'' TYPE'',r'         °
  148.   '''SHAPE describes the organization of data as a rectangular object.''       °
  149.  '                                                                             °
  150.   '''RANK gives the number of dimensions of the orthogonal collection.''       °
  151.  '                                                                             °
  152.   '''TYPE describes the contents of the array. Type includes numeric,'''       °
  153.   '''character or mixed. Finally the elements of an array can be arrays.       °
  154.  '''                                                                           °
  155.   '''When the elements of an array are not SIMPLE SCALARS, the arays are       °
  156.  ''' '''said to be NESTED.'',r'                                                °
  157.   '''Special names are given to arrays of rank zero and one. Arrays of r       °
  158.  ank'''                                                                        °
  159.   '''zero are called RANK 0 ARRAYS, but for brevity they may be also cal       °
  160.  led''' '''SCALARS. Arrays of rank ONE are called VECTORS.''' 'do'             °
  161.   '''There are two types of functions: primitive and user defined. Funct       °
  162.  ions'''                                                                       °
  163.   '''generally operate on data to produce transformed data. (Graphics an       °
  164.  d'''                                                                          °
  165.   '''communications with "external" files will be discussed in lessons''       °
  166.  '                                                                             °
  167.   '''dealing with "shared variables" and "associated processors".)'',r'        °
  168.   '''An APL2 expression is a sequence of APL2 characters that satisfies        °
  169.  the'''                                                                        °
  170.   '''syntax and semantics of the APL2 language. As part of this syntax,        °
  171.  APL2'''                                                                       °
  172.   '''also supports objects called OPERATORS. An Operator is a symbol or        °
  173.  label'''                                                                      °
  174.   '''that modifies the manner in which a function (or another operator)'       °
  175.  ''                                                                            °
  176.   '''is to be evaluated. Finally, there are special symbols that are use       °
  177.  d'''                                                                          °
  178.   '''to provide the needed flexibility in writing APL2 expressions.'''         °
  179.   'do'                                                                         °
  180.   '''The early versions of APL followed a simple  left to right rule for       °
  181.   the'''                                                                       °
  182.   '''execution of an expression. Although this rule is still valid, it i       °
  183.  s'''                                                                          °
  184.   '''only as a general principle. In detail, the sequence of evaluation        °
  185.  is'''                                                                         °
  186.   '''controlled by a set of rules dealing with the concept of BINDING.''       °
  187.  ,r'                                                                           °
  188.   '''In the following listing of these binding rules, those on top take'       °
  189.  ''                                                                            °
  190.   '''take precedence over those below. (Note that for rule 3, marked wit       °
  191.  h an''' '''*, we have yet to study an example.)'',r'                          °
  192.   ''' 1. Square brackets are bound to the left'''                              °
  193.   ''' 2. Binding of assignment arrow to its left expression'''                 °
  194.   '''*3. An operator is bound to its right operand'''                          °
  195.   ''' 4. Vector binding (includes strand notation of variables)'''             °
  196.   ''' 5. Binding of operator to its left operand'''                            °
  197.   ''' 6. Binding of function to its left argument'''                           °
  198.   ''' 7. Binding of function to its right argument'''                          °
  199.   ''' 8. Binding of assignment symbol to its right''' 'do'                     °
  200.   '''Binding rule 1 differs in APL2 from APL. In APL the expression'',r'       °
  201.   '''      2 3 4[2]'',r'                                                       °
  202.   '''returned 3. In APL2 this expression is no longer valid, because'''        °
  203.   '''by rule 1 the [2] binds strictly to 4. Since a scalar integer canno       °
  204.  t'''                                                                          °
  205.   '''be indexed, the expression will in APL2 generate an error message.'       °
  206.  '' 'do'                                                                       °
  207.   '''In previous lessons we used provisional rules as an aid in helping        °
  208.  you'''                                                                        °
  209.   '''remember how APL2 behaves given specific expressions. In this and i       °
  210.  n'''                                                                          °
  211.   '''subsequent lessons, these rules will no longer be available. In the       °
  212.  ir'''                                                                         °
  213.   '''place, you can enter BIND to get a listing of the binding rules. Al       °
  214.  so,'''                                                                        °
  215.   '''if you no longer remember how a specific function (symbol) works, y       °
  216.  ou'''                                                                         °
  217.   '''should try it out. Trial and error is an excellent teacher.'''            °
  218. X 'endd'                                                                       °
  219. *(1997 6 9 12 41 32 468)                                                       °
  220.  FTEACH2 ÉFX 'TEACH2;A;B;C'                                                    °
  221.   'Σ Application of binding rules to specific expressions; references'         °
  222.   'exit ''TEACH2'''                                                            °
  223.   '''Here are some other examples of the application of binding rules'',       °
  224.  r' 'show ''(2 3 4)[2]'''                                                      °
  225.   '''The use of parentheses modifies the scope of rule 1.'',r' 'do'            °
  226.   'show ''+/3 4 5'''                                                           °
  227.   '''By rule 4 the vector 3 4 5 is treated as a single entity. Then by''       °
  228.  '                                                                             °
  229.   '''rule 5, the operator / is bound to the left function (+). The resul       °
  230.  ting''' '''compound function +/ is then applied to the vector.''' 'do'        °
  231.   'show ''2,5++/3 4 5'''                                                       °
  232.   '''By rule 6 the left + is bound to the 5 only, and by rule 7 the'''         °
  233.   '''subexpression 5+ is applied to the result of +/3 4 5.''' 'do'             °
  234.   '(A B)╜''ONE'' ''TWO''' 'show ''A'' ''B'' ''DISPLAY A B C╜∞■∞3'''            °
  235.   '''The Each operator has only a left operand (rule 3 does not apply he       °
  236.  re).'''                                                                       °
  237.   '''The Each operator binds to the left, so that the compound function        °
  238.  ∞■ is'''                                                                      °
  239.   '''applied to the result of ∞3. The assignment arrow binds by rule 2 t       °
  240.  o the'''                                                                      °
  241.   '''expression to the right. Strand notation of variables has a binding       °
  242.  '''                                                                           °
  243.   '''below 2, so the assignment of the expression to the left goes to C.       °
  244.  ''' 'do' 'show ''DISPLAY 3╞A D╜A B C,2'''                                     °
  245.   '''By rule 2 the assignment arrow is bound to the label D. Then by rul       °
  246.  e'''                                                                          °
  247.   '''4 (from right to left) the strands A B C and A D are bound together       °
  248.  .'''                                                                          °
  249.   '''The array A B C is then bound to , and 3 is bound to ╞ by rule 6. T       °
  250.  hen'''                                                                        °
  251.   '''by rule 7, the scalar 2 is catenated to array A B C, and A D is bou       °
  252.  nd''' '''to 3╞. Finally by rule 8, A B C,2 is bound to D''' 'do'              °
  253.   'show ''(A B C)╜∞■∞3'' ''DISPLAY A B C'''                                    °
  254.   '''The parentheses are used to combine A B and C in strand notation.''       °
  255.  '                                                                             °
  256.   '''The assignment of the three element (nested) vector ∞■∞3 is therefo       °
  257.  re''' '''distributed among these three objects.''' 'do'                       °
  258.   'show ''2+/[1]3 3µ∞9'''                                                      °
  259.   '''By rule 1, [1] is bound to the reduction operator. By rule 4, the''       °
  260.  '                                                                             °
  261.   '''vector 3 3 is bound next. Then by rule 5 the + is bound to /[1].'''       °
  262.   '''The compound function +/[1] is applied to the left argument 2, and'       °
  263.  '' '''to the right argument 3 3µ∞9.''' 'do'                                   °
  264.   'show ''∞µ''''ONE'''' 2 3'''                                                 °
  265.   '''By rule 4 the elements ''''ONE'''' 2 3 are bound together as a vect       °
  266.  or.'''                                                                        °
  267.   '''the monadic function µ is then applied to this vector, producing'''       °
  268.   '''a vector of length 1. The monadic function ∞ can be applied only to       °
  269.  '''                                                                           °
  270.   '''a positive scalar integer (or zero). APL2 allows one exception to''       °
  271.  '                                                                             °
  272.   '''this rule, namely a one element vector containing a positive intege       °
  273.  r''' '''(or zero).''' 'do'                                                    °
  274.   '''The following expression is not valid!'',r'                               °
  275.   'show ''∞■µ■''''ONE'''' 2 3'''                                               °
  276.   '''The vector obtained from µ■''''ONE'''' 2 3 includes two null vector       °
  277.  s, since'''                                                                   °
  278.   '''the shape of a simple scalar is a null vector. The monadic ∞ does n       °
  279.  ot''' '''accept a null vector as a right argument.''' 'do'                    °
  280.   '''For a more detailed discussion of the principles of APL2, you can''       °
  281.  ' '''order the following FREE publication from IBM:'',r'                      °
  282.   '''The Principles of APL2, by Dr. James A. Brown TECHNICAL REPORT'''         °
  283.   '''03.247 (March 1984).'',r'                                                 °
  284.   '''For a copy, write to:'',''  APL Products'',r,''IBM Santa Teresa, M4       °
  285.  6/D12''' '''P. O. Box 49023'',r,''San Jose, CA 95161-9023''' 'do'             °
  286.   '''For the theory of Nested Arrays, empty Arrays, and Prototypes, see:       °
  287.  '',r'                                                                         °
  288.   '''The Nested Rectangular Array as a Model of Data, by Trenchard Moore       °
  289.  '''                                                                           °
  290.   '''APL79 Conference Proceedings (APL QUOTE QUAD v. 9 No. 4 June 1979''       °
  291. X' '''pp. 55-73).''' 'endd'                                                    °
  292. *(1997 8 29 13 22 37 504)                                                      °
  293.  FTEACH3 ÉFX 'TEACH3;A;B;C;D'                                                  °
  294.   'Σ New primitives; Grade up and Grade down'                                  °
  295.   '''We now proceed to study additional APL2 primitive functions.'''           °
  296.   'exit ''TEACH3''' 'do'                                                       °
  297.   '''Many of the APL2 primitives studied so far are supported by other''       °
  298.  '                                                                             °
  299.   '''programming languages. It is a valid question to ask, what criteria       °
  300.  '''                                                                           °
  301.   '''does one seek in deciding what should become part of the language,'       °
  302.  ''                                                                            °
  303.   '''and what should be left to be defined by the user of that language.       °
  304.  '',r'                                                                         °
  305.   '''The APL2 policy has to my knowledge not been explicitly stated, but       °
  306.  '''                                                                           °
  307.   '''from the availability of existing primitive functions, these must''       °
  308.  ' '''satisfy at least the following two criteria:'',r'                        °
  309.   '''  1. A function must be either well known and in common use by the'       °
  310.  ''                                                                            °
  311.   '''     computer user community, or be clearly powerful enough to'''         °
  312.   '''     attract potential users, when it becomes available.'''               °
  313.   '''  2. A primitive function should solve a class of problems in a'''        °
  314.   '''     general but optimal way. The algorithm may be such that many''       °
  315.  '                                                                             °
  316.   '''     potential users would normally find it inconvenient, if not'''       °
  317.   '''     difficult to develop on their own.''' 'do'                           °
  318.   '''The primitive function described next is a good example of such'''        °
  319.   '''a function. It is called GRADE, and it has two versions. There is''       °
  320.  '                                                                             °
  321.   '''GRADE UP (√), and GRADE DOWN (ⁿ). Both versions when applied to'''        °
  322.   '''arrays will produce an integer vector. This vector, when inserted''       °
  323.  '                                                                             °
  324.   '''in bracket indexing, will produce the array in sorted sequence.'''        °
  325.   '''For grade up, the sequence will be increasing, and for grade down''       °
  326.  ' '''the sequence will be decreasing.''' 'do'                                 °
  327.   '''The grade function is TYPE sensitive. The monadic version works'''        °
  328.   '''only on numeric arrays, and the dyadic version works only on'''           °
  329.   '''character arrays. Mixed arrays cannot be sorted with either version       °
  330.  ''' '''of this primitive function.'',r'                                       °
  331.   '''Let us first study the monadic version of grade'',r'                      °
  332.   'show ''VECTOR╜?10µ50'' ''VECTOR'' ''B╜√VECTOR'' ''B'' ''VECTOR[B]'''        °
  333.   '''The grade up function generates a vector of integers from 1 to µVEC       °
  334.  TOR.'''                                                                       °
  335.   '''The numeric values of these integers point to the elements in the''       °
  336.  '                                                                             °
  337.   '''original vector that will produce the sequence in an increasing ord       °
  338.  er.''' 'do' 'show ''B[√B]'''                                                  °
  339.   '''The grade vector when sorted, reproduces the original sort. Note th       °
  340.  at''' '''this is NOT the same as'',r' 'show ''VECTOR[√√VECTOR]'''             °
  341.   'show ''VECTOR[ⁿVECTOR]'' ''VECTOR[ΦB]'''                                    °
  342.   '''Grade down is equivalent to reversing the grade up vector.'''             °
  343.   '''To study how sort works when the vector contains repeated values,''       °
  344.  ' '''consider the following expressions'',r'                                  °
  345.   'show ''VECTOR╜2/VECTOR'' ''VECTOR'' ''SEQUENCE╜''''aAbBcCdDeEfFgGhHiI       °
  346.  jJ''''''' 'show ''SEQUENCE[√VECTOR]'''                                        °
  347.   '''We have replicated VECTOR, and then applied the sort function to'''       °
  348.   '''the alphabetic string SEQUENCE. The paired duplicate values occur''       °
  349.  ' '''in their original sequence.''' 'do'                                      °
  350.   '''The grade function will work on the first dimension of an array of        °
  351.  rank''' '''two or greater'',r'                                                °
  352.   'show ''ARRAY╜?7 3µ50'' ''ARRAY[3 5 7;1]╜ARRAY[1;1]'''                       °
  353.   '''We have set the odd row numbers of column 1 to the same number, so'       °
  354.  '' '''that we can see how the sort will work'',r'                             °
  355.   'show ''ARRAY'' ''ARRAY[√ARRAY;]'''                                          °
  356.   '''Notice that for the same row numbers in the first column, it is the       °
  357.  '''                                                                           °
  358.   '''second column that is sorted. (If both the first and second column'       °
  359.  ''                                                                            °
  360.   '''have the same values, then sort uses the third column and so on.)''       °
  361.  ' 'do'                                                                        °
  362.   '''The grade function does not allow an axis specification. Suppose th       °
  363.  at''' '''we desire to sort φARRAY by columns'',r'                             °
  364.   'show ''φARRAY'' ''(φARRAY)[;√ARRAY]'' ''φARRAY[√ARRAY;]'''                  °
  365.   '''The grade function also works for arrays of rank greater than 2'',r       °
  366. X' 'show ''ARRAY╜?4 1 2µ5'' ''ARRAY'' ''ARRAY[√ARRAY;;]''' 'endd'              °
  367. *(1997 6 9 13 21 50 464)                                                       °
  368.  FTEACH4 ÉFX 'TEACH4;ALPHA;TEXT;STRING;NOS' 'Σ Dyadic GRADE'                   °
  369.   'exit ''TEACH4'''                                                            °
  370.   '''For character arrays it is not clear a-priori how one should'''           °
  371.   '''arrange the sort sequence of characters. Clearly for letters we'''        °
  372.   '''have the alphabetic sequence, but then, where should we place'''          °
  373.   '''character digits and special symbols? Because of the possibly'''          °
  374.   '''arbitrary way of deciding what the sort sequence should be, APL2'''       °
  375.   '''requires a left argument to Grade of text arrays.'',r'                    °
  376.   'show ''ALPHA╜''''ABCDEFGHIJKLMNOPQRSTUVWXYZ'''''' ''TEXT╜''''ONE TWO'       °
  377.  '''''' 'show ''TEXT[ALPHA√TEXT]'''                                            °
  378.   '''Actually, there is a default sort sequence for all characters. It''       °
  379.  ' '''is based on the COLLATING SEQUENCE of the 256 standard EBCDIC'''         °
  380.   '''characters. In the IBM 370 architecture, a character is defined as'       °
  381.  ''                                                                            °
  382.   '''a sequence of 8 bits. Since each bit position can be a 0 or a 1,'''       °
  383.   '''there are 256 possible 8 bit patterns 00000000 00000001 ... up to''       °
  384.  '                                                                             °
  385.   '''11111110 11111111. For each of these patterns, there is associated'       °
  386.  ''                                                                            °
  387.   '''a special character. The entire sequence can be displayed with a'''       °
  388.   '''SYSTEM VARIABLE called the ATOMIC VECTOR'',r' 'show ''ÉAV'''              °
  389.   '''(Note: The 14th character does not print, but causes a carriage ret       °
  390.  urn)'',r'                                                                     °
  391.   '''The following table gives the location of these 256 characters (not       °
  392.  e'''                                                                          °
  393.   '''however that blanks are fond in positions 1,14,33 and 256)'',r'           °
  394.   'av' 'do'                                                                    °
  395.   '''The box (É), followed by specific keywords has been reserved by APL       °
  396.  2'''                                                                          °
  397.   '''for SYSTEM FUNCTIONS and SYSTEM VARIABLES. These are not strictly p       °
  398.  art'''                                                                        °
  399.   '''of the APL2 language, but provide access to the non-APL2 environmen       °
  400.  t.'',r'                                                                       °
  401.   '''We will study these in due time. Meanwhile note that evaluation'''        °
  402.   '''of ÉAV produces a listing of all special characters that are'''           °
  403.   '''available to the APL2 user.''' 'do'                                       °
  404.   '''But coming back to dyadic sort, unless you have reasons to need'''        °
  405.   '''alternate collating sequences, the following idiom should'''              °
  406.   '''produce a reasonable sort vector'',r' 'show ''TEXT[ÉAV√TEXT]'''           °
  407.   '''Alphabetic sort (or alpha sort) will work on arrays as well'',r'          °
  408.   'show ''NOS╜''''ONE'''' ''''TWO'''' ''''THREE'''' ''''FOUR'''' ''''FIV       °
  409.  E'''' ''''SIX'''' ''''SEVEN'''''''                                            °
  410.   'show ''NOS╜πNOS'' ''NOS'' ''NOS[ÉAV√NOS;]'''                                °
  411.   '''There is, however one problem with sort when using the atomic vecto       °
  412.  r.''' '''suppose that our text also includes lower case words'',r'            °
  413.   'show ''NOS╜π(Γ[2]NOS),''''eight'''' ''''nine'''' ''''ten'''' ''''elev       °
  414.  en'''' ''''twelve''''''' 'show ''NOS[ÉAV√NOS;]'''                             °
  415.   '''Clearly this is NOT adequate. What we need is a way to recognize th       °
  416.  at''' '''a and A are equivalent. We could try the following'',r'              °
  417.   'show ''ALPHA╜''''aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ       °
  418.  ''''''' 'show ''NOS[ALPHA√NOS;]'''                                            °
  419.   '''In this approach, a lower case letter does not have the same value        °
  420.  as'''                                                                         °
  421.   '''an upper case letter. Lower case letters will sort in front of uppe       °
  422.  r'''                                                                          °
  423.   '''case letters. Because of that, the words THREE and TWO sort behind        °
  424.  the'''                                                                        °
  425.   '''words ten and twelve. A better way is to define the sort sequence a       °
  426.  s'''                                                                          °
  427.   '''an array. In an array, ALL non blank elements in a column are treat       °
  428.  ed''' '''as equivalent in a sort sequence.'',r'                               °
  429.   'show ''A╜π''''abcdefghijklmnopqrstuvwxyz'''' ''''ABCDEFGHIJKLMNOPQRST       °
  430.  UVWXYZ''''''' 'show ''A'' ''NOS[A√NOS;]'''                                    °
  431.   '''If the left argument to grade does not contain all symbols in the''       °
  432.  '                                                                             °
  433.   '''right argument, the missing symbols have a default value greater th       °
  434.  an''' '''the last symbol in the left argument'',r'                            °
  435.   'show ''STRING╜''''The age is 34, weight 195.3.'''''' ''STRING[ALPHA√S       °
  436.  TRING]'''                                                                     °
  437.   '''Note that the non-alpha characters maintain their original sequence       °
  438.  .''' 'do'                                                                     °
  439.   '''Before we leave the dyadic sort, we should describe techniques for'       °
  440.  ''                                                                            °
  441.   '''using the atomic vector. As its name implies, the atomic vector is'       °
  442.  ''                                                                            °
  443.   '''an APL2 vector. It is not like other arrays, because it is constant       °
  444.  ''' '''and cannot be assigned values'',r'                                     °
  445.   'show ''µÉAV'' ''ÉAV╜''''ABCD'''''' ''µÉAV'''                                °
  446.   '''Since it is a vector, we can access any of its scalar elements'',r'       °
  447.   'show ''ÉAV[3+∞4]'' ''ÉAV∞''''TEXT'''''' ''ÉAV[85 70 89 85]'' ''ÉAV[32       °
  448.  +85 70 89 85]'''                                                              °
  449.   '''Any special symbol not available from the keyboard can in this way'       °
  450.  ''                                                                            °
  451.   '''be obtained and used to advantage. There are some characters in ÉAV       °
  452.  '''                                                                           °
  453.   '''that do not have a visible representation. These characters produce       °
  454.  '''                                                                           °
  455.   '''effects related to the pressing of grey keys on your keyboard, such       °
  456. X''' '''as BACKSPACE, NEWLINE, LINEFEED, ...''' 'endd'                         °
  457. *(1997 6 10 13 10 56 448)                                                      °
  458.  FTEACH5 ÉFX 'TEACH5' 'Σ System functions and variables'                       °
  459.   'exit ''TEACH5'''                                                            °
  460.   '''In addition to ÉAV, the IBM version of APL2 supports a number of'''       °
  461.   '''other System Functions and System Variables. For the time being,'''       °
  462.   '''we will describe only two of these.'',r'                                  °
  463.   '''The SYSTEM VARIABLE called TEMINAL CONTROL CHARACTERS is a three'''       °
  464.   '''element vector. In some versions of APL2 all three elements have'''       °
  465.   '''meaning: BACKSPACE TO LEFT, NEW LINE (RETURN), and LINE FEED. In th       °
  466.  e'''                                                                          °
  467.   '''current version of APL2OS2 only the NEW LINE (RETURN) works. The ot       °
  468.  her'''                                                                        °
  469.   '''"terminal control" characters wil display special symbols on the sc       °
  470.  reen'',r'                                                                     °
  471.   'show ''ÉTC[1 3]'' ''''''Backspace'''',ÉTC[1],''''and line feed'''',ÉT       °
  472.  C[3],''''fails'''''''                                                         °
  473.   '''The NEW LINE control character will cause text (or numbers) to'''         °
  474.   '''coninue displaying on a new line'',r'                                     °
  475.   'show ''(∞10),ÉTC[2],(10+∞10)'' ''''''CONTINUE'''',ÉTC[2],''''ON A NEW       °
  476.   LINE'''''''                                                                  °
  477.   '''An example of a SYSTEM FUNCTION is ATOMIC FUNCTION represented by''       °
  478.  '                                                                             °
  479.   '''ÉAF. This function is closely related to the usage of ∞ with ÉAV'',       °
  480.  r'                                                                            °
  481.   'show ''ÉAV∞''''TEXT'''''' ''ÉAF ''''TEXT'''''' ''ÉAV[3+∞4]'' ''ÉAF 2+       °
  482.  ∞4'''                                                                         °
  483.   '''Note that ÉAF behaves as if counting integers begin with 0 instead'       °
  484.  ''                                                                            °
  485.   '''of with 1. This way of counting is called ZERO INDEX ORIGIN. We wil       °
  486. Xl''' '''learn more about that later.''' 'endd'                                °
  487. *(1997 6 12 12 44 31 488)                                                      °
  488.  FTEACH6 ÉFX 'TEACH6' 'Σ System commands' 'exit ''TEACH6'''                    °
  489.   '''In addition to System Functions and Variables, there are also'''          °
  490.   '''SYSTEM COMMANDS. You are already familiar with two of these'',r'          °
  491.   '''      )LOAD workspace''' '''      )OFF''' 'do'                            °
  492.   '''Unlike the first two, System Commands cannot be used inside APL2'''       °
  493.   '''expressions. System Commands lie entirely outside APL2, and are'''        °
  494.   '''used to describe or manipulate the APL2 session and environment.'',       °
  495.  r' '''We will list here only those that are currently appropriate'',r'        °
  496.   '''It should be pointed out that as long as you are under the control'       °
  497.  ''                                                                            °
  498.   '''of this session, any attempt to issue these commands will fail.'''        °
  499.   '''This is because the lesson assumes that any input by you is a valid       °
  500.  '''                                                                           °
  501.   '''APL2 expression. To test these commands, wait until the end of the'       °
  502.  '' '''lesson, or enter EXIT.''' 'do' '''      )WSID'',r'                      °
  503.   '''This command will return the name of current workspace (TEACH9).'''       °
  504.   'do'                                                                         °
  505.   '''Any of these workspaces can be made active by issuing the command''       °
  506.  ,r' '''      )LOAD workspace-name''' 'do' '''      )LIB'',r'                  °
  507.   '''This command will list the names of all workspaces in the library.'       °
  508.  ''                                                                            °
  509.   '''The words LOAD and LIB can be followed by a library number. (You ca       °
  510.  n'''                                                                          °
  511.   '''define library numbers by adding to your APL2 Invocation command fi       °
  512.  le.'''                                                                        °
  513.   '''The process is described in a separate tutorial dealing with APL2OS       °
  514.  2.)''' 'do' '''      )OFF'',r'                                                °
  515.   '''This command will quit APL2, and return you to the environment'''         °
  516. X '''from which you entered APL2.''' 'endd'                                    °
  517. XNVECTOR 1 20 7 7 38 38 23 23 27 27 11 11 3 3 34 34 34 34 47 47 20 20          °
  518. *(1997 7 13 12 28 49 504)                                                      °
  519.  Faddquote ÉFX 'u╜addquote w'                                                  °
  520.   'Σ Put quotes around a string, and double existing quotes'                   °
  521. X 'u╜ÉAV[40],((1+w=ÉAV[40])/w),ÉAV[40]'                                        °
  522. *(1997 7 24 13 20 38 476)                                                      °
  523.  Fav ÉFX 'av;A;N;I;ÉIO' 'Σ Display characters in ÉAV' 'ÉIO╜0'                  °
  524.   'A╜22 78µ'' ''' 'N╜3 0«φ12 22µ1+∞356' 'A[;,(6⌡∞12)°.+2 3 4]╜N'               °
  525.   'A[;6+6⌡∞12]╜φ12 22µÉAV' 'ΣA[8 10 13;6]╜'' ''' 'A[13;6]╜'' '''               °
  526. X 'A[14+∞8;68 69 70 72]╜'' ''' 'A'                                             °
  527. *(1991 11 11 8 25 13 316)                                                      °
  528.  Fdate ÉFX 'u╜date w' 'Σ Format date and time of day' 'u╜«6╞w'                 °
  529. X 'u╜('' ''⌠u)Γu' 'u╜εu,■''-- .. '''                                           °
  530. XCdig 1 10 1234567890                                                          °
  531. *(1997 9 9 13 0 45 372)                                                        °
  532.  Fdisclaimer ÉFX 'disclaimer' 'Σ Copyright statement'                          °
  533.   '(10µ'' ''),''Copyright, Z. V. Jizba, 1995,1996,1997'',r'                    °
  534.   ''' This and subsequent workspaces labelled TEACHxx are made available       °
  535.  '''                                                                           °
  536.   '''at no cost to anyone who desires to learn how to use effectively'''       °
  537.   '''the IBM/OS2 version of APL2.'',r'                                         °
  538.   '''This software is provided "AS IS" with no WARRANTY of any kind, eit       °
  539.  her'''                                                                        °
  540.   '''express or implied. Any risk in its use resides with you, the user        °
  541.  of''' '''these tutorials.'',r' '''     ACKNOWLEDGEMENTS'',r'                  °
  542.   ''' In writing these tutorials, I am greatly indebted to Roy Sykes, wh       °
  543.  ose'''                                                                        °
  544.   '''excellent lectures increased my understanding of the language.'''         °
  545.   '''Discussions with the late Harry Bertucelli clarified a number of'''       °
  546.   '''concepts and caused me to change some improper terminology that was       °
  547.  '''                                                                           °
  548.   '''used in previous versions of these tutorials. Mr. Benjamin Archer''       °
  549.  '                                                                             °
  550.   '''kindly checked out a nearly final version, bringing to my attention       °
  551.  ''' '''some ommisions, misspellings, and invalid terminology.'',r'            °
  552. X '''(PRESS ENTER to continue)'''                                              °
  553. *(1997 7 13 12 28 50 508)                                                      °
  554.  Fdo ÉFX 'do;T;E' 'Σ Expression driver' 'E╜''''' 'æ╜''      ''' 'T╜æ'          °
  555.   '╕(^/'' ''=T)/0'                                                             °
  556.   '╕(('':''εT)doif ''B╜evaldd (+/^\'''' ''''=T)╟T'')/2'                        °
  557.   '''E╜ÉEM'' ÉEA T' '╕(0=µ,E)/2'                                               °
  558.   '''This is not a valid APL2 expression''' 'æ╜''*''' '╕(''?''⌠╞1╟æ)/2'        °
  559. X 'E' '╕2'                                                                     °
  560. *(1997 7 13 12 28 50 508)                                                      °
  561.  Fdoif ÉFX 'U╢╜V╢ doif W╢;t╢' 'Σ Rule' '╕(^/~U╢╜V╢)/0'                         °
  562. X '''U╢╜V╢ doif■ W╢'' ÉEA ''»V╢/W╢'''                                          °
  563. *(1997 9 9 12 50 14 444)                                                       °
  564.  Fendd ÉFX 'endd' 'Σ end of special feature' '20µ''²'' ╪ ╕(4<µÉLC)/0'          °
  565. X 'do'                                                                         °
  566. *(1997 8 15 12 52 33 548)                                                      °
  567.  Ferase ÉFX 'erase;t;EXIT;GO;HELP;DISPLAY;REVIEW;BIND;DISCLAIMER'              °
  568.   'Σ Erase all global functions and variables' 't╜ÉNL 3'                       °
  569.   't╜(~t^.εlc,'' '')≡t' 't╜ÉEX(~t[;∞5]^.=''TEACH'')≡t' 't╜ÉNL 2'               °
  570. X 't╜ÉEX(~t^.εlc,'' '')≡t'                                                     °
  571. *(1997 7 27 13 47 41 608)                                                      °
  572.  Fevaldd ÉFX 'u╜evaldd w;c;n' 'Σ Evaluate direct definition' 'u╜0'             °
  573.   'n╜(w∞''Σ'')-1' 'c╜(((n╞w)⌠'':'')Γn╞w),Γ''ΣDD '',(n+1)╟w'                    °
  574.   '╕((1 label╞c)doif ''''''Invalid label'''''')/0'                             °
  575.   '╕((2=µc)doif ''u╜showdd 1╙c'')/0'                                           °
  576.   '╕((3=ÉNC╞c)doif ''u╜⌡µÉ╜(╞c),'''' is already defined.'''''')/0'             °
  577.   '╕((3=µc)doif ''u╜simdd c'')/0' 'c╜(Γ''α∙ aw'')replace■c'                    °
  578.   'u╜ε''u╜'',((''a''εεc[2 3 4])/''a ''),(╞c),'' w;t;b'''                       °
  579.   'u╜u(5πc)(''b╜(t╜'',(3πc),'')/'',addquote ''u╜'',4πc)'                       °
  580. X 'u╜u,''╕(t doif b)/0''(''u╜'',2πc)' 'u╜╧ÉFX u'                               °
  581. *(1997 7 25 13 27 52 564)                                                      °
  582.  Fexit ÉFX 'V exit W;T' 'Σ Exit if too many suspended functions'               °
  583.   '╕(0⌠ÉNC ''V'')/L0 ╪ V╜10' 'L0:╕(V>µÉLC)/0'                                  °
  584.   '''There are too many suspended functions''' '''Please enter '',W'           °
  585. X '╕'                                                                          °
  586. *(1997 7 26 12 33 39 536)                                                      °
  587.  Fget ÉFX 'U╜V get W;t;T;ÉPR' 'Σ Prompt for response from keyboard'            °
  588.   'ÉPR╜T╜ÉAV[ÉIO+255] ╪ ╕(0⌠ÉNC ''V'')/L0 ╪ V╜1' 'L0:V╜V╧1' 'æ╜W ╪ t╜æ'        °
  589.   'U╜(+/^\t=T)╟t' '╕(''╕''⌠╞U)/L1 ╪ ╕' 'L1:╕V/0' 't╜(U⌠'' '')ΓU'               °
  590. X 'U╜(µt),(ΓU),t'                                                              °
  591. *(1997 7 28 13 33 8 424)                                                       °
  592.  Fglobals ÉFX 'globals' 'Σ Initialize useful global variables'                 °
  593.   'uc╜''ABCDEFGHIJKLMNOPQRSTUVWXYZ'''                                          °
  594.   'lc╜''abcdefghijklmnopqrstuvwxyz''' 'dig╜''1234567890'''                     °
  595. X 'r╜ÉAV[13+ÉIO]' 'q╜'''''''''                                                 °
  596. *(1997 7 3 12 47 6 368)                                                        °
  597.  Finitialize ÉFX 'initialize;T' 'Σ Initialize workspace'                       °
  598.   '''AT ALL TIMES, TO CONTINUE, PRESS RETURN!'',r'                             °
  599.   '''To see disclaimers enter:'',r,''    disclaimer''' 'do' 'erase'            °
  600.   'globals'                                                                    °
  601.   '''Make sure the CAP LOCK light on your keyboard (upper right) is ON!'       °
  602. X'' 'endd'                                                                     °
  603. *(1997 7 27 13 14 33 444)                                                      °
  604.  Flabel ÉFX 'u╜v label w'                                                      °
  605.   'Σ Return 1 if label w does not begin with a cap'                            °
  606.   '╕(0⌠ÉNC ''v'')/L0 ╪ v╜0' 'L0:v╜v╧1 ╪ w╜εw ╪ ╕v/L1 ╪ ╕(u╜0⌠ÉNC w)/0'         °
  607. X 'L1:╕(u╜~^/wεlc,uc,dig)/0' 'u╜w[1]εlc,dig'                                   °
  608. XClc 1 26 abcdefghijklmnopqrstuvwxyz                                           °
  609. *(1997 7 13 12 28 55 528)                                                      °
  610.  Fnon ÉFX 'non;T;RC;ET;R' 'Σ Ignore keyboard entry' 'æ╜''      ''' 'T╜æ'       °
  611.   '╕(0=µ(T⌠'' '')/T)/0' '(RC ET R)╜ÉEC T' '╕(0=RC)/2'                          °
  612. X '╕((1=RC)doif ''R'')/2' '╕2'                                                 °
  613. *(1997 7 13 12 28 55 528)                                                      °
  614.  Fnotb ÉFX 'u╜notb w' 'Σ Remove trailing blanks'                               °
  615.   '╕((1<╧w)doif ''u╜notb■ w'')/0' '╕((1<µµw)doif ''u╜πnotb Γ[2]w'')/0'         °
  616. X 'u╜(1-(,'' ''⌠Φw)∞1)╟w'                                                      °
  617. *(1997 7 27 12 55 6 496)                                                       °
  618.  Fproblems ÉFX 'problems' 'Σ Problems'                                         °
  619.   '''That is all for this lesson. Remember, if you want to practice,'''        °
  620.   '''and plan to use direct definitions, be sure to first enter GO.'''         °
  621.   '''Direct definitions will then be accepted. To exit GO, enter EXIT.''       °
  622.  ,r'                                                                           °
  623.   '''To erase a previously defined DIRECT DEFINITION FUNCTION, enter'',r       °
  624.  ' '''       )ERASE functionname'',r'                                          °
  625. X '''WARNING! do not use )ERASE on other labels.'',r'                          °
  626. XCq 0 '                                                                        °
  627. XCr 0                                                                         °
  628. *(1997 7 13 12 28 56 532)                                                      °
  629.  Freplace ÉFX 'u╜v replace u;i;r;s' 'Σ Replace elements in v in u'             °
  630.   'i╜Γ∞µu' 's╜2πv╜(v⌠'' '')Γv' 'i╜⌡r╜i⌡■Γ[1]u°.=╞v'                            °
  631. X 'u[(εi)/εr]╜s[(εi)/εi⌡■∞µs]'                                                 °
  632. *(1997 7 13 12 28 56 532)                                                      °
  633.  Fround ÉFX 'U╜V round W' 'Σ Half adjust to V th decimal'                      °
  634. X 'U╜(╛0.5+W⌡10*V)÷10*V'                                                       °
  635. *(1997 7 13 12 28 57 536)                                                      °
  636.  Fshow ÉFX '╢V show ╢W;╢T;╢B' 'Σ Display and execute ╢W'                       °
  637.   '╢T╜(0=ÉNC ''╢V'')doif ''╢V╜0'''                                             °
  638.   '╕((0=╧╢W)doif ''show ╢W,'''' '''''')/0'                                     °
  639.   '╕((1<╧╢W)doif ''╢V show ■╢W'')/0' '''      '',╢W'                           °
  640. X '╕((╢V^'':''ε╢W)doif ''╢T╜evaldd ╢W'')/L0' '''ÉEM'' ÉEA ╢W' 'L0:do'          °
  641. *(1997 7 13 12 28 57 536)                                                      °
  642.  Fshowdd ÉFX 'u╜showdd w;a;b;c;r'                                              °
  643.   'Σ Display a direct definition function'                                     °
  644.   '╕((1=╧w)doif ''u╜showdd Γw'')/u╜0'                                          °
  645.   '╕((3⌠ÉNC╞w)doif ''(ε╞w),'''' is not a function'''''')/0'                    °
  646.   'c╜Γ[2]ÉCR╞w' 'c╜notb(2╞c),(Γ''aw α∙'')replace■2╟c'                          °
  647.   '╕((~''ΣDD''╧3╞2πc)doif ''''''Not a direct definition function'''''')/       °
  648.  0' 'u╜1' 'b╜('' ''⌠╞c)Γ╞c' 'a╜''      ''' 'r╜2╟3πc'                           °
  649.   '╕((3=µc)doif ''a,(╞w),'''':'''',r,(3<µ2πc)/''''   Σ'''',3╟2πc'')/0'         °
  650.   'a╜a,(╞w),'':'',(2╟5πc),'':''' 'b╜(+\r=''('')-+\r='')''' 'b╜b∞0'             °
  651. X 'a╜a,(²3╟(b-1)╞3╟r),'':'',2╟»(b+2)╟r' 'a,(3<µ2πc)/''  Σ'',3╟2πc'             °
  652. *(1997 7 13 12 28 57 536)                                                      °
  653.  Fshowfn ÉFX 'U╜V showfn W;F;N;T;ÉIO' 'Σ Simulate ╖W[É]'                       °
  654.   'T╜(0=ÉNC ''V'')doif ''V╜0''' 'ÉIO╜0'                                        °
  655.   'U╜r,''      '',''╖'',W,''[É]'',(╞V)╞''╖''' 'N╜1╞µF╜ÉCR W' 'N╜«∞N'           °
  656.   'N╜(N⌠'' '')ΓN' 'F╜(π''['',■N,■Γ''] ''),F'                                   °
  657.   'T╜(1<µ,V)doif ''F╜F[1╟V;]'' ''U╜''''''''''' 'U╜²1╟U,r,,F,r'                 °
  658. X 'U╜((-+/^\'' ''=ΦU)╟U),('' ╖'')[╞V],r'                                       °
  659. *(1997 7 13 12 28 58 540)                                                      °
  660.  Fsimdd ÉFX 'u╜simdd w;e' 'Σ Direct definition mode' 'u╜0'                     °
  661.   '╕((0⌠ÉNC╞w)doif ''''''Already defined'''''')/0' 'e╜''α''ε2πw'               °
  662.   'w[2]╜Γ''u╜'',''α∙ aw'' replace 2πw' 'w╜w[1 3 2]'                            °
  663. X 'w[1]╜Γε''u╜'',(e/''a ''),w[1],'' w''' 'u╜╧ÉFX w'                            °
  664. *(1992 6 3 9 59 17 424)                                                        °
  665.  Ftab ÉFX 'U╜V tab W;T;A;B;C;D;E;F;G;M;ÉPW' 'Σ Tabulate list W'                °
  666.   'T╜(0=ÉNC ''V'')doif ''V╜0''' 'M╜''Invalid data for tabulation'''            °
  667.   'V╜4╞V' 'ÉPW╜130╛30⌐G╜V[2]+79⌡V[2]=0'                                        °
  668.   'L1:╕((1<╧W)doif ''''''W╜∞0'''' ÉEA ''''W╜πW'''''')/L1'                      °
  669.   '╕(((0=µεW)δ2<µµW)doif ''U╜(~V╧4╞0)/M'')/0'                                  °
  670.   'T╜(1≥µµU╜«W)doif ''U╜πW╜(U⌠'''' '''')ΓU'''                                  °
  671.   'T╜(0<V[1])doif ''U╜(«(Φ1,╞µW)µ(V[3]µ'''' ''''),∞(╞µW)-V[3]),'''' ''''       °
  672.  ,U''' '╕(G<30)/0' 'T╜(F╜µεV[4])+C╜1╟B╜µA╜(V[3],0)╟U'                          °
  673.   'T╜⌐(1╞B)÷1⌐╛(ÉPW+F)÷T' 'U╜(E╜(V[3],C)╞U),[1](B╜T,1╟B)╞A'                    °
  674.   '''D╜εV[4]'' ÉEA ''D╜ÉAV[εV[4]+33⌡V[4]=0]''' 'L0:A╜(T,0)╟A'                  °
  675. X '╕(0=1╞µA)/0' 'U╜U,(((T+V[3]),µD)µD),E,[1]B╞A' '╕L0'                         °
  676. *(1997 7 13 12 28 59 544)                                                      °
  677.  Ftest ÉFX 'U╜V test W;P'                                                      °
  678.   'Σ Describe problem in W, (correct answer in V)' 'U╜2' 'L1:W'                °
  679.   'É╜''      ''' 'P╜æ' '''╕L0'' ÉEA ''P╜»P''' '╕(V╧P)/0'                       °
  680. X 'L0:╕(0=U╜U-1)/0' '''Incorrect. Try again''' '╕L1'                           °
  681. XCuc 1 26 ABCDEFGHIJKLMNOPQRSTUVWXYZ                                           °
  682. *(1996 4 6 16 4 16 248)                                                        °
  683.  Fvec ÉFX 'U╜vec' 'Σ Draw 2d vector in plane'                                  °
  684.   'U╜r,r,''2-        +'',r '':      °'',r,''1-    °'',r'                       °
  685. X 'U╜U,'' :  °'',r,''0|....|....|'',r,'' 0    1    2'',r'                      °
  686.