home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / teach.zip / TEACH14A.ATF < prev    next >
Text File  |  1997-09-19  |  52KB  |  635 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. *(1996 4 6 16 8 10 240)                                                        °
  8.  FBIND ÉFX 'BIND' 'Σ Binding rules of APL2'                                    °
  9.   '''  1. Brackets bind to the left'''                                         °
  10.   '''  2. Left arrow binds to the left'''                                      °
  11.   '''  3. Dyadic operator binds to the right'''                                °
  12.   '''  4. Strand notation binding'''                                           °
  13.   '''  5. Operator binds to its left'''                                        °
  14.   '''  6. Function binds to its left'''                                        °
  15.   '''  7. Function binds to its right'''                                       °
  16. X '''  8. Left arrow binds to its right'',r'                                   °
  17. *(1997 9 14 12 30 44 504)                                                      °
  18. XFDISCLAIMER ÉFX 'DISCLAIMER' 'Σ Copyright statement' 'disclaimer'             °
  19. *(1996 4 6 16 8 11 244)                                                        °
  20.  FDISPLAY ÉFX 'D╜S DISPLAY A;ÉIO;R;C;HL;HC;HT;HB;VL;VB;V;W;N;B'                °
  21.   'Σ DISPLAY A GENERAL ARRAY IN PICTORIAL FORM'                                °
  22.   'Σ  NORMAL CALL IS MONADIC.  DYADIC CALL USED ONLY IN'                       °
  23.   'Σ    RECURSION TO SPECIFY DISPLAY RANK, SHAPE, AND DEPTH.' 'ÉIO╜0'          °
  24.   '»(0=ÉNC ''S'')/''S╜µA''' 'R╜╞µ,S                   Σ PSEUDO RANK.'          °
  25.   'C╜''┐┌└┘''                 Σ UR, UL, LL, AND LR CORNERS.'                   °
  26.   'HL╜''─''                   Σ HORIZONTAL LINE.'                              °
  27.   'HC╜HL,''Θ╕'',HL,''~+ε''      Σ HORIZONTAL BORDERS.'                         °
  28.   'HT╜HC[(0<R)⌡1+0<╞²1╞,S]' 'ΣW╜,0╧■╞0µΓ(1⌐µA)╞A'                              °
  29.   'HB╜HC[3+3╛(''2⌡~A╧«A'' ÉEA ''1+╞ε0⌡(1⌐⌡/µA)╞,A'')+3⌡1<µµS]'                 °
  30.   'VL╜''│''                   Σ VERTICAL LINE.'                                °
  31.   'VB╜VL,''Φ╟''               Σ VERTICAL BORDER.'                              °
  32.   'V╜VB[(1<R)⌡1+0<²1╞²1╟,S]'                                                   °
  33.   '»(0εµA)/''A╜(1⌐µA)µΓ╞A''   Σ SHOW PROTOTYPE OF EMPTIES.'                    °
  34.   '╕(1<╧A)/GEN' '╕(2<µµA)/D3'                                                  °
  35.   'D╜«A                     Σ SIMPLE ARRAYS.' 'W╜1╞µD╜(²2╞1 1,µD)µD'           °
  36.   'N╜²1+1╟µD' '╕(0=µµA)/SS'                                                    °
  37.   'D╜(C[1],V,((W-1)µVL),C[2]),((HT,NµHL),[0]D,[0]HB,NµHL),C[0],(WµVL),C[       °
  38.  3]' '╕0' 'SS:HB╜((0 '' '')=╞0µΓA)/'' -'''                                     °
  39.   'D╜'' '',('' '',[0]D,[0]HB,Nµ'' ''),'' ''' '╕0'                              °
  40.   'GEN:D╜«DISPLAY■A          Σ ENCLOSED ...' 'N╜Dδ.⌠'' '''                     °
  41.   'D╜(Nδ~1ΦN)≡D' 'D╜(δ≡~''  ''╤D)/D' 'D╜((1,µS)µS)DISPLAY D'                   °
  42.   '╕(2≥µ,S)╟D3E,0' 'D3:D╜0 ²1╟0 1╟«ΓA         Σ MULT-DIMENSIONAL ...'          °
  43.   'W╜1╞µD' 'N╜²1+1╟µD'                                                         °
  44.   'D╜(C[1],V,((W-1)µVL),C[2]),((HT,NµHL),[0]D,[0]HB,NµHL),C[0],(WµVL),C[       °
  45.  3]' 'D3E:N╜²2+µ,S'                                                            °
  46. X 'V╜C[Nµ1],[0]VB[1+0<²2╟,S],[0](((²3+╞µD),N)µVL),[0]C[Nµ2]' 'D╜V,D'           °
  47. *(1997 8 17 11 52 3 432)                                                       °
  48.  FEVAL ÉFX 'EVAL w╢;a╢;c╢;u╢;e╢;r╢' 'Σ Evaluate extensions to APL2'            °
  49.   'u╢╜''╜''=²1╞a╢╜╞w╢ ╪ w╢╜u╢╟w╢ ╪ (c╢ e╢ r╢)╜ÉEC 2πw╢'                        °
  50.   '╕(1⌠r╢)/L0 ╪ r╢╜3πÉEC 3πw╢ ╪ ╕L1' 'L0:r╢╜3πÉEC╞w╢'                          °
  51. X 'L1:╕(''╜''⌠²1╞a╢)/L2 ╪ 3πÉEC a╢,''r╢'' ╪ ╕0' 'L2:r╢'                        °
  52. *(1996 4 6 16 8 11 244)                                                        °
  53.  FEXIT ÉFX 'EXIT' 'Σ Exit from function' '''To log off type:   )OFF'''         °
  54. X '╕'                                                                          °
  55. *(1996 4 6 16 8 11 244)                                                        °
  56.  FGO ÉFX 'GO;T;E;B' 'Σ Expression driver' 'L0:B╜E╜''''' 'æ╜''      '''         °
  57.   'T╜æ' '╕(^/'' ''=T)/L0' '╕((^/'')OFF ''=5╞6╟T)doif ''EXIT'')/0'              °
  58.   '╕(('':''εT)doif ''B╜evaldd (+/^\'''' ''''=T)╟T'')/L0'                       °
  59.   '''E╜ÉEM'' ÉEA T' '╕(0=µ,E)/L0' '╕B/L0'                                      °
  60.   '''This is not a valid APL2 expression''' 'æ╜''*'''                          °
  61. X '╕(''?''⌠╞1╟æ)/L0' 'E' '╕L0'                                                 °
  62. *(1997 8 17 11 49 38 560)                                                      °
  63.  FHELP ÉFX 'HELP;N;I;T' 'Σ Help to student' '''WHAT TO DO'',r'                 °
  64.   '''  ° To get out of the lesson''' '''       ENTER: EXIT'''                  °
  65.   '''  ° To log off APL2'''                                                    °
  66.   '''       FIRST, ENTER: EXIT  THEN ENTER: )OFF'''                            °
  67.   '''  ° To get help''' '''       ENTER: HELP'''                               °
  68.   '''  ° When you see the prompt on a blank line'''                            °
  69.   '''       ENTER AN APL2 EXPRESSION - OR JUST PRESS: ENTER''' 'do'            °
  70.   '''  ° If you get this line'',r'                                             °
  71.   '''This is not a valid APL2 expression'',r,''*'',r'                          °
  72.   '''        YOU CAN EITHER''' '''           A. PRESS: ENTER'''                °
  73.   '''           B. PRESS: ? and then ENTER to see what was incorrect'''        °
  74.   '''              in your expression causing that response'',r' 'do'          °
  75.   '''HINTS'',r'                                                                °
  76.   '''This lesson is made up of '',(«N╜6),'' components named TEACHx, whe       °
  77.  re''' '''the x stands for a digit:'',r' 'I╜0'                                 °
  78.   'L0:T╜''TEACH'',(«I╜I+1)' 'T,'' '',1╟notb(ÉCR T)[2;]' '╕(N>I)/L0'            °
  79.   'do'                                                                         °
  80.   '''You may review either of these components separately. To do that,''       °
  81.  '                                                                             °
  82.   '''first enter EXIT (and RETURN), then enter the name of the lesson.''       °
  83.  ' '''component (e.g. TEACH4).'',r'                                            °
  84.   '''To re-start the lesson, just enter TEACH'',r'                             °
  85.   '''When the screen fills up, it is a good idea to move the cursor to''       °
  86.  ' '''the start of a convenient paragraph, and press ENTER'',r'                °
  87.   '''You may also wish to press PAGE UP to review the prevous pages.'''        °
  88.   'do' '''RESOURCES'',r'                                                       °
  89.   '''You may also enter ONE of the following words at a time'',r'              °
  90. X '''REVIEW  Review of the previous lesson''' 'endd'                           °
  91. *(1997 8 17 11 51 46 600)                                                      °
  92.  FNEW ÉFX 'NEW;C╢;E╢;R╢;T╢' 'Σ Driver to experimental extension to APL2'       °
  93.   'L0:æ╜''      '' ╪ T╢╜æ ╪ T╢╜(+/^\T╢='' '')╟T╢' '(C╢ E╢ R╢)╜ÉEC T╢'          °
  94.   '╕(T╢╧'''')/L0' '╕(C╢ε4 5)/0' '╕(C╢ε2 3)/L0 ╪ ╕(C╢⌠1)/L1 ╪ R╢ ╪ ╕L0'         °
  95. X 'L1:╕(3>µT╢╜(T╢⌠'':'')ΓT╢)/L2 ╪ EVAL T╢ ╪ ╕L0' 'L2:R╢ ╪ ╕L0'                 °
  96. *(1997 7 1 11 56 53 580)                                                       °
  97.  FTEACH ÉFX 'TEACH' 'Σ Start lesson #14: APL2 by Zdenek V JIZBA'               °
  98.   'exit ''TEACH''' 'initialize'                                                °
  99.   'TEACH1 Σ The Execute Alternate System function'                             °
  100.   'TEACH2 Σ The Execute Controlled System Function'                            °
  101.   'TEACH3 Σ The Event Type System Variable'                                    °
  102.   'TEACH4 Σ Error Messages and the Error Message System variable'              °
  103.   'TEACH5 Σ Function NEW. Using ÉEC to augument APL2'                          °
  104. X 'TEACH6 Σ Function EVAL to evaluate non-APL2 expressions' 'problems'         °
  105. *(1997 6 28 11 23 52 548)                                                      °
  106.  FTEACH1 ÉFX 'TEACH1;A;FOO' 'Σ Execute alternate'                              °
  107.   '''As is common with most programming languages, there are problems'''       °
  108.   '''for which APL2 was not specifically designed. The architects of'''        °
  109.   '''APL were interested primarily in solving computational and characte       °
  110.  r'''                                                                          °
  111.   '''manipulation problems. To date by far the most common usage in APL2       °
  112.  '''                                                                           °
  113.   '''is for business applications, and to some extent in engineering and       °
  114.  '''                                                                           °
  115.   '''scientific computations. Since APL2 is not designed for the most'''       °
  116.   '''effective usage of computer resources, it may not be well suited in       °
  117.  ''' '''the solution of very large (number crunching) problems.''' 'do'        °
  118.   '''For this reason, APL2 has a number of added on features. We have'''       °
  119.   '''already studied some of these (System functions and System variable       °
  120.  s).'''                                                                        °
  121.   '''One of the most important System Functions is the one called NAME''       °
  122.  '                                                                             °
  123.   '''ASSOCIATION (ÉNA). Another important family of System Functions'''        °
  124.   '''is the SHARED VARIABLE family (ÉSVx). These two (ÉNA and ÉSVx), are       °
  125.  '''                                                                           °
  126.   '''the main vehicles for the effective usage of system resources throu       °
  127.  gh'''                                                                         °
  128.   '''APL2. Tutorial workspaces on these are available (see TEACH51 TEACH       °
  129.  51...)''' 'do' '''    CONDITIONAL SYSTEM FUNCTIONS'',r'                       °
  130.   '''There is a class of problems that arises in some applications.'''         °
  131.   '''Suppose that an APL2 expression proves to be invalid. Normally, APL       °
  132.  2'''                                                                          °
  133.   '''will cause an INTERRUPT, and display the expression that could not'       °
  134.  ''                                                                            °
  135.   '''be evaluated. At that point it is up to the user of APL2 to be able       °
  136.  ''' '''to figure out what to do to correct the stopped execution.'',r'        °
  137.   '''Consider now an application, where it is desired to augument the'''       °
  138.   '''class of valid APL2 expressions by supporting plain English phrases       °
  139.  .'''                                                                          °
  140.   '''Any valid APL2 expression would be evaluated normally, so that the'       °
  141.  ''                                                                            °
  142.   '''application would behave as a normal APL2 session. But in addition,       °
  143.  '''                                                                           °
  144.   '''a phrase such as for example "What time is it?" would also produce'       °
  145.  '' '''an appropriate response''' 'do'                                         °
  146.   '''The class of problems where this type of activity is common is call       °
  147.  ed'''                                                                         °
  148.   '''Artificial Intelligence (or AI). In this lesson we will study a num       °
  149.  ber'''                                                                        °
  150.   '''of System functions as well as some new primitive APL2 functions th       °
  151.  at''' '''can be used to great advantage in problems of this type.'''          °
  152.   'do' '''          EXECUTE ALTERNATE (ÉEA)'',r'                               °
  153.   '''Although not part of the APL2 language, the Execute Alternate is on       °
  154.  e'''                                                                          °
  155.   '''of two ways of evaluating the validity of an APL2 expression.'''          °
  156.   '''It is a dyadic function of the form L ÉEA R, where L and R must be'       °
  157.  '' '''character strings, presumably containing APL2 expressions.'''           °
  158.   '''The right argument is evaluated first. If the evaluation succeeds,'       °
  159.  ''                                                                            °
  160.   '''the left argument is ignored. If the evaluation fails, then the lef       °
  161.  t''' '''argument is evaluated'',r'                                            °
  162.   'show ''''''∞∞'''' ÉEA ''''∞5'''''' ''''''∞4'''' ÉEA ''''∞∞'''''''           °
  163.   '''The first two examples illustrate the basic notion of ÉEA. The resu       °
  164.  lts''' '''are returned as if ÉEA produced a result.''' 'do'                   °
  165.   '''In the next two examples, the expressions in quotes are assignment'       °
  166.  '' '''statements, and the System Function produces no result.'',r'            °
  167.   'show ''''''A╜4'''' ÉEA ''''A╜∞5'''''' ''A'' ''''''A╜∞4'''' ÉEA ''''∞'       °
  168.  ''''' ''A'''                                                                  °
  169.   '''The next example shows how a niladic function can be used in the le       °
  170.  ft''' '''argument.'',r'                                                       °
  171.   'show ''A╜ÉFX ''''FOO'''' ''''''''''''Not a valid expression''''''''''       °
  172.  ''''' 'show ''''''FOO'''' ÉEA ''''A╜∞2.1'''''' ''A'''                         °
  173.   '''Finally, ÉEA shows no result for niladic function right argument.''       °
  174.  ,r' 'show ''''''A╜anything'''' ÉEA ''''FOO'''''' ''A'''                       °
  175.   '''Clearly, ÉEA is a powerful way to handle invalid keyboard entries.'       °
  176.  '' 'do'                                                                       °
  177.   '''There are problems with ÉEA, as the following examples illustrate''       °
  178.  ,r'                                                                           °
  179.   'show ''''''A╜4'''' ÉEA ''''A╜∞5'''''' ''µ''''A╜4'''' ÉEA ''''A╜∞5''''       °
  180.  ''' 'show ''DISPLAY ''''A╜4'''' ÉEA ''''A╜∞5'''''''                           °
  181.   '''Even though the expression shows no result, if we apply functions''       °
  182.  ' '''to the expression, it behaves as if it did.''' 'do'                      °
  183.   '''Here is another problem'',r'                                              °
  184.   'show ''A╜''''anything'''' ÉEA ''''FOO'''''' ''A╜''''FOO'''' ÉEA ''''a       °
  185.  nything'''''''                                                                °
  186.   '''If the left or right argument contains an expression that produces'       °
  187.  ''                                                                            °
  188.   '''no result, then the result of ÉEA cannot be assigned. Since in some       °
  189.  ''' '''applications it is not possible to predict the nature of the'''        °
  190.   '''arguments to ÉEA, this may pose problems.'',r'                            °
  191.   '''The table below summarizes the requirements for usage of ÉEA:'',r'        °
  192.   '''RIGHT ARGUMENT      LEFT ARGUMENT      ÉEA RESULT'''                      °
  193.   '''²²²²²²²²²²²²²²      ²²²²²²²²²²²²²      ²²²²²²²²²²'''                      °
  194.   '''valid with result   arbitrary          returns result'''                  °
  195.   '''valid assignment    arbitrary          no display but result availa       °
  196.  ble''' '''niladic             arbitrary          no result'''                 °
  197.   '''invalid             valid with result  returns result'''                  °
  198.   '''invalid             valid assignment   no display but result availa       °
  199.  ble''' '''invalid             niladic            no result'''                 °
  200.   '''invalid             invalid            error message'',r'                 °
  201.   '''One drawback in some applications is the indeterminate nature of'''       °
  202.   '''the result. There is another System Function that avoids that'''          °
  203. X '''problem.''' 'endd'                                                        °
  204. *(1997 6 28 11 23 27 448)                                                      °
  205.  FTEACH2 ÉFX 'TEACH2;A;B;C;RC;ET;R' 'Σ Execute controlled'                     °
  206.   '''EXECUTE CONTROLLED (ÉEC)'',r'                                             °
  207.   '''The EXECUTE CONTOLLED is a monadic System Function. The right'''          °
  208.   '''argument is the expression (a character string)  to be tested.'''         °
  209.   '''The function returns a nested three element vector:'',r'                  °
  210.   'show ''DISPLAY ÉEC ''''∞4'''''' ''DISPLAY ÉEC ''''A╜2 2µ∞4'''''''           °
  211.   '''The expression in the right argument is evaluated, but the result i       °
  212.  s'''                                                                          °
  213.   '''a three element nested vector. Note, however, that the result is in       °
  214.  '''                                                                           °
  215.   '''the third element of the vector. If we were to assign the three'''        °
  216.   '''components of the result to three variables,'',r'                         °
  217.   'show ''(RC ET R)╜ÉEC ''''∞4'''''' ''R'''                                    °
  218.   '''then we can retrieve this result.''' 'do'                                 °
  219.   '''The next two examples show what happens if the right argument is no       °
  220.  t''' '''a valid APL2 expression'',r'                                          °
  221.   'show ''DISPLAY ÉEC ''''∞∞'''''' ''DISPLAY ÉEC '''')WSID'''''''              °
  222.   '''The third element of the result contains an Error Message (EM).'''        °
  223.   'do'                                                                         °
  224.   '''When the Execute Alternate is used, all three elements of the resul       °
  225.  t'''                                                                          °
  226.   '''should be inspected before a decision can be made on the nature of'       °
  227.  ''                                                                            °
  228.   '''the evaluation of the right argument. We will now look at the three       °
  229.  ''' '''components of the result.''' 'do'                                      °
  230.   '''The first element is called the RETURN CODE. It is a scalar integer       °
  231.  ''' '''with the following meanings'',r' '''Return code  Meaning'''            °
  232.   '''     0       Expression is not executable'''                              °
  233.   '''     1       Expression produces a result'''                              °
  234.   '''     2       Result assigned to a variable'''                             °
  235.   '''     3       Expression with no result (niladic)'''                       °
  236.   '''     4       Branch to an expression (may be empty)'''                    °
  237.   '''     5       ╕ (exit from root function)'',r'                             °
  238.   '''Code 5 means that the current stack of suspended functions is to be       °
  239.  '''                                                                           °
  240.   '''cleared. If this statement is not clear, it is because we have yet'       °
  241.  '' '''to discuss this aspect of APL2.''' 'do'                                 °
  242.   '''The second component of the result of ÉEC is called the EVENT TYPE.       °
  243.  '''                                                                           °
  244.   '''We will summarize the meaning of these two integers to the extent t       °
  245. Xhat''' '''these are supported by APL2.''' 'endd'                              °
  246. *(1997 6 28 12 12 6 324)                                                       °
  247.  FTEACH3 ÉFX 'TEACH3;R;FOO' 'Σ Event Type' '''EVENT TYPE (ÉET)'',r'            °
  248.   '''The Event Type is a system variable. It is a two element integer'''       °
  249.   '''vector with default value of (0 0). The contents of ÉET describe'''       °
  250.   '''the nature of the current evaluation of an APL2 expression. The'''        °
  251.   '''first integer is a code that describes the Major class of error'',r       °
  252.  ' '''1╙ÉET   CONTENTS''' '''²²²²²   ²²²²²²²²''' '''  0     Defaults'''        °
  253.   '''  1     Resource Errors''' '''  2     SYNTAX ERRORS'''                    °
  254.   '''  3     VALUE ERRORS''' '''  4     Implicit argument errors'''            °
  255.   '''  5     Explicit Argument Errors''' 'do'                                  °
  256.   '''The second element of ÉET describes in more detail the nature of'''       °
  257.   '''that error:'',r' '''DEFAULTS CLASS (0)'''                                 °
  258.   '''0 0  No error (default value)''' '''0 1  Unclassified error'''            °
  259.   'do' '''RESOURCE ERRORS (1)''' '''1 1  INTERRUPT'''                          °
  260.   '''1 2  SYSTEM ERROR''' '''1 3  WS FULL'''                                   °
  261.   '''1 4  thru 1 12 SYSTEM LIMIT (system limitations exceeded)'',r'            °
  262.   'do' '''SYNTAX ERRORS (2)'''                                                 °
  263.   '''2 1  Required operand or right argument omitted (2⌡)'''                   °
  264.   '''2 2  Ill-formed line ([(])''' '''2 3  Name class (2╜3)'''                 °
  265.   '''2 4  Invalid operation in context ((A╜B)╜2)'''                            °
  266.   '''2 5  Compatibility setting prohibits this syntax'',r'                     °
  267.   'show ''2πÉEC ''''2⌡'''''' ''2πÉEC ''''(∞4)[(]'''''' ''2πÉEC ''''3╜2''       °
  268.  ''''' '''VALUE ERRORS (3)''' '''3 1  Name with no value'''                    °
  269.   '''3 2  Function with no result'',r'                                         °
  270.   'show ''2πÉEC '''')SAVE'''''' ''R╜ÉFX ''''FOO;A'''' ''''A╜5'''''' ''2π       °
  271.  ÉEC ''''A╜FOO''''''' '''IMPLICIT ARGUMENT ERRORS (4)'''                       °
  272.   '''4 1  ÉPP      4 3  ÉCT      4 5  ÉRL'''                                   °
  273.   '''4 2  ÉIO      4 4  ÉFC      4 7  ÉPR'',r'                                 °
  274.   'show ''R╜ÉFX ''''U╜FOO;ÉPP'''' ''''U╜2πÉEC ''''''''É╜∞5''''''''''''''       °
  275.   ''FOO''' '''EXPLICIT ARGUMENT ERRORS (5)'''                                  °
  276.   '''5 1  VALENCE ERROR     5 4  DOMAIN ERROR'''                               °
  277.   '''5 2  RANK ERROR        5 5  INDEX ERROR'''                                °
  278.   '''5 3  LENGTH ERROR      5 6  AXIS ERROR'',r'                               °
  279.   'show ''2πÉEC ''''(∞4)[2;]'''''' ''2πÉEC ''''∞3.2'''''''                     °
  280.   '''Detection and classification of errors can be used effectively in''       °
  281.  ' '''the development of tutorials aimed at teaching APL2.'',r'                °
  282.   '''We will discuss these events and how they can be used in more detai       °
  283.  l''' '''when we cover the subject of STACKS in a later lesson.'''             °
  284. X 'endd'                                                                       °
  285. *(1997 9 7 13 14 35 380)                                                       °
  286.  FTEACH4 ÉFX 'TEACH4;FOO;T' 'Σ Error Messages' '''ERROR MESSAGES'',r'          °
  287.   '''Whenever APL2 attempts to evaluate an APL2 expression, but fails,''       °
  288.  ' '''an error message is displayed on the screen. We have already'''          °
  289.   '''mentioned in lesson 2 the way such errors are handled in these'''         °
  290.   '''tutorials. Here we will summarize briefly the principal types of'''       °
  291.   '''errors that one is likely to encounter with routine APL2 usage.'''        °
  292.   'do'                                                                         °
  293.   '''Although there are many error types, we will now describe only the'       °
  294.  ''                                                                            °
  295.   '''following:'',r,r,'' AXIS ERROR'',r,'' DOMAIN ERROR'',r,'' INDEX ERR       °
  296.  OR'''                                                                         °
  297.   ''' LENGTH ERROR'',r,'' RANK ERROR'',r,'' SYNTAX ERROR'',r,'' VALUE ER       °
  298.  ROR''' ''' WS FULL or SYSTEM LIMIT''' 'do'                                    °
  299.   '''Whenever the APL2 interpreter detects an invalid expression, it'''        °
  300.   '''generates a character array called the Event Message. This array'''       °
  301.   '''is stored in the System Variable ÉEM. If an error occurs, the'''          °
  302.   '''contents of ÉEM are displayed on the screen (unless the display is'       °
  303.  '' '''suppressed with a System Function such as ÉEA or ÉEC.)'',r'             °
  304.   'show ''T╜ÉEM'' ''∞∞'' ''DISPLAY ÉEM'' ''µÉEM'''                             °
  305.   '''The default value of ÉEM is an empty array'',r'                           °
  306.   'show ''DISPLAY T'''                                                         °
  307.   '''The error message array contains three rows. The first row describe       °
  308.  s'''                                                                          °
  309.   '''the nature of the error. The second row reproduces the invalid'''         °
  310.   '''expression causing the ERROR INTERRUPT, and the third row contains        °
  311.  a'''                                                                          °
  312.   '''caret (^) to indicate the place where the error was detected.'',r'        °
  313.   '''We will now describe the most common error messages.''' 'do'              °
  314.   '''An AXIS ERROR ocurrs if the APL2 expression calls for an axis'''          °
  315.   '''specification that is incompatible with the data'',r'                     °
  316.   '1 show ''+/[2]∞5'''                                                         °
  317.   '''A DOMAIN ERROR may be produced by a variety of conditions. The most       °
  318.  '''                                                                           °
  319.   '''common cause is if the data is incompatible with the function'',r'        °
  320.   'show ''⌡/''''ABC'''''''                                                     °
  321.   '''If indexing (including pick) calls for non existent data, then'''         °
  322.   '''an INDEX ERROR will be returned'',r' 'show ''(∞6)[10]'''                  °
  323.   '''A LENGTH ERROR will ocurr if in a dyadic function the lengths'''          °
  324.   '''of the arguments are incompatible'',r' 'show ''2 4÷3 5 7'''               °
  325.   '''Whenever a dyadic function calls for arguments with incompatible'''       °
  326.   '''ranks, a RANK ERROR will be returned'',r' 'show ''2 4+2 2µ∞4'''           °
  327.   '''If the APL2 expression does not follow the rules of APL syntax,'''        °
  328.   '''a SYNTAX error will be displayed'',r' 'show ''∞∞'''                       °
  329.   '''A VALUE ERROR will be returned if an expression calls for an undefi       °
  330.  ned''' '''APL2 object'',r' 'show ''+/anything'''                              °
  331.   '''There may be situations where all of the space reserved for APL2 in       °
  332.   a'''                                                                         °
  333.   '''workspace is exhausted. (This may happen if an excessively large ar       °
  334.  ray'''                                                                        °
  335.   '''is generated, or if a recursive function fails to terminate) In mos       °
  336.  t'''                                                                          °
  337.   '''such cases then either WS FULL or SYSTEM LIMIT will be displayed'',       °
  338. Xr' 'show ''10 20 30 40 50µ∞25''' 'endd'                                       °
  339. *(1997 6 30 12 48 16 516)                                                      °
  340.  FTEACH5 ÉFX 'TEACH5;FN;EVAL;T'                                                °
  341.   'Σ Using ÉEC to extend the syntax of APL2'                                   °
  342.   'T╜ÉFX ''EVAL W'' ''''''EVAL IS STILL UNDEFINED'''''''                       °
  343.   '''To illustrate the potential of ÉEC, let us assume we wish to extend       °
  344.   the'''                                                                       °
  345.   '''syntax of APL2. Recall that in lesson 3 we studied DIRECT DEFINITIO       °
  346.  NS.'''                                                                        °
  347.   '''Although not supported by APL2, direct definition is frequently use       °
  348.  d'''                                                                          °
  349.   '''in APL literature because of its compact syntax. Here we will borro       °
  350.  w'''                                                                          °
  351.   '''this syntax to study a possible extension to APL2. In the condition       °
  352.  al'''                                                                         °
  353.   '''direct definition we saw the following syntactic construct'',r'           °
  354.   '''    label:expression1:expression2:expression3'',r'                        °
  355.   '''The label became the name of a user defined function with result.''       °
  356.  '                                                                             °
  357.   '''Whenever this defined function was invoked, the middle expression''       °
  358.  ' '''(expression2) was evaluated first. If the result was a 1, then'''        °
  359.   '''expression3 was evaluated. If the result was 0, then expression1'''       °
  360.   '''was evaluated.''' 'do'                                                    °
  361.   '''Let us assume that we wish to extend APL2 syntax in the following''       °
  362.  '                                                                             °
  363.   '''way. If an expression contains at least 3 colons, it will be assume       °
  364.  d'''                                                                          °
  365.   '''to be a conditional expression. The syntax, and the rules for'''          °
  366.   '''evaluation will be as follows:'',r'                                       °
  367.   '''      [label╜]:exp1:exp2:exp3'',r'                                        °
  368.   ''' 1. If exp2 returns a 1 then the expression to the right will be'''       °
  369.   '''    evaluated'''                                                          °
  370.   ''' 2. If exp2 returns ANYTHING ELSE (including error message) then'''       °
  371.   '''    exp1 will be evaluated''' ''' 3. Expressions of the form'''           °
  372.   '''     label╜:exp1:exp2:exp3'''                                             °
  373.   '''    will be acceptable, but require that the leftmost and rightmost       °
  374.  ''' '''    expressions produce a result.'''                                   °
  375.   ''' 4. Conditional expressions cannot be nested (i.e. the component'''       °
  376.   '''    expressions cannot contain colons)'',r' 'do'                          °
  377.   '''We begin by defining the niladic driver function NEW'',r'                 °
  378.   'show ''FN╜''''NEW;C╢;E╢;R╢;T╢'''' ''''Σ Driver to experimental extens       °
  379.  ion to APL2'''''''                                                            °
  380.   'show ''FN╜FN,Γ''''L0:æ╜''''''''      '''''''' ╪ T╢╜æ ╪ T╢╜(+/^\T╢='''       °
  381.  ''''' '''''''')╟T╢''''''' 'show ''FN╜FN,Γ''''(C╢ E╢ R╢)╜ÉEC T╢'''''''         °
  382.   '''The first expression simulates the APL2 prompt. Then the expression       °
  383.  '''                                                                           °
  384.   '''entered at the keyboard with leading blanks removed is evaluated'''       °
  385.   '''using ÉEC'',r'                                                            °
  386.   'show ''FN╜FN,''''╕(T╢╧'''''''''''''''')/L0'''' ''''╕(C╢ε4 5)/0'''''''       °
  387.   '''If keyboard entry is merely Enter, return to the APL2 prompt. Else'       °
  388.  '' '''if the entry is a branch (╕) exit from NEW'',r'                         °
  389.   'show ''FN╜FN,Γ''''╕(C╢ε2 3)/L0 ╪ ╕(C╢⌠1)/L1 ╪ R╢ ╪ ╕L0'''''''               °
  390.   '''If the evaluation is an assignment, or a function producing no'''         °
  391.   '''result, return to the prompt. Else if the expression does produce''       °
  392.  ' '''a result, display that result'',r'                                       °
  393.   'show ''FN╜FN,Γ''''L1:╕(3>µT╢╜(T╢⌠'''''''':'''''''')ΓT╢)/L2 ╪ EVAL T╢        °
  394.  ╪ ╕L0''''''' 'show ''T╜ÉFX FN,Γ''''L2:R╢ ╪ ╕L0'''''''                         °
  395.   '''If the expression contains at least 3 colons, NEW assumes it to be        °
  396.  a'''                                                                          °
  397.   '''conditional expression. The local variable T╢ is converted to a nes       °
  398.  ted'''                                                                        °
  399.   '''vector (with the colons removed). This vector is then entered as th       °
  400.  e'''                                                                          °
  401.   '''right argument to EVAL. In the last line the contents of R╢ is'''         °
  402.   '''returned, and the function returns to the prompt. We will provision       °
  403.  ally''' '''define EVAL to produce a message only'''                           °
  404.   '1 showfn ''EVAL''' 'do'                                                     °
  405.   '''At the next prompt, enter valid (or invalid) expressions, including       °
  406.  '''                                                                           °
  407.   '''strings of the form '''':xxx:xxx:xxx''''. TO EXIT from NEW, ENTER ╕       °
  408.  '',r' 'show ''NEW'''                                                          °
  409.   '''Function NEW is transparent to all valid APL2 expressions, but give       °
  410.  s'''                                                                          °
  411.   '''an error message to SYSTEM COMMANDS and all expressions not contain       °
  412.  ing'''                                                                        °
  413.   '''three or more colons. Now we are ready to define function EVAL.'''        °
  414. X 'endd'                                                                       °
  415. *(1997 7 1 11 50 35 484)                                                       °
  416.  FTEACH6 ÉFX 'TEACH6;FN;T;A;B'                                                 °
  417.   'Σ Define EVAL; function to evaluate conditional expressions'                °
  418.   '''We are now ready to define function EVAL. We begin with the header'       °
  419.  '' '''and the comment line'',r'                                               °
  420.   'show ''FN╜''''EVAL w╢;a╢;c╢;u╢;e╢;r╢'''' ''''Σ Evaluate extensions to       °
  421.   APL2'''''''                                                                  °
  422.   '''Function EVAL does not produce a result, since any and all results'       °
  423.  ''                                                                            °
  424.   '''will be displayed as SIDE EFFECTS. We use lower case letters and ╢        °
  425.  to'''                                                                         °
  426.   '''name local variables to minimize chance of conflict with global nam       °
  427.  es'',r'                                                                       °
  428.   'show ''FN╜FN,Γ''''u╢╜''''''''╜''''''''=²1╞a╢╜╞w╢ ╪ w╢╜u╢╟w╢ ╪ (c╢ e╢        °
  429.  r╢)╜ÉEC 2πw╢'''''''                                                           °
  430.   '''First we must test if the first element of the nested right argumen       °
  431.  t'''                                                                          °
  432.   '''vector is an assignment. If it is, it is stored in a╢ and removed f       °
  433.  rom''' '''w╢. Then we apply ÉEC to the second element of w╢'',r'              °
  434.   'show ''FN╜FN,Γ''''╕(1⌠r╢)/L0 ╪ r╢╜3πÉEC 3πw╢ ╪ ╕L1'''''''                   °
  435.   '''If the result of evaluating the second element is a 1, then evaluat       °
  436.  e''' '''the third expression of w╢ and branch to L1'',r'                      °
  437.   'show ''FN╜FN,Γ''''L0: r╢╜3πÉEC ╞w╢'''''''                                   °
  438.   '''Else evaluate the first expression of w╢.'',r'                            °
  439.   'show ''T╜FN╜FN,Γ''''L1:╕(''''''''╜''''''''⌠²1╞a╢)/L2 ╪ 3πÉEC a╢,'''''       °
  440.  '''r╢'''''''' ╪ ╕0''''''' 'show ''T╜ÉFX FN,Γ''''L2:r╢'''''''                  °
  441.   '''The last two lines of EVAL tests for the assignment symbol ╜ in a╢.       °
  442.   If'''                                                                        °
  443.   '''it is absent, the function shows the result r╢. If it is present, t       °
  444.  he'''                                                                         °
  445.   '''last expression to be evaluated will be stored in the assigned labe       °
  446.  l.''' 'do'                                                                    °
  447.   '''Before we try out this function, let us look at the EXECUTE CONTLOL       °
  448.  ED'''                                                                         °
  449.   '''System function when its argument is a character string containing'       °
  450.  '' '''APL2 expressions separated by the diamond.'',r'                         °
  451.   'show ''3πÉEC ''''∞3 ╪ ∞4'''''' ''DISPLAY 3πÉEC ''''∞3 ╪ ∞4'''''''           °
  452.   'show ''T╜3πÉEC ''''∞3 ╪ ∞4'''''' ''DISPLAY T'''                             °
  453.   '''In the first example both expressions are displayed AS THEY ARE EXE       °
  454.  CUTED.'''                                                                     °
  455.   '''In the second example, only the second expression is returned by ÉE       °
  456.  C.'''                                                                         °
  457.   '''In the third example ÉEC saves only the result of the second expres       °
  458.  sion.''' 'do' '''Let us now test function EVAL'',r'                           °
  459.   'show ''EVAL ''''∞3 ╪ ∞4'''' ''''3<4'''' ''''∞5 ╪ ∞6'''''''                  °
  460.   'show ''EVAL ''''T╜'''' ''''A╜∞3 ╪ B╜∞4'''' ''''3>4'''' ''''∞5 ╪ ∞6'''       °
  461.  ''' ''DISPLAY A B T'''                                                        °
  462.   '''Note how the side effects behave on variables A, B and T'''               °
  463.   '╕(0=ÉNC ''NEW'')/L'                                                         °
  464.   '''Now try the experimental conditional expressions under function NEW       °
  465.  ''' '''REMEMBER! To exit NEW enter the escape arrow ╕'',r'                    °
  466. X 'show ''NEW''' 'L:endd'                                                      °
  467. *(1997 7 13 12 28 49 504)                                                      °
  468.  Faddquote ÉFX 'u╜addquote w'                                                  °
  469.   'Σ Put quotes around a string, and double existing quotes'                   °
  470. X 'u╜ÉAV[40],((1+w=ÉAV[40])/w),ÉAV[40]'                                        °
  471. *(1997 7 24 13 20 38 476)                                                      °
  472.  Fav ÉFX 'av;A;N;I;ÉIO' 'Σ Display characters in ÉAV' 'ÉIO╜0'                  °
  473.   'A╜22 78µ'' ''' 'N╜3 0«φ12 22µ1+∞356' 'A[;,(6⌡∞12)°.+2 3 4]╜N'               °
  474.   'A[;6+6⌡∞12]╜φ12 22µÉAV' 'ΣA[8 10 13;6]╜'' ''' 'A[13;6]╜'' '''               °
  475. X 'A[14+∞8;68 69 70 72]╜'' ''' 'A'                                             °
  476. *(1991 11 11 8 25 13 316)                                                      °
  477.  Fdate ÉFX 'u╜date w' 'Σ Format date and time of day' 'u╜«6╞w'                 °
  478. X 'u╜('' ''⌠u)Γu' 'u╜εu,■''-- .. '''                                           °
  479. XCdig 1 10 1234567890                                                          °
  480. *(1997 9 9 13 0 45 372)                                                        °
  481.  Fdisclaimer ÉFX 'disclaimer' 'Σ Copyright statement'                          °
  482.   '(10µ'' ''),''Copyright, Z. V. Jizba, 1995,1996,1997'',r'                    °
  483.   ''' This and subsequent workspaces labelled TEACHxx are made available       °
  484.  '''                                                                           °
  485.   '''at no cost to anyone who desires to learn how to use effectively'''       °
  486.   '''the IBM/OS2 version of APL2.'',r'                                         °
  487.   '''This software is provided "AS IS" with no WARRANTY of any kind, eit       °
  488.  her'''                                                                        °
  489.   '''express or implied. Any risk in its use resides with you, the user        °
  490.  of''' '''these tutorials.'',r' '''     ACKNOWLEDGEMENTS'',r'                  °
  491.   ''' In writing these tutorials, I am greatly indebted to Roy Sykes, wh       °
  492.  ose'''                                                                        °
  493.   '''excellent lectures increased my understanding of the language.'''         °
  494.   '''Discussions with the late Harry Bertucelli clarified a number of'''       °
  495.   '''concepts and caused me to change some improper terminology that was       °
  496.  '''                                                                           °
  497.   '''used in previous versions of these tutorials. Mr. Benjamin Archer''       °
  498.  '                                                                             °
  499.   '''kindly checked out a nearly final version, bringing to my attention       °
  500.  ''' '''some ommisions, misspellings, and invalid terminology.'',r'            °
  501. X '''(PRESS ENTER to continue)'''                                              °
  502. *(1997 7 13 12 28 50 508)                                                      °
  503.  Fdo ÉFX 'do;T;E' 'Σ Expression driver' 'E╜''''' 'æ╜''      ''' 'T╜æ'          °
  504.   '╕(^/'' ''=T)/0'                                                             °
  505.   '╕(('':''εT)doif ''B╜evaldd (+/^\'''' ''''=T)╟T'')/2'                        °
  506.   '''E╜ÉEM'' ÉEA T' '╕(0=µ,E)/2'                                               °
  507.   '''This is not a valid APL2 expression''' 'æ╜''*''' '╕(''?''⌠╞1╟æ)/2'        °
  508. X 'E' '╕2'                                                                     °
  509. *(1997 7 13 12 28 50 508)                                                      °
  510.  Fdoif ÉFX 'U╢╜V╢ doif W╢;t╢' 'Σ Rule' '╕(^/~U╢╜V╢)/0'                         °
  511. X '''U╢╜V╢ doif■ W╢'' ÉEA ''»V╢/W╢'''                                          °
  512. *(1997 9 9 12 50 14 444)                                                       °
  513.  Fendd ÉFX 'endd' 'Σ end of special feature' '20µ''²'' ╪ ╕(4<µÉLC)/0'          °
  514. X 'do'                                                                         °
  515. *(1997 8 17 11 47 41 564)                                                      °
  516.  Ferase ÉFX 'erase;t;EXIT;GO;HELP;DISPLAY;BIND;REVIEW;RULE;DISCLAIMER'         °
  517.   'Σ Erase all global functions and variables' 't╜ÉNL 3'                       °
  518.   't╜(~t^.εlc,'' '')≡t' 't╜ÉEX(~t[;∞5]^.=''TEACH'')≡t' 't╜ÉNL 2'               °
  519. X 't╜ÉEX(~t^.εlc,'' '')≡t' 't╜ÉNL 4' 't╜ÉEX(~t^.εlc,'' '')≡t'                  °
  520. *(1997 7 27 13 47 41 608)                                                      °
  521.  Fevaldd ÉFX 'u╜evaldd w;c;n' 'Σ Evaluate direct definition' 'u╜0'             °
  522.   'n╜(w∞''Σ'')-1' 'c╜(((n╞w)⌠'':'')Γn╞w),Γ''ΣDD '',(n+1)╟w'                    °
  523.   '╕((1 label╞c)doif ''''''Invalid label'''''')/0'                             °
  524.   '╕((2=µc)doif ''u╜showdd 1╙c'')/0'                                           °
  525.   '╕((3=ÉNC╞c)doif ''u╜⌡µÉ╜(╞c),'''' is already defined.'''''')/0'             °
  526.   '╕((3=µc)doif ''u╜simdd c'')/0' 'c╜(Γ''α∙ aw'')replace■c'                    °
  527.   'u╜ε''u╜'',((''a''εεc[2 3 4])/''a ''),(╞c),'' w;t;b'''                       °
  528.   'u╜u(5πc)(''b╜(t╜'',(3πc),'')/'',addquote ''u╜'',4πc)'                       °
  529. X 'u╜u,''╕(t doif b)/0''(''u╜'',2πc)' 'u╜╧ÉFX u'                               °
  530. *(1997 7 25 13 27 52 564)                                                      °
  531.  Fexit ÉFX 'V exit W;T' 'Σ Exit if too many suspended functions'               °
  532.   '╕(0⌠ÉNC ''V'')/L0 ╪ V╜10' 'L0:╕(V>µÉLC)/0'                                  °
  533.   '''There are too many suspended functions''' '''Please enter '',W'           °
  534. X '╕'                                                                          °
  535. *(1997 7 26 12 33 39 536)                                                      °
  536.  Fget ÉFX 'U╜V get W;t;T;ÉPR' 'Σ Prompt for response from keyboard'            °
  537.   'ÉPR╜T╜ÉAV[ÉIO+255] ╪ ╕(0⌠ÉNC ''V'')/L0 ╪ V╜1' 'L0:V╜V╧1' 'æ╜W ╪ t╜æ'        °
  538.   'U╜(+/^\t=T)╟t' '╕(''╕''⌠╞U)/L1 ╪ ╕' 'L1:╕V/0' 't╜(U⌠'' '')ΓU'               °
  539. X 'U╜(µt),(ΓU),t'                                                              °
  540. *(1997 7 28 13 33 8 424)                                                       °
  541.  Fglobals ÉFX 'globals' 'Σ Initialize useful global variables'                 °
  542.   'uc╜''ABCDEFGHIJKLMNOPQRSTUVWXYZ'''                                          °
  543.   'lc╜''abcdefghijklmnopqrstuvwxyz''' 'dig╜''1234567890'''                     °
  544. X 'r╜ÉAV[13+ÉIO]' 'q╜'''''''''                                                 °
  545. *(1997 7 3 12 47 6 368)                                                        °
  546.  Finitialize ÉFX 'initialize;T' 'Σ Initialize workspace'                       °
  547.   '''AT ALL TIMES, TO CONTINUE, PRESS RETURN!'',r'                             °
  548.   '''To see disclaimers enter:'',r,''    disclaimer''' 'do' 'erase'            °
  549.   'globals'                                                                    °
  550.   '''Make sure the CAP LOCK light on your keyboard (upper right) is ON!'       °
  551. X'' 'endd'                                                                     °
  552. *(1997 7 27 13 14 33 444)                                                      °
  553.  Flabel ÉFX 'u╜v label w'                                                      °
  554.   'Σ Return 1 if label w does not begin with a cap'                            °
  555.   '╕(0⌠ÉNC ''v'')/L0 ╪ v╜0' 'L0:v╜v╧1 ╪ w╜εw ╪ ╕v/L1 ╪ ╕(u╜0⌠ÉNC w)/0'         °
  556. X 'L1:╕(u╜~^/wεlc,uc,dig)/0' 'u╜w[1]εlc,dig'                                   °
  557. XClc 1 26 abcdefghijklmnopqrstuvwxyz                                           °
  558. *(1997 7 13 12 28 55 528)                                                      °
  559.  Fnon ÉFX 'non;T;RC;ET;R' 'Σ Ignore keyboard entry' 'æ╜''      ''' 'T╜æ'       °
  560.   '╕(0=µ(T⌠'' '')/T)/0' '(RC ET R)╜ÉEC T' '╕(0=RC)/2'                          °
  561. X '╕((1=RC)doif ''R'')/2' '╕2'                                                 °
  562. *(1997 7 13 12 28 55 528)                                                      °
  563.  Fnotb ÉFX 'u╜notb w' 'Σ Remove trailing blanks'                               °
  564.   '╕((1<╧w)doif ''u╜notb■ w'')/0' '╕((1<µµw)doif ''u╜πnotb Γ[2]w'')/0'         °
  565. X 'u╜(1-(,'' ''⌠Φw)∞1)╟w'                                                      °
  566. *(1997 7 27 12 55 6 496)                                                       °
  567.  Fproblems ÉFX 'problems' 'Σ Problems'                                         °
  568.   '''That is all for this lesson. Remember, if you want to practice,'''        °
  569.   '''and plan to use direct definitions, be sure to first enter GO.'''         °
  570.   '''Direct definitions will then be accepted. To exit GO, enter EXIT.''       °
  571.  ,r'                                                                           °
  572.   '''To erase a previously defined DIRECT DEFINITION FUNCTION, enter'',r       °
  573.  ' '''       )ERASE functionname'',r'                                          °
  574. X '''WARNING! do not use )ERASE on other labels.'',r'                          °
  575. XCq 0 '                                                                        °
  576. XCr 0                                                                         °
  577. *(1997 7 13 12 28 56 532)                                                      °
  578.  Freplace ÉFX 'u╜v replace u;i;r;s' 'Σ Replace elements in v in u'             °
  579.   'i╜Γ∞µu' 's╜2πv╜(v⌠'' '')Γv' 'i╜⌡r╜i⌡■Γ[1]u°.=╞v'                            °
  580. X 'u[(εi)/εr]╜s[(εi)/εi⌡■∞µs]'                                                 °
  581. *(1997 7 13 12 28 56 532)                                                      °
  582.  Fround ÉFX 'U╜V round W' 'Σ Half adjust to V th decimal'                      °
  583. X 'U╜(╛0.5+W⌡10*V)÷10*V'                                                       °
  584. *(1997 7 13 12 28 57 536)                                                      °
  585.  Fshow ÉFX '╢V show ╢W;╢T;╢B' 'Σ Display and execute ╢W'                       °
  586.   '╢T╜(0=ÉNC ''╢V'')doif ''╢V╜0'''                                             °
  587.   '╕((0=╧╢W)doif ''show ╢W,'''' '''''')/0'                                     °
  588.   '╕((1<╧╢W)doif ''╢V show ■╢W'')/0' '''      '',╢W'                           °
  589. X '╕((╢V^'':''ε╢W)doif ''╢T╜evaldd ╢W'')/L0' '''ÉEM'' ÉEA ╢W' 'L0:do'          °
  590. *(1997 7 13 12 28 57 536)                                                      °
  591.  Fshowdd ÉFX 'u╜showdd w;a;b;c;r'                                              °
  592.   'Σ Display a direct definition function'                                     °
  593.   '╕((1=╧w)doif ''u╜showdd Γw'')/u╜0'                                          °
  594.   '╕((3⌠ÉNC╞w)doif ''(ε╞w),'''' is not a function'''''')/0'                    °
  595.   'c╜Γ[2]ÉCR╞w' 'c╜notb(2╞c),(Γ''aw α∙'')replace■2╟c'                          °
  596.   '╕((~''ΣDD''╧3╞2πc)doif ''''''Not a direct definition function'''''')/       °
  597.  0' 'u╜1' 'b╜('' ''⌠╞c)Γ╞c' 'a╜''      ''' 'r╜2╟3πc'                           °
  598.   '╕((3=µc)doif ''a,(╞w),'''':'''',r,(3<µ2πc)/''''   Σ'''',3╟2πc'')/0'         °
  599.   'a╜a,(╞w),'':'',(2╟5πc),'':''' 'b╜(+\r=''('')-+\r='')''' 'b╜b∞0'             °
  600. X 'a╜a,(²3╟(b-1)╞3╟r),'':'',2╟»(b+2)╟r' 'a,(3<µ2πc)/''  Σ'',3╟2πc'             °
  601. *(1997 7 13 12 28 57 536)                                                      °
  602.  Fshowfn ÉFX 'U╜V showfn W;F;N;T;ÉIO' 'Σ Simulate ╖W[É]'                       °
  603.   'T╜(0=ÉNC ''V'')doif ''V╜0''' 'ÉIO╜0'                                        °
  604.   'U╜r,''      '',''╖'',W,''[É]'',(╞V)╞''╖''' 'N╜1╞µF╜ÉCR W' 'N╜«∞N'           °
  605.   'N╜(N⌠'' '')ΓN' 'F╜(π''['',■N,■Γ''] ''),F'                                   °
  606.   'T╜(1<µ,V)doif ''F╜F[1╟V;]'' ''U╜''''''''''' 'U╜²1╟U,r,,F,r'                 °
  607. X 'U╜((-+/^\'' ''=ΦU)╟U),('' ╖'')[╞V],r'                                       °
  608. *(1997 7 13 12 28 58 540)                                                      °
  609.  Fsimdd ÉFX 'u╜simdd w;e' 'Σ Direct definition mode' 'u╜0'                     °
  610.   '╕((0⌠ÉNC╞w)doif ''''''Already defined'''''')/0' 'e╜''α''ε2πw'               °
  611.   'w[2]╜Γ''u╜'',''α∙ aw'' replace 2πw' 'w╜w[1 3 2]'                            °
  612. X 'w[1]╜Γε''u╜'',(e/''a ''),w[1],'' w''' 'u╜╧ÉFX w'                            °
  613. *(1992 6 3 9 59 17 424)                                                        °
  614.  Ftab ÉFX 'U╜V tab W;T;A;B;C;D;E;F;G;M;ÉPW' 'Σ Tabulate list W'                °
  615.   'T╜(0=ÉNC ''V'')doif ''V╜0''' 'M╜''Invalid data for tabulation'''            °
  616.   'V╜4╞V' 'ÉPW╜130╛30⌐G╜V[2]+79⌡V[2]=0'                                        °
  617.   'L1:╕((1<╧W)doif ''''''W╜∞0'''' ÉEA ''''W╜πW'''''')/L1'                      °
  618.   '╕(((0=µεW)δ2<µµW)doif ''U╜(~V╧4╞0)/M'')/0'                                  °
  619.   'T╜(1≥µµU╜«W)doif ''U╜πW╜(U⌠'''' '''')ΓU'''                                  °
  620.   'T╜(0<V[1])doif ''U╜(«(Φ1,╞µW)µ(V[3]µ'''' ''''),∞(╞µW)-V[3]),'''' ''''       °
  621.  ,U''' '╕(G<30)/0' 'T╜(F╜µεV[4])+C╜1╟B╜µA╜(V[3],0)╟U'                          °
  622.   'T╜⌐(1╞B)÷1⌐╛(ÉPW+F)÷T' 'U╜(E╜(V[3],C)╞U),[1](B╜T,1╟B)╞A'                    °
  623.   '''D╜εV[4]'' ÉEA ''D╜ÉAV[εV[4]+33⌡V[4]=0]''' 'L0:A╜(T,0)╟A'                  °
  624. X '╕(0=1╞µA)/0' 'U╜U,(((T+V[3]),µD)µD),E,[1]B╞A' '╕L0'                         °
  625. *(1997 7 13 12 28 59 544)                                                      °
  626.  Ftest ÉFX 'U╜V test W;P'                                                      °
  627.   'Σ Describe problem in W, (correct answer in V)' 'U╜2' 'L1:W'                °
  628.   'É╜''      ''' 'P╜æ' '''╕L0'' ÉEA ''P╜»P''' '╕(V╧P)/0'                       °
  629. X 'L0:╕(0=U╜U-1)/0' '''Incorrect. Try again''' '╕L1'                           °
  630. XCuc 1 26 ABCDEFGHIJKLMNOPQRSTUVWXYZ                                           °
  631. *(1996 4 6 16 8 11 244)                                                        °
  632.  Fvec ÉFX 'U╜vec' 'Σ Draw 2d vector in plane'                                  °
  633.   'U╜r,r,''2-        +'',r '':      °'',r,''1-    °'',r'                       °
  634. X 'U╜U,'' :  °'',r,''0|....|....|'',r,'' 0    1    2'',r'                      °
  635.