home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / teachapl.zip / APL2OS2T.ZIP / TEACH42.ATF < prev    next >
Text File  |  1996-05-30  |  62KB  |  759 lines

  1. XNÉIO 0 1                                                                      °
  2. XNÉCT 0 1.000000000000011E²13                                                  °
  3. XCÉFC 1 6 .,*0_²                                                               °
  4. XNÉRL 0 16807                                                                  °
  5. XCÉPR 0                                                                        °
  6. XCÉLX 1 5 TEACH                                                                °
  7. *(1991 11 11 8 25 10 304)                                                      °
  8.  FDISPLAY ÉFX 'D╜S DISPLAY A;ÉIO;R;C;HL;HC;HT;HB;VL;VB;V;W;N;B'                °
  9.   'Σ DISPLAY A GENERAL ARRAY IN PICTORIAL FORM'                                °
  10.   'Σ  NORMAL CALL IS MONADIC.  DYADIC CALL USED ONLY IN'                       °
  11.   'Σ    RECURSION TO SPECIFY DISPLAY RANK, SHAPE, AND DEPTH.' 'ÉIO╜0'          °
  12.   '»(0=ÉNC ''S'')/''S╜µA''' 'R╜╞µ,S                   Σ PSEUDO RANK.'          °
  13.   'C╜''┐┌└┘''                 Σ UR, UL, LL, AND LR CORNERS.'                   °
  14.   'HL╜''─''                   Σ HORIZONTAL LINE.'                              °
  15.   'HC╜HL,''Θ╕'',HL,''~+ε''      Σ HORIZONTAL BORDERS.'                         °
  16.   'HT╜HC[(0<R)⌡1+0<╞²1╞,S]' 'ΣW╜,0╧■╞0µΓ(1⌐µA)╞A'                              °
  17.   'HB╜HC[3+3╛(''2⌡~A╧«A'' ÉEA ''1+╞ε0⌡(1⌐⌡/µA)╞,A'')+3⌡1<µµS]'                 °
  18.   'VL╜''│''                   Σ VERTICAL LINE.'                                °
  19.   'VB╜VL,''Φ╟''               Σ VERTICAL BORDER.'                              °
  20.   'V╜VB[(1<R)⌡1+0<²1╞²1╟,S]'                                                   °
  21.   '»(0εµA)/''A╜(1⌐µA)µΓ╞A''   Σ SHOW PROTOTYPE OF EMPTIES.'                    °
  22.   '╕(1<╧A)/GEN' '╕(2<µµA)/D3'                                                  °
  23.   'D╜«A                     Σ SIMPLE ARRAYS.' 'W╜1╞µD╜(²2╞1 1,µD)µD'           °
  24.   'N╜²1+1╟µD' '╕(0=µµA)/SS'                                                    °
  25.   'D╜(C[1],V,((W-1)µVL),C[2]),((HT,NµHL),[0]D,[0]HB,NµHL),C[0],(WµVL),C[       °
  26.  3]' '╕0' 'SS:HB╜((0 '' '')=╞0µΓA)/'' -'''                                     °
  27.   'D╜'' '',('' '',[0]D,[0]HB,Nµ'' ''),'' ''' '╕0'                              °
  28.   'GEN:D╜«DISPLAY■A          Σ ENCLOSED ...' 'N╜Dδ.⌠'' '''                     °
  29.   'D╜(Nδ~1ΦN)≡D' 'D╜(δ≡~''  ''╤D)/D' 'D╜((1,µS)µS)DISPLAY D'                   °
  30.   '╕(2≥µ,S)╟D3E,0' 'D3:D╜0 ²1╟0 1╟«ΓA         Σ MULT-DIMENSIONAL ...'          °
  31.   'W╜1╞µD' 'N╜²1+1╟µD'                                                         °
  32.   'D╜(C[1],V,((W-1)µVL),C[2]),((HT,NµHL),[0]D,[0]HB,NµHL),C[0],(WµVL),C[       °
  33.  3]' 'D3E:N╜²2+µ,S'                                                            °
  34. X 'V╜C[Nµ1],[0]VB[1+0<²2╟,S],[0](((²3+╞µD),N)µVL),[0]C[Nµ2]' 'D╜V,D'           °
  35. *(1991 11 11 8 25 12 312)                                                      °
  36.  FGO ÉFX 'GO;b;e;t' 'Σ Expression driver' 'L0:b╜e╜''''' 'æ╜''       '''        °
  37.   't╜æ' '╕(^/'' ''=t)/L0' '╕((^/'')OFF ''=5╞6╟t)doif ''exit'')/0'              °
  38.   '╕(('':''εt)doif ''b╜evaldd (+/^\'''' ''''=t)╟t'')/L0'                       °
  39.   '''e╜ÉEM'' ÉEA t' '╕(0=µ,e)/L0' '╕b/L0'                                      °
  40.   '''This is not a valid APL2 expression''' 'æ╜''*'''                          °
  41. X '╕(''?''⌠╞1╟æ)/L0' 'e' '╕L0'                                                 °
  42. *(1995 8 4 12 36 1 304)                                                        °
  43.  FOS2 ÉFX 'V OS2 W;OS;T' 'Σ Simulation of OS2 prompt'                          °
  44.   '╕(0⌠ÉNC ''V'')/L1 ╪ V╜''D:>'''                                              °
  45.   'L1:╕(2=100 SVOFFER ''OS'')/L2 ╪ ''Offer failed'' ╪ ╕0'                      °
  46.   'L2:╕(1≥µ(W⌠'' '')/W)/L0 ╪ OS╜W ╪ ╕0' 'L0:æ╜V' '╕(^/'' ''=T╜3╟æ)/0'          °
  47. X 'OS╜T' '╕L0'                                                                 °
  48. *(1992 12 22 11 34 8 396)                                                      °
  49.  FPROFILE ÉFX 'PROFILE;X;WS;ÉIO' 'ÉIO╜0' 'WS╜101 ÉSVO ''X'''                   °
  50.   '»(2⌠ÉSVO ''X'')/''╕0,µÉ╜''''AP101 is not active'''''''                      °
  51.   'X╜''F1 )VARS'',ÉTC[1]' 'X╜''F2 )FNS'',ÉTC[1]' 'X╜''F3 )SI'',ÉTC[1]'         °
  52.   'X╜''F4 ÉWA'',ÉTC[1]' 'X╜''F5 ╕ÉLC'',ÉTC[1]' 'X╜''F6 ╕ÉLC+1'',ÉTC[1]'        °
  53.   'X╜''F7 [É0-20]'',ÉTC[1]' 'X╜''F8 [É21-40]'',ÉTC[1]'                         °
  54.   'X╜''F9 )LOAD ''' 'X╜''F10 )SAVE'',ÉTC[1]' 'X╜''F11 )LIB 1'',ÉTC[1]'         °
  55.   'X╜''F12 )LIB 2'',ÉTC[1]' 'X╜''F17 [É41-60]'',ÉTC[1]'                        °
  56.   'X╜''F18 [É61-80]'',ÉTC[1]' 'X╜''F19 )IN ''' 'X╜''F20 )OUT '''               °
  57.   'X╜''F21 )LIB .APL'',ÉTC[1]' 'X╜''F22 )LIB .ATF'',ÉTC[1]'                    °
  58.   'X╜''F27 [É81-100]'',ÉTC[1]' 'X╜''F28 [É101-120]'',ÉTC[1]'                   °
  59.   'X╜''F30 )SAVE '''                                                           °
  60.   'X╜''L4 C:\'' Σ Definition of the root directory as a library'               °
  61.   'Σ X╜''L5 C:\APL2\WORK\''' 'Σ X╜''L6 C:\APL2\IBM\'''                         °
  62.   'Σ X╜''ST )CLEAR'',ÉTC[1]'                                                   °
  63.   'Σ ╕(1╞²2╞,(8µ2)ÿÉAV∞1 ÉPK 0 1040)/0 Σ Test for Math Co-processor'           °
  64. X 'Σ EMUL8087I Σ Initialise Math Co-processor Emulator'                        °
  65. *(1995 4 23 14 14 6 304)                                                       °
  66.  FSVOFFER ÉFX 'DC╜PID SVOFFER SV' 'SV╜(²2╞1 1,µSV)µSV╜πSV'                     °
  67.   '╕(2=ÉNC ''PID'')/DYADIC' 'DC╜ÉSVO SV ╪ ╕0'                                  °
  68.   'DYADIC:╕(1^.⌠DC╜PID ÉSVO SV)/END' 'ÉSVE╜15'                                 °
  69.   'CHECK:╕(1^.⌠DC╜ÉSVO SV)/END' '╕(0⌠ÉSVE)/CHECK'                              °
  70. X 'END:SV╜1 0 1 0 ÉSVC SV'                                                     °
  71. *(1996 4 10 14 1 43 352)                                                       °
  72.  FTEACH ÉFX 'TEACH' 'Σ Introduction to shared variables' 'copyright'           °
  73.   '''Welcome to lesson #42 of the APL2OS2 tutorial. If you have no previ       °
  74.  ous'''                                                                        °
  75.   '''experience with APL2OS2, you might begin with lesson #41 (TEACH41).       °
  76.   If'''                                                                        °
  77.   '''you are new to APL, you should begin with the workspace TEACH1. If        °
  78.  you'''                                                                        °
  79.   '''already know APL and if you use APL2/PC, the workspaces named TEACH       °
  80.  23'''                                                                         °
  81.   '''trough TEACH40 have tutorials on Auxilliary Processors supported by       °
  82.  '''                                                                           °
  83.   '''that version of APL2. This lesson deals with the subject of Auxilli       °
  84.  ary''' '''Processors that are available on APL2OS2.'',r'                      °
  85.   '''(NOTE: this and subsequent lessons will NOT work with APL2/PC!!!)''       °
  86.  ' 'do' 'initialize' 'TEACH1    Σ Introduction'                                °
  87.   'TEACH2    Σ What are Auxilliary Processors Sharing System Functions'        °
  88.   'TEACH3    Σ Connecting to an AP; ÉSVO -- IBM function SVOFFER'              °
  89.   'TEACH4    Σ ÉSVC ÉSVR ÉSVQ ÉSVS' 'TEACH5    Σ AP 100'                       °
  90.   'TEACH6    Σ Sample function using AP 100 to invoke DOS'                     °
  91.   'TEACH7    Σ ÉAP 101'                                                        °
  92.   'Σ TEACH7 is followed by function TEACHB containing:'                        °
  93. X 'Σ    TEACH8  Σ Sample function to illustrate usage of AP 101'               °
  94. *(1996 4 7 13 57 7 416)                                                        °
  95.  FTEACH1 ÉFX 'TEACH1' 'Σ What are shared variables?'                           °
  96.   '''SHARED VARIABLES'',r'                                                     °
  97.   '''To be useful in practical applications, APL2 must be able to interf       °
  98.  ace'''                                                                        °
  99.   '''with its environment. The language does not support any primitive''       °
  100.  '                                                                             °
  101.   '''functions for this purpose. There are, however System Functions tha       °
  102.  t'''                                                                          °
  103.   '''provide the necessary links. Since these are not part of the langua       °
  104.  ge,'''                                                                        °
  105.   '''there is no standard that is accepted by all vendors of APL.'''           °
  106.   'do'                                                                         °
  107.   '''IBM versions of APL support an approach called "Shared Variables".'       °
  108.  ''                                                                            °
  109.   '''The purpose of this lesson and subsequent ones is to describe this        °
  110.  way''' '''of communicating with the non-APL environment.'',r'                 °
  111.   '''In the simplest case, one merely desires to connect in some way to'       °
  112.  ''                                                                            °
  113.   '''existing non-APL files or systems (such as OS/2). In the most compl       °
  114.  ex'''                                                                         °
  115.   '''situations, one might want to communicate with another computer in        °
  116.  a'''                                                                          °
  117.   '''network, not knowing whether that computer (or for that matter anyo       °
  118.  ne'''                                                                         °
  119.   '''using that computer) is available. The concept of Shared Variables'       °
  120.  ''                                                                            °
  121.   '''was designed in the most general way, so that it can handle the mos       °
  122.  t'''                                                                          °
  123.   '''complex situations that are possible with current state of the art.       °
  124.  '',r'                                                                         °
  125.   '''A shared variable is just like an APL2 variable. Data can be assign       °
  126.  ed'''                                                                         °
  127.   '''to it. When it is invoked, data are displayed. However the variable       °
  128.  '''                                                                           °
  129.   '''is like a gate into another dimension. Data coming in or out has be       °
  130. Xen''' '''transmitted to a non-APL environment.''' 'end'                       °
  131. *(1996 4 7 13 58 40 552)                                                       °
  132.  FTEACH2 ÉFX 'TEACH2' 'Σ Shared variable offer'                                °
  133.   '''AUXILLIARY PROCESSORS'',r'                                                °
  134.   '''Connecting two different software systems could be compared to the'       °
  135.  ''                                                                            °
  136.   '''process of exchanging ambassadors between two different cultures. E       °
  137.  ach'''                                                                        °
  138.   '''culture has its own ways of dealing with all kinds of communication       °
  139.  s.'''                                                                         °
  140.   '''The embassador to be effective, must learn all the proper ways of''       °
  141.  ' '''dealing with the representatives of the host government.'',r'            °
  142.   '''In the same manner, when two distinct software systems are mated, o       °
  143.  ne'''                                                                         °
  144.   '''must be able to transform its own information into a form that will       °
  145.  '''                                                                           °
  146.   '''be understandable by the other. The mechanics of this transformatio       °
  147.  n'''                                                                          °
  148.   '''is frequently referred to as PROTOCOL. The solution that IBM produc       °
  149.  ed'''                                                                         °
  150.   '''to handle this problem involves specialized software called AUXILLI       °
  151.  ARY'''                                                                        °
  152.   '''PROCESSORS (abbreviated AP''''s). To go from APL2 to any one of the       °
  153.   many'''                                                                      °
  154.   '''non-APL systems there are specialized AP''''s that are identified b       °
  155.  y'''                                                                          °
  156.   '''numbers. For example, AP100 is the name of the Auxilliary Processor       °
  157.  '''                                                                           °
  158.   '''number 100. As we will see shortly this one connects with OS/2.'''        °
  159.   'do'                                                                         °
  160.   '''Before we study specific AP''''s, we must describe the APL2 System'       °
  161.  ''                                                                            °
  162.   '''functions that support the communication between APL2 and the outsi       °
  163.  de''' '''environment. There are six System functions:'',r'                    °
  164.   '''     Shared Variable offer (ÉSVO)'''                                      °
  165.   '''     Shared Variable Control (ÉSVC)'''                                    °
  166.   '''     Shared Variable Event (ÉSVE)'''                                      °
  167.   '''     Shared Variable Retract  (ÉSVR).'''                                  °
  168.   '''     Shared Variable Query (ÉSVQ)'''                                      °
  169. X '''     Shared Variable State (ÉSVS)''' 'end'                                °
  170. *(1995 7 28 14 6 31 404)                                                       °
  171.  FTEACH3 ÉFX 'TEACH3;UNO;DOS;TRES;svoffer;T'                                   °
  172.   'Σ Shared variable offer ÉSVO'                                               °
  173.   '''SHARED VARIABLE OFFER (SET) ÉSVO'',r' '''The invocation is:'',r'          °
  174.   '''          [APno]  ÉSVO (variable(s) name(s) in quotes)'',r'               °
  175.   '''(where the square brackets [] indicate an optional argument)'''           °
  176.   'do'                                                                         °
  177.   '''This System Function can be thought of as an ambivalent primitive.        °
  178.  The'''                                                                        °
  179.   '''left argument describes the AP(s) to be shared. The right argument        °
  180.  is a'''                                                                       °
  181.   '''list of variables that are to be used as "ambassadors" to the non-A       °
  182.  PL'''                                                                         °
  183.   '''system. When a shared variable offer is made, the process is much a       °
  184.  s'''                                                                          °
  185.   '''if making a phone call. In the first stage, the call must go throug       °
  186.  h'''                                                                          °
  187.   '''to the specified party. When this happens, ÉSVO returns a 1, meanin       °
  188.  g'''                                                                          °
  189.   '''that a tentative line connection has been made. In IBM terminology,       °
  190.  ''' '''a COUPLING of degree 1 has been achieved.''' 'do'                      °
  191.   '''To make the connection complete, APL2 must wait until the call is''       °
  192.  '                                                                             °
  193.   '''answered (someone picks up the phone at the other end). When that''       °
  194.  '                                                                             °
  195.   '''happens, the degree of coupling becomes 2, and communication may'''       °
  196.   '''begin. In the OS2 environment, the wait for this second coupling'''       °
  197.   '''may be sufficiently long so that other processing may have taken'''       °
  198.   '''place. In practice this means that there must be a way to prevent''       °
  199.  '                                                                             °
  200.   '''APL2 processing while the wait for complete coupling is still in'''       °
  201.   '''process. To illustrate how the process of connecting to an AP,'''         °
  202.   '''consider function "svoffer", which is a simplification of the IBM''       °
  203.  ' '''utility function SVOFFER supplied in workspace 1 UTILITY'''              °
  204.   'T╜''DC╜PID svoffer SV'' ''Σ Open AP PID USING SV'' ''╕(1⌠DC╜PID ÉSVO        °
  205.  SV)/0'''                                                                      °
  206.   'T╜ÉFX T,''ÉSVE╜15'' ''CHECK:╕(1⌠DC╜ÉSVO SV)/0'' ''╕(0⌠ÉSVE)/CHECK'''        °
  207.   'showfn ''svoffer''' 'do'                                                    °
  208.   '''In this sample function we assume that PID is a single integer,'''        °
  209.   '''say 100 and SV is a label, say ''''D100''''. Line [2] therefore off       °
  210.  ers'''                                                                        °
  211.   '''to share variable named SV╜''''D100'''' to Auxilliary Processor PID       °
  212.  ╜100,'''                                                                      °
  213.   '''and captures the result in DC. Normally the value returned in DC is       °
  214.   1.'''                                                                        °
  215.   '''For any other value the function will exit. Assuming now that DC=1,       °
  216.  '''                                                                           °
  217.   '''line [3] assigns a value of 15 seconds to the event clock ÉSVE.'''        °
  218.   '''               | This clock can be compared to ÉDL in the sense tha       °
  219.  t|'''                                                                         °
  220.   '''               |  it runs backwards from 15 down to 0 (while ÉDL╜15       °
  221.   |'''                                                                         °
  222.   '''               |  would run forward from 0 up to 15+).                    °
  223.   |''' 'do' 'showfn ''svoffer'''                                               °
  224.   '''During the 15 second interval, APL2 loops lines [4]and[5]. As long'       °
  225.  ''                                                                            °
  226.   '''as the monadic value of ÉSVO remains a 1, line [5] tests whether th       °
  227.  e'''                                                                          °
  228.   '''clock has run out. After either 15 seconds, or after the degree of'       °
  229. X'' '''coupling becomes 2, the function exits.''' 'do' 'TEACH3A'               °
  230. *(1996 4 7 14 0 39 320)                                                        °
  231.  FTEACH3A ÉFX 'TEACH3A' 'Σ Shared variable event ÉSVE'                         °
  232.   '''The sample function "svoffer" is not adequate for general use. The'       °
  233.  '' '''function SVOFFER in workspace 1 UTILITY provides for multiple'''        °
  234.   '''arguments. It also deals with a communication protocol called Share       °
  235.  d'''                                                                          °
  236.   '''Variable Event. Here is a listing of that function with all comment       °
  237.  s''' '''removed:''' 'showfn ''SVOFFER''' 'do'                                 °
  238.   '''The right argument contains the name of one or more shared variable       °
  239.  s.'''                                                                         °
  240.   '''The left argument may be a numeric vector of one or more Auxilliary       °
  241.  '''                                                                           °
  242.   '''Processors. The function returns the final degree of coupling for''       °
  243.  ' '''each shared variable''' 'do'                                             °
  244.   '''Line [1] converts the right argument into a rank 2 array. If there        °
  245.  is'''                                                                         °
  246.   '''no left argument, line [3] returns the degree of coupling of the ri       °
  247.  ght'''                                                                        °
  248.   '''arguments and exits. If the left argument is present, it must be a'       °
  249.  ''                                                                            °
  250.   '''scalar integer or a vector of the same length as the number of rows       °
  251.   in'''                                                                        °
  252.   '''the right argument. Line [4] establishes the initial coupling (1).        °
  253.  If'''                                                                         °
  254.   '''as expected, the coupling is 1, evaluation proceeds to line [5]. (E       °
  255.  lse'''                                                                        °
  256.   '''the branch to line[8] continues the process on the assumption that        °
  257.  the''' '''coupling is already equal to 2.)''' 'do'                            °
  258.   '''Lines [5-7] are the same as already discussed under function "svoff       °
  259. Xer".''' 'end'                                                                 °
  260. *(1996 4 13 13 34 6 344)                                                       °
  261.  FTEACH4 ÉFX 'TEACH4;T;TEST;D100'                                              °
  262.   'Σ Shared variable control, and retract'                                     °
  263.   '''SHARED VARIABLE CONTROL (ÉSVC)'',r'                                       °
  264.   '''Line [8] of function SVOFFER invokes the APL2 System Function Share       °
  265.  d''' '''Variable Control:''' '0 8 showfn ''SVOFFER'''                         °
  266.   '''(Note that result of the expression on line [8] is assigned to SV,'       °
  267.  ''                                                                            °
  268.   '''which is local to function SVOFFER; in other words it is ignored!)'       °
  269.  ',r'                                                                          °
  270.   '''The vector 1 0 1 0 is applied as the left argument to ÉSVC. The fou       °
  271.  r'''                                                                          °
  272.   '''boolean values determine who (APL2 or the other party) can (set or'       °
  273.  ''                                                                            °
  274.   '''use) the shared variable. A one means use (or set) is allowed only'       °
  275.  '' '''once by each party, and a zero means there is no constraint.'''         °
  276.   'do'                                                                         °
  277.   '''When two parties communicate over a single line, one party talks,''       °
  278.  '                                                                             °
  279.   '''and the other party listens. When the first party is finished talki       °
  280.  ng,'''                                                                        °
  281.   '''it should issue an "end of talk" message (like "over and out"). The       °
  282.  '''                                                                           °
  283.   '''Shared Variable Control acts as the messenger of access to the'''         °
  284.   '''communication channel. Keep in mind that the channel may be used by       °
  285.  '''                                                                           °
  286.   '''other parties, so that it cannot be locked up in a "synchronous" mo       °
  287.  de'''                                                                         °
  288.   '''of operation. A one in the access vector in effect prevents a party       °
  289.  '''                                                                           °
  290.   '''from issuing or receiving of data. To see how this works, we will''       °
  291.  ' '''step through the process of sharing variable A100 with AP 100'''         °
  292.   'TEACH4A' 'do'                                                               °
  293.   '''There are three additional System Functions/Variables that deal wit       °
  294.  h''' '''shared variables.''' 'do'                                             °
  295.   '''SHARED VARIABLE RETRACT (ÉSVR)'',r'                                       °
  296.   '''        ÉSVR ''''Shared Variable(s)'''''',r'                              °
  297.   '''This System Function can be thought of as a monadic primitive.'''         °
  298.   '''The right argument is the name of the shared variable to be retract       °
  299.  ed.'''                                                                        °
  300.   '''The function returns the degree of coupling before the call. (Natur       °
  301.  ally''' '''after the call the degree of coupling is 0.)'',r'                  °
  302.   'T╜100 SVOFFER ''D100'''                                                     °
  303.   'show ''ÉSVR ''''D100'''''' ''ÉNC ''''D100'''''' ''ÉSVC ''''D100''''''       °
  304.  '                                                                             °
  305.   '''If a shared variable is invoked inside a defined function, and if t       °
  306.  he'''                                                                         °
  307.   '''variable name is localized, then ÉSVR need not be invoked on exit f       °
  308.  rom''' '''the function.''' 'do'                                               °
  309.   'T╜''TEST;DOS'' ''Σ Localized shared variable'' ''100 SVOFFER ''''DOS'       °
  310.  '''''' 'T╜ÉFX T,Γ''''''Degree of coupling of DOS in TEST is 2'''''''          °
  311.   'showfn ''TEST'''                                                            °
  312.   'show ''TEST'' ''ÉSVO ''''DOS'''' Σ On exit from TEST, DOS has couplin       °
  313.  g=0''' 'do' '''SHARED VARIABLE QUERY (ÉSVQ)'',r'                              °
  314.   '''The information on this System Function in the Language Reference''       °
  315.  '                                                                             °
  316.   '''hard copy manual is completely wrong and should be disregarded.'''        °
  317.   '''Consult instead the on line documentation. (Select the icon'''            °
  318.   '''labelled "Language Reference".)'',r'                                      °
  319.   '''What this function does is to query any and all external sources'''       °
  320.   '''for incoming requests to share variables. Clearly, this function is       °
  321.  '''                                                                           °
  322.   '''useful to those who have APL2OS2 Advanced version. However, even if       °
  323.  '''                                                                           °
  324.   '''you have the introductory version, you may be able to test how this       °
  325.  ''' '''function works. (You can find out how by entering: TEACHSVQ'''         °
  326.   'do' '''SHARED VARIABLE STATE'',r'                                           °
  327.   '''Consult the on-line documentation in the Language Reference manual'       °
  328.  ''                                                                            °
  329.   '''on this System Function. This function is associated with the use''       °
  330.  '                                                                             °
  331.   '''of Shared Variable Control. Its utility is as of now unclear to me.       °
  332. X''' 'end'                                                                     °
  333. *(1995 7 29 14 23 45 532)                                                      °
  334.  FTEACH4A ÉFX 'TEACH4A;D100;T;SVO'                                             °
  335.   'Σ Example of usage of Shared Variable Control'                              °
  336.   '''We begin by invoking ÉSVC monadically on the as yet undefined'''          °
  337.   '''variable "D100":'',r'                                                     °
  338.   'show ''ÉNC ''''D100'''''' ''ÉSVC ''''D100'''''''                            °
  339.   '''The zeros in the access control vector indicate that there is no'''       °
  340.   '''constraint on the as yet undefined variable "D100". We next issue''       °
  341.  ' '''the ÉSVO command, and test for ÉSVC AGAIN'',r'                           °
  342.   'show ''100 ÉSVO ''''D100'''''' ''ÉNC ''''D100'''''' ''ÉSVC ''''D100''       °
  343.  '''''                                                                         °
  344.   '''The ÉSVO command returns a degree of coupling of 1, the variable "D       °
  345.  100"'''                                                                       °
  346.   '''is now defined, and the access vector has a constraint on AP100 to        °
  347.  use''' '''this variable more than once.''' 'do'                               °
  348.   '''We next proceed to increase the degree of coupling to 2. To do that       °
  349.  ,''' '''we use (local) function SVO:'''                                       °
  350.   'T╜ÉFX ''U╜SVO W'' ''ÉSVE╜15'' ''╕(1⌠U╜ÉSVO W)/0'' ''╕(0⌠É╜ÉSVE)/2'''        °
  351.   'showfn ''SVO'''                                                             °
  352.   '''(Should there be a delay, line [3] will display the current value o       °
  353.  f''' '''the Shared Variable Event.)''' 'do'                                   °
  354.   'show ''SVO ''''D100'''''' ''ÉSVC ''''D100'''''''                            °
  355.   '''The degree of coupling is now 2, but there has been no added constr       °
  356.  aint''' '''on the control vector.''' 'do'                                     °
  357.   '''Line [8] of function SVOFFER sets additional constraint on APL2. AP       °
  358.  L2'''                                                                         °
  359.   '''can NOT set or use D100 without an intervening acces by AP100.'',r'       °
  360.   'show ''1 0 1 0 ÉSVC ''''D100'''''''                                         °
  361. X '''Of course the constraint on use by AP100 remains.'''                      °
  362. *(1996 4 9 13 21 22 340)                                                       °
  363.  FTEACH5 ÉFX 'TEACH5' 'Σ Auxilliary processor 100'                             °
  364.   '''AUXILLIARY PROCESSOR 100 (OS/2)'',r'                                      °
  365.   '''This Auxilliary Processor is similar to the AP 100 for APL2 DOS,'''       °
  366.   '''except it communicates with OS/2. Unlike APL2 DOS, none of the OS/2       °
  367.  '''                                                                           °
  368.   '''Auxilliary Processors need to be named in the APL2 invocation.'',r'       °
  369.   '''There is, however, a significant difference in the way it behaves.'       °
  370.  '' 'do' '''Here is a sample usage of this function:'',r'                      °
  371.   'show ''100 SVOFFER ''''D100'''''' ''D100╜''''DIR C:'''''''                  °
  372.   '''The first expression activated the shared variable D100. The second       °
  373.  '''                                                                           °
  374.   '''one requested to see the directory of the C: disk. Yet nothing is''       °
  375.  '                                                                             °
  376.   '''visible on the screen. The reason for this is that non-APL (or to s       °
  377.  ay'''                                                                         °
  378.   '''external) output is directed NOT to the Session Manager, but to the       °
  379.  '''                                                                           °
  380.   '''"APL2 Introductory (or Advanced)" window. To see the listing of the       °
  381.  ''' '''specified directory, do the following:'',r'                            °
  382.   ''' 1. Press Ctrl AND Esc simultaneously. A window named "Window List"       °
  383.  ''' '''    will appear'''                                                     °
  384.   ''' 2. Select the APL2/2 Introductory/Advanced line'''                       °
  385.   '''    (an APL2/2 window will appear displaying the desired output.)''       °
  386.  '                                                                             °
  387.   ''' 3. To return to APL2, click on any portion of the still visible'''       °
  388.   '''    Session Manager window. (The APL2/2 window will disappear.)'''        °
  389.   'do' '''There is another way to get the Window List:'',r'                    °
  390.   ''' 1. Click on the Title Bar Icon (Red icon in upper left corner)'''        °
  391.   ''' 2. Click on the last line "Window List"''' 'do'                          °
  392.   '''AP 100 will accept any valid DOS or OS/2 command.'',r'                    °
  393.   '''(If you log on to APL2 with the invocation "-sm off", you will not'       °
  394.  ''                                                                            °
  395.   '''get the Session Manager and AP100 commands will appear on your'''         °
  396.   '''screen; however, you will not have APL2 fonts. For more on this'''        °
  397. X '''see the tutorial dealing with AP 120.)''' 'end'                           °
  398. *(1996 4 7 14 6 54 404)                                                        °
  399.  FTEACH6 ÉFX 'TEACH6' 'Σ Sample function OS2'                                  °
  400.   '''Here is a listing of function OS2. Its right argument is a characte       °
  401.  r'''                                                                          °
  402.   '''string containing an OS/2 or DOS expression or a null string. An'''       °
  403.   '''optional left argument gives the desired OS2 prompt (default: D:>).       °
  404.  '''                                                                           °
  405.   '''If the right argument contains non-blank characters, it will be'''        °
  406.   '''evaluated by Shared Variable "OS" of AP 100. A null string will'''        °
  407.   '''produce the OS/2 prompt and apply whatever is entered as an OS/2'''       °
  408.   '''command. (You still have to click on the APL2/2 line on the Window'       °
  409.  '' '''list to see the result).''' 'showfn ''OS2''' 'do'                       °
  410.   '''It should be noted that not all OS2/DOS expressions will behave as'       °
  411.  ''                                                                            °
  412.   '''if you were in OS2. For example "CD ..." will display the new promp       °
  413.  t,'''                                                                         °
  414.   '''but will not implement it. If you expect to invoke AP 100 often, yo       °
  415.  u''' '''may wish to take a look at workspace OS2 in library 2.'',r'           °
  416.   '''We will study this workspace later, because it uses AP''''s that ha       °
  417.  ve'''                                                                         °
  418.   '''not been discussed yet. The functions (specifically one called PIPE       °
  419.  )'''                                                                          °
  420.   '''transfers the requested information to and from a file, so that the       °
  421.  '''                                                                           °
  422.   '''OS2/DOS command results appear on your Session Monitor screen.'''         °
  423. X 'end'                                                                        °
  424. *(1996 4 13 13 35 35 464)                                                      °
  425.  FTEACH7 ÉFX 'TEACH7;S;T;X;ST;SAMPLE'                                          °
  426.   'Σ Alternate input (Stack) Processor'                                        °
  427.   '''ALTERNATE INPUT (STACK) PROCESSOR (AP 101)'',r'                           °
  428.   '''In many applications one needs to be able to simulate entries from'       °
  429.  ''                                                                            °
  430.   '''the keyboard, without actually using the keyboard. For example,'''        °
  431.   '''if an application is for NON-APL users, it is too much to expect'''       °
  432.   '''them to know how to log off from APL. A Stack Processor can readily       °
  433.  ''' '''provide the necessary character string ")OFF".'',r'                    °
  434.   '''The AP 101 under APL2OS2 behaves quite differently from the AP 101'       °
  435.  ''                                                                            °
  436.   '''of APL2 DOS. There are no special characters in the argument to the       °
  437.  '''                                                                           °
  438.   '''shared variable. A character string is treated in full as the'''          °
  439.   '''expression to be evaluated. Special commands to AP 101 are given'''       °
  440.   '''by numeric arguments to the shared variable.''' 'do'                      °
  441.   'show ''101 SVOFFER ''''ST'''''''                                            °
  442.   '''Shared variable "ST" is now active. One or more strings can now'''        °
  443.   '''be entered into the stack. However, pressing "Enter" will cause'''        °
  444.   '''the string to be evaluated.'',r' 'show ''ST╜''''∞5'''''''                 °
  445.   '''The utility of AP 101 can be illustrated by function SAMPLE:'''           °
  446.   'S╜''SAMPLE;T'' ''Σ Sample function to illustrate behavior of AP 101''       °
  447.  ' 'S╜S,''ST╜''''''''''''First'''''''''''''' ''ST╜''''1 2 3'''''''             °
  448.   'S╜S,''ST╜''''''''''''OUT'''''''''''''' ''''''3 strings have been ente       °
  449.  red on stack ST''''''' 'X╜ÉFX S,''T╜æ'' ''T╜É''' 'showfn ''SAMPLE'''          °
  450.   'do' 'show ''SAMPLE'''                                                       °
  451.   '''Lines [2],[3] and [4] fill the stack with three expressions'''            °
  452.   '''(NOTE: The strings in quotes MUST be valid APL2 expressions'''            °
  453.   '''or APL2 Systems Commands/Functions/Variables.)'''                         °
  454.   '''As the stack is filled no action takes place (as indicated by'''          °
  455.   '''the explanation on line [5]). Then, each time a (æ or É) is'''            °
  456.   '''entered, the contents of the stack is cleared by one entry.'''            °
  457.   '''Naturally a Quote symbol(É) will require an expression that will'''       °
  458.   '''result in a numeric array. The last entry (OUT) was caused by'''          °
  459.   '''the exit from function SAMPLE''' 'do'                                     °
  460.   '''The default for clearing the stack is FIFO "First In First Out".'''       °
  461.   '''Since one more entry is left on the stack, it is displayed on'''          °
  462.   '''exit from function SAMPLE.''' 'do'                                        °
  463.   '''To illustrate how a System Command can be issued under the control'       °
  464.  '' '''of AP 101, we have to make a detour. Normally, entering'',r'            °
  465.   '''  ST╜'''')LIB 1'''''',r'                                                  °
  466.   '''would do just what is desired. In this lesson, however, every entry       °
  467.  '''                                                                           °
  468.   '''is evaluated as if it were a valid APL2 expression. So, if we tried       °
  469.  '''                                                                           °
  470.   '''to enter ")LIB 1", we would get an error message. There is a way to       °
  471.  ''' '''get around this using the following three steps:'',r'                  °
  472.   '''   1. Exit from this lesson: ST╜''''╕'''''''                              °
  473.   '''   2. Issue the system command: '''')LIB 1'''''''                         °
  474.   '''   3. Re-enter the lesson: function TEACHB''' 'do' 'ST╜''╕'''             °
  475. X 'ST╜'')LIB 1''' 'ST╜''TEACHB''' '''²²'''                                     °
  476. *(1996 4 13 13 37 1 336)                                                       °
  477.  FTEACH8 ÉFX 'TEACH8;ST;X;T;S'                                                 °
  478.   'Σ Alternate input (Stack) Processor Commands' 'do'                          °
  479.   '''Function TEACHB is disconnected from the latent variable of this'''       °
  480.   '''workspace (TEACH). To see that, list functions TEACH and TEACHB'''        °
  481.   '''using the ÉCR command.''' 'do'                                            °
  482.   '''ALTERNATE INPUT PROCESSOR COMMANDS'',r' 'T╜101 SVOFFER ''ST'''            °
  483.   'S╜''SAMPLE;T'' ''Σ Sample function to illustrate behavior of AP 101''       °
  484.  ' 'S╜S,''ST╜''''''''''''First'''''''''''''' ''ST╜''''1 2 3'''''''             °
  485.   'S╜S,''ST╜''''''''''''OUT'''''''''''''' ''''''3 strings have been ente       °
  486.  red on stack ST''''''' '''AP 101 Commands'',r'                                °
  487.   '''There are several AP 101 commands that can be given while a stack''       °
  488.  '                                                                             °
  489.   '''is active. In the following examples, the function SAMPLE will be''       °
  490.  ' '''modified to illustrate how these commands work.'',r'                     °
  491.   ''' 1. By assigning a zero to the shared variable, the stack is purged       °
  492.  '',r'                                                                         °
  493.   '''    In the following example the entries on the stack will NOT be''       °
  494.  ' '''    evaluated!''' 'do' 'X╜ÉFX S,Γ''ST╜0''' 'showfn ''SAMPLE'''           °
  495.   'show ''SAMPLE'''                                                            °
  496.   ''' 2. You can purge portions of the stack. The command is: ST╜0,N'''        °
  497.   '''     If N is positive, the first N entries will be dropped, and if        °
  498.  N'''                                                                          °
  499.   '''     is negative, the last N entries will be dropped. First we drop       °
  500.  ''' '''     the first two entries''' 'do' 'X╜ÉFX S,Γ''ST╜0 2'''               °
  501.   'showfn ''SAMPLE''' 'show ''SAMPLE'''                                        °
  502.   '''     Next we drop the last two entries''' 'do'                            °
  503.   'X╜ÉFX S,Γ''ST╜0 ²2''' 'showfn ''SAMPLE''' 'show ''SAMPLE'''                 °
  504.   ''' 3. You can also change the sequence from FIFO to LIFO'''                 °
  505.   '''     a. 10 1 sets the stack to FIFO (this is the default)''' 'do'         °
  506.   'X╜ÉFX S,Γ''ST╜10 1''' 'showfn ''SAMPLE''' 'show ''SAMPLE'''                 °
  507.   '''     b. 10 ²1 sets the stack to LIFO''' 'do'                              °
  508.   'X╜ÉFX S,Γ''ST╜10 ²1''' 'showfn ''SAMPLE''' 'show ''SAMPLE'''                °
  509. X '''²²'''                                                                     °
  510. *(1996 4 10 14 8 52 416)                                                       °
  511.  FTEACHB ÉFX 'TEACHB' 'Σ Continuation of TEACH' 'TEACH8'                       °
  512.   '''In the APL2/DOS version, the AP 101 could be used to re-define the        °
  513.  F-keys.'''                                                                    °
  514.   '''This is apparently no longer possible in the APL2OS2 version. Howev       °
  515.  er,'''                                                                        °
  516.   '''changing F-keys is can be readily accomplished using the "Options"        °
  517.  pull''' '''down menu.'',r'                                                    °
  518.   '''It is not clear, however, how one would proceed to define F-keys in       °
  519. X''' '''combination with the Shift, Ctrl or Alt key.''' 'end'                  °
  520. *(1996 4 13 13 33 19 392)                                                      °
  521.  FTEACHSVQ ÉFX 'TEACHSVQ;D100;T;SVO' 'Σ Shared Variable Query'                 °
  522.   '''Regardless of your version of APL2OS2, you can simulate the presenc       °
  523.  e'''                                                                          °
  524.   '''of an external APL user by invoking APL2 twice. However, in order t       °
  525.  o'''                                                                          °
  526.   '''make this work, you must make a change in the "Window" panel of the       °
  527.  '''                                                                           °
  528.   '''APL2OS2 Settings folder, by placimng a mark on the "Create Another'       °
  529.  '' '''Window" line.''' 'do'                                                   °
  530.   '''Having done that, you can now create a second APL2 session by click       °
  531.  ing'''                                                                        °
  532.   '''on the red APL2/2 icon a second time. You can verify the existence        °
  533.  of'''                                                                         °
  534.   '''two APL2 sessions by clicking on the DESKTOP Window lists. There sh       °
  535.  ould'''                                                                       °
  536.   '''be two Session Managers; one named 1001 and a second one named 1002       °
  537.  .'''                                                                          °
  538.   '''Set up your windows so that you can readily switch between the two'       °
  539.  ''                                                                            °
  540.   '''sessions (overlap the Session Manager windows). Then on the 1001'''       °
  541.   '''session enter: 1002 ÉSVO ''''TALK'''''''                                  °
  542.   '''This should return a 1 indicating that an offer has been made to 10       °
  543.  02.'''                                                                        °
  544.   '''Now enter the 1002 session, and try the commands: "ÉSVQ ∞0" and'''        °
  545.   '''"ÉSVQ 1001". Since session 1002 has not yet accepted the offer, the       °
  546.  '''                                                                           °
  547.   '''response to these two expressions in effect tells that an outside''       °
  548.  ' '''offer has been made by session 1001. Now, of you enter:'',r'             °
  549.   '''       1001 ÉSVO ''''TALK'''''',r'                                        °
  550.   '''the connection will be completed, and the return should be a 2. At'       °
  551.  ''                                                                            °
  552.   '''this point an invocation of "ÉSVQ ∞0" should return a null result.'       °
  553. X'' 'do'                                                                       °
  554. XCa 0 %                                                                        °
  555. *(1991 11 11 8 25 11 308)                                                      °
  556.  Faddquote ÉFX 'u╜addquote w'                                                  °
  557.   'Σ Put quotes around a string, and double existing quotes'                   °
  558. X 'u╜ÉAV[40],((1+w=ÉAV[40])/w),ÉAV[40]'                                        °
  559. *(1991 11 11 8 25 11 308)                                                      °
  560. XFaq ÉFX 'u╜aq w' 'Σ Enclose quoted string' 'u╜Γaddquote w'                    °
  561. *(1991 11 11 8 25 11 308)                                                      °
  562.  Fav ÉFX 'av;a;n;i;ÉIO' 'Σ Display characters in the Atomic vector'            °
  563.   'ÉIO╜0' 'a╜22 78µ'' ''' 'n╜3 0«φ12 22µ1+∞256'                                °
  564.   'a[;,(6⌡∞12)°.+2 3 4]╜n' 'a[;6+6⌡∞12]╜φ12 22µÉAV'                            °
  565. X 'a[7 8 10 13;6]╜'' ''' 'a[14+∞8;68 69 70 72]╜'' ''' 'a'                      °
  566. *(1996 4 7 14 15 40 384)                                                       °
  567.  Fcopyright ÉFX 'copyright' 'Σ Copyright statement'                            °
  568.   '(10µ'' ''),''Copyright, Z. V. Jizba, 1995'',r'                              °
  569.   '''To see disclaimers, enter ÉCR ''''copyright''''''' 'do' '╕0'              °
  570.   '''This and subsequent workspaces labelled TEACHxx are made available'       °
  571.  ''                                                                            °
  572.   '''at no cost to anyone who desires to learn how to use effectively'''       °
  573.   '''the IBM/OS2 version of APL2.'',r'                                         °
  574.   '''This software is provided "AS IS" with no WARRANTY of any kind, eit       °
  575.  her'''                                                                        °
  576.   '''express or implied. Any risk in its use resides with you, the user        °
  577. Xof''' '''these tutorials.''' '''(PRESS ENTER to continue)'''                  °
  578. XCd 0 "                                                                        °
  579. *(1991 11 11 8 25 13 316)                                                      °
  580.  Fdate ÉFX 'u╜date w' 'Σ Format date and time of day' 'u╜«6╞w'                 °
  581. X 'u╜('' ''⌠u)Γu' 'u╜εu,■''-- .. '''                                           °
  582. XCdig 1 10 1234567890                                                          °
  583. *(1991 11 11 8 25 10 304)                                                      °
  584.  Fdo ÉFX 'do;t;e;b' 'Σ Expression driver' 'e╜''''' 'æ╜''       ''' 't╜æ'       °
  585.   '╕(^/'' ''=t)/0'                                                             °
  586.   '╕(('':''εt)doif ''b╜evaldd (+/^\'''' ''''=t)╟t'')/2'                        °
  587.   '''e╜ÉEM'' ÉEA t' '╕(0=µ,e)/2'                                               °
  588.   '''This is not a valid APL2 expression''' 'æ╜''*''' '╕(''?''⌠╞1╟æ)/2'        °
  589. X 'e' '╕2'                                                                     °
  590. *(1992 8 16 11 5 26 312)                                                       °
  591.  Fdoif ÉFX 'U╢╜V╢ doif W╢;t╢;e╢;c╢;r╢' 'Σ Rule' '╕(^/~U╢╜V╢)/0'                °
  592. X 'W╢╜V╢/W╢' '╕(1<╧W╢)/L1' '»W╢' '╕0' 'L1:t╢╜»■W╢'                             °
  593. XCe 1 0                                                                        °
  594. *(1996 3 31 14 34 39 548)                                                      °
  595.  Fend ÉFX 'end' '''²²''' 'e╜''''' 'æ╜''       ''' 't╜æ' '╕(^/'' ''=t)/0'       °
  596.   '╕(('':''εt)doif ''b╜evaldd (+/^\'''' ''''=t)╟t'')/3'                        °
  597.   '''e╜ÉEM'' ÉEA t' '╕(0=µ,e)/0'                                               °
  598.   '''This is not a valid APL2 expression''' 'æ╜''*''' '╕(''?''⌠╞1╟æ)/0'        °
  599. X 'e'                                                                          °
  600. *(1991 11 11 8 25 11 308)                                                      °
  601. XFendd ÉFX 'endd' 'Σ End of document' '20µ''²''' 'do'                          °
  602. *(1995 8 4 12 26 2 268)                                                        °
  603.  Ferase ÉFX 'erase;t;DISPLAY;OS2;GO;PROFILE;SVOFFER' 't╜ÉNL 3'                 °
  604.   't╜(~t^.εlc,'' '')≡t' 't╜ÉEX(~t[;∞5]^.=''TEACH'')≡t' 't╜ÉNL 2'               °
  605. X 't╜ÉEX(~t^.εlc,'' '')≡t' 't╜ÉNL 4' 't╜ÉEX(~t^.εlc,'' '')≡t'                  °
  606. *(1991 11 11 8 25 12 312)                                                      °
  607.  Fevaldd ÉFX 'u╜evaldd w;c;n'                                                  °
  608.   'Σ Evaluate a direct definition expression' 'u╜0' 'n╜(w∞''Σ'')-1'            °
  609.   'c╜(((n╞w)⌠'':'')Γn╞w),Γ''ΣDD '',(n+1)╟w' '╕(label╞c)/0'                     °
  610.   '╕((2=µc)doif ''u╜showdd 1╙c'')/0'                                           °
  611.   '╕((3=ÉNC╞c)doif ''u╜⌡µÉ╜(╞c),'''' is already defined.'''''')/0'             °
  612.   '╕((3=µc)doif ''u╜simdd c'')/0' 'c╜(Γ''α∙ aw'')replace■c'                    °
  613.   'u╜ε''u╜'',((''a''εεc[2 3 4])/''a ''),(╞c),'' w;t;b'''                       °
  614.   'u╜u(5πc)(''b╜(t╜'',(3πc),'')/'',addquote ''u╜'',4πc)'                       °
  615. X 'u╜u,''╕(t doif b)/0''(''u╜'',2πc)' 'u╜╧ÉFX u'                               °
  616. *(1991 11 11 8 25 11 308)                                                      °
  617.  Fexit ÉFX 'exit w' 'Σ Exit if there are too many suspended functions'         °
  618. X '╕((10>µÉLC)doif ''w'')/0' '''Please re-enter '',w' '╕'                      °
  619. XCf 1 2  {                                                                     °
  620. *(1992 8 16 11 27 52 504)                                                      °
  621.  Ffkeys ÉFX 'fkeys W;B;T' 'Σ Display currenttly defined fkeys'                 °
  622.   'B╜~^/W=ÉAV[1]'                                                              °
  623.   '╕((^/B)doif ''''''Currently no F keys are defined'''''')/0'                 °
  624.   '''The following Fkeys are currently defined (r stands for ÉAF 0)'',r'       °
  625. X 'T╜(r,'' r'')replace W' '0 tab B≡(π«■∞30),'' '',T'                           °
  626. XCg 1 2  }                                                                     °
  627. *(1991 11 11 8 25 12 312)                                                      °
  628.  Fget ÉFX 'u╜v get w;t' 'Σ Prompt for response from keyboard'                  °
  629.   't╜(0=ÉNC ''V'')doif ''V╜1''' 'w╜w,(~²1╞v)/'': ''' 'L0:æ╜w' 't╜æ'            °
  630.   '╕((''╕''=(µw)╟t)doif ''╕'')/0' '╕(^/'' ''=w)/L1'                            °
  631.   '╕((~w╧(µw)╞t)doif ''''''PLEASE DO NOT BACKSPACE'''''')/L0'                  °
  632.   't╜(µw)╟t' 'L1:u╜(²1+(,'' ''⌠t)∞1)╟t' '╕(1╞v)/0' 't╜(u⌠'' '')Γu'             °
  633. X 'u╜(µt),(Γu),t'                                                              °
  634. *(1991 11 11 8 25 11 308)                                                      °
  635.  Fglobals ÉFX 'globals' 'Σ Initialize useful global variables' 'r╜2╙ÉTC'       °
  636.   'q╜40╙ÉAV' 's╜Φp╜'' '',d╜35╙ÉAV' 'uc╜''ABCDEFGHIJKLMNOPQRSTUVWXYZ'''         °
  637.   'lc╜''abcdefghijklmnopqrstuvwxyz''' 'dig╜''1234567890'''                     °
  638. X 'g╜'' '',h╜126╙ÉAV' 'f╜ÉAV[33 124]' 'a╜38╙ÉAV'                               °
  639. XCh 0 }                                                                        °
  640. *(1996 4 9 13 38 53 532)                                                       °
  641.  Fhelp ÉFX 'help'                                                              °
  642.   '''If you feel that a single linear reading of these lessons is not th       °
  643.  e'''                                                                          °
  644.   '''best way to learn about APL2OS2, you may try to do the following.''       °
  645.  ,r' '''1. At any pause enter: ÉCR ''''TEACH'''''''                            °
  646.   '''   (a listing of the components of the tutorial workspace will appe       °
  647.  ar)'''                                                                        °
  648.   '''2. Jot down the names that appear in UPPER CASE --mostly TEACHxx--'       °
  649.  ''                                                                            °
  650.   '''3. Each of these is a component of the lesson that can be invoked''       °
  651.  '                                                                             °
  652.   '''   at the pause simply by entering its name. This will repeat that'       °
  653.  ''                                                                            °
  654.   '''   portion of the tutorial. The completion of each portion is marke       °
  655. Xd''' '''   by a line containing ²².''' 'end'                                  °
  656. *(1991 11 11 8 25 12 312)                                                      °
  657.  Finitialize ÉFX 'initialize;t' 'Σ  Initialize workspace' 'erase'              °
  658. X 'globals'                                                                    °
  659. *(1991 11 11 8 25 11 308)                                                      °
  660.  Fkeys ÉFX 'keys' 'Σ Display keyboard'                                         °
  661.   '''        1  2  3  4  5  6  7  8  9  0  +  ⌡'''                             °
  662.   '''SHFT ╒  ■  ²  <  ≤  =  ≥  >  ⌠  δ  ^  -  ÷'''                             °
  663.   '''ALT  ╘  ƒ  ·  ⁿ  √  Φ  φ  Θ  ╡  τ  σ  !  Æ''' ''''''                      °
  664.   '''         Q  W  E  R  T  Y  U  I  O  P  ╜  ╙  ╧'''                         °
  665.   '''SHFT     ?  ∙  ε  µ  ~  ╞  ╟  ∞  Ω  *  ╕  ╨  ╤'''                         °
  666.   '''ALT      q  w  e  r  t  y  u  i  o  p  æ  ≈  ╥'''                         °
  667.   '''CTRL     ┌  ┬  ┐              ╔  ╦  ╗''' ''''''                           °
  668.   '''          A  S  D  F  G  H  J  K  L  [  ]'''                              °
  669.   '''SHFT      α  ⌐  ╛  _  ╖  ╢  °  ''''  É  (  )'''                           °
  670.   '''ALT       a  s  d  f  g  h  j  k  l  »  «'''                              °
  671.   '''CTRL     ├  ┼  ┤       ─  ═    ╠  ╬  ╣''' ''''''                          °
  672.   '''           Z  X  C  V  B  N  M  ,  .  /'''                                °
  673.   '''SHFT       Γ  π  ∩  ¼  ¥  ÿ  |  ;  :  \'''                                °
  674.   '''ALT        z  x  c  v  b  n  m  Σ  ±  ≡'''                                °
  675.   '''CTRL      └  ┴  ┘  │  ║      ╚  ╩  ╝''' ''''''                            °
  676. X '''Toggle switch to ASCII is CTL-BACKSPACE''' '''CTRL+G gives beep'''        °
  677. *(1991 11 11 8 25 12 312)                                                      °
  678.  Flabel ÉFX 'u╜label w'                                                        °
  679.   'Σ Return 1 if w is not a valid character string label (also excludes        °
  680. Xl.c.)' '╕(u╜(1<µµw)δ1<╧w)/0' '╕(u╜~^/wεlc,uc,dig)/0' 'u╜w[1]εlc,dig'          °
  681. XClc 1 26 abcdefghijklmnopqrstuvwxyz                                           °
  682. *(1991 11 11 8 25 12 312)                                                      °
  683.  Fnon ÉFX 'non;t;rc;et;r'                                                      °
  684.   'Σ Ignore invalid keyboard entries, but evaluate valid APL2 expression       °
  685.  s' 'æ╜''       ''' 't╜æ' '╕(0=µ(t⌠'' '')/t)/0' '(rc et r)╜ÉEC t'              °
  686. X '╕(0=rc)/2' '╕((1=rc)doif ''r'')/2' '╕2'                                     °
  687. *(1991 11 11 8 25 12 312)                                                      °
  688.  Fnotb ÉFX 'u╜notb w' 'Σ Remove trailing blanks'                               °
  689.   '╕((1<╧w)doif ''u╜notb■ w'')/0' '╕((1<µµw)doif ''u╜πnotb Γ[2]w'')/0'         °
  690. X 'u╜(1-(,'' ''⌠Φw)∞1)╟w'                                                      °
  691. XCp 1 2  "                                                                     °
  692. *(1991 11 11 8 25 12 312)                                                      °
  693.  Fpause ÉFX 'v pause w;t'                                                      °
  694.   'Σ Pause, then print w v spaces right and return'                            °
  695. X 't╜(0=ÉNC ''v'')doif ''v╜6''' 'do' '(vµ'' ''),w' 'do'                        °
  696. XCq 0 '                                                                        °
  697. XCr 0                                                                         °
  698. *(1992 8 16 10 55 24 500)                                                      °
  699.  Freplace ÉFX 'u╜v replace w;i;r;s;t' 'Σ  Replace elements in v in w'          °
  700.   '╕((1<µµw)doif ''u╜π(Γv) replace■ Γ[µµw]w'')/0' 'i╜Γ∞µu╜w'                   °
  701.   't╜(1=╧v)doif ''v╜(v⌠'''' '''')Γv''' 's╜,2πv' 'i╜⌡r╜i⌡(1πv)╤■Γw'             °
  702.   '╕((2≥╧v)doif ''u[(εi)/εr]╜s[(εi)/εi⌡■∞µs]'' ''u╜εu'')/0'                    °
  703. X '''u╜w'' ÉEA ''u╜(╞r)╢rep╞╞v'''                                              °
  704. *(1991 11 11 8 25 12 312)                                                      °
  705.  Fround ÉFX 'u╜v round w' 'Σ Half adjust w to vth decimal'                     °
  706. X 'u╜(╛0.5+w⌡10*v)÷10*v'                                                       °
  707. XCs 1 2 "                                                                      °
  708. *(1991 11 11 8 25 12 312)                                                      °
  709.  Fshow ÉFX '╢v show ╢w;╢t;╢b' 'Σ Display and execute ╢w'                       °
  710.   '╢t╜(0=ÉNC ''╢v'')doif ''╢v╜0'''                                             °
  711.   '╕((0=╧╢w)doif ''show ╢w,'''' '''''')/0'                                     °
  712.   '╕((1<╧╢w)doif ''╢v show■ ╢w'')/0' '''      '',╢w'                           °
  713. X '╕((╢v^'':''ε╢w)doif ''╢t╜evaldd ╢w'')/L0' '''ÉEM'' ÉEA ╢w' 'L0:do'          °
  714. *(1991 11 11 8 25 13 316)                                                      °
  715.  Fshowdd ÉFX 'u╜showdd w;a;b;c;r'                                              °
  716.   'Σ  Display a direct definition function'                                    °
  717.   '╕((1=╧w)doif ''u╜showdd Γw'')/u╜0'                                          °
  718.   '╕((3⌠ÉNC╞w)doif ''(ε╞w),'''' is not a function'''''')/0'                    °
  719.   'c╜Γ[2]ÉCR╞w' 'c╜notb(2╞c),(Γ''aw α∙'')replace■2╟c'                          °
  720.   '╕((~''ΣDD''╧3╞2πc)doif ''''''Not a direct definition function'''''')/       °
  721.  0' 'u╜1' 'b╜('' ''⌠╞c)Γ╞c' 'a╜''      ''' 'r╜2╟3πc'                           °
  722.   '╕((3=µc)doif ''a,(╞w),'''':'''',r,(3<µ2πc)/''''   Σ'''',3╟2πc'')/0'         °
  723.   'a╜a,(╞w),'':'',(2╟5πc),'':''' 'b╜(+\r=''('')-+\r='')''' 'b╜b∞0'             °
  724. X 'a╜a,(²3╟(b-1)╞3╟r),'':'',2╟»(b+2)╟r' 'a,(3<µ2πc)/''  Σ'',3╟2πc'             °
  725. *(1991 11 11 8 25 13 316)                                                      °
  726.  Fshowfn ÉFX 'u╜v showfn w;f;n;t;ÉIO' 'Σ Simulate the STSC ÉVR command'        °
  727.   't╜(0=ÉNC ''v'')doif ''v╜0''' 'ÉIO╜0'                                        °
  728.   'u╜r,''      '',''╖'',w,''[É]'',(╞v)╞''╖''' 'n╜1╞µf╜ÉCR w' 'n╜«∞n'           °
  729.   'n╜(n⌠'' '')Γn' 'f╜(π''['',■n,■Γ''] ''),f'                                   °
  730.   't╜(1<µ,v)doif ''f╜f[1╟v;]'' ''u╜''''''''''' 'u╜²1╟u,r,,f,r'                 °
  731. X 'u╜((-+/^\'' ''=Φu)╟u),('' ''(r,''      ╖'',date 2 ÉAT w))[╞v],r'            °
  732. *(1991 11 11 8 25 13 316)                                                      °
  733.  Fsimdd ÉFX 'u╜simdd w;e' 'Σ Simple direct definition mode' 'u╜0'              °
  734.   '╕((0⌠ÉNC╞w)doif ''''''Already defined'''''')/0' 'e╜''α''ε2πw'               °
  735.   'w[2]╜Γ''u╜'',''α∙ aw'' replace 2πw' 'w╜w[1 3 2]'                            °
  736. X 'w[1]╜Γε''u╜'',(e/''a ''),w[1],'' w''' 'u╜╧ÉFX w'                            °
  737. XCt 1 7                                                                        °
  738. *(1992 6 3 9 59 17 424)                                                        °
  739.  Ftab ÉFX 'U╜V tab W;T;A;B;C;D;E;F;G;M;ÉPW' 'Σ Tabulate list W'                °
  740.   'T╜(0=ÉNC ''V'')doif ''V╜0''' 'M╜''Invalid data for tabulation'''            °
  741.   'V╜4╞V' 'ÉPW╜130╛30⌐G╜V[2]+79⌡V[2]=0'                                        °
  742.   'L1:╕((1<╧W)doif ''''''W╜∞0'''' ÉEA ''''W╜πW'''''')/L1'                      °
  743.   '╕(((0=µεW)δ2<µµW)doif ''U╜(~V╧4╞0)/M'')/0'                                  °
  744.   'T╜(1≥µµU╜«W)doif ''U╜πW╜(U⌠'''' '''')ΓU'''                                  °
  745.   'T╜(0<V[1])doif ''U╜(«(Φ1,╞µW)µ(V[3]µ'''' ''''),∞(╞µW)-V[3]),'''' ''''       °
  746.  ,U''' '╕(G<30)/0' 'T╜(F╜µεV[4])+C╜1╟B╜µA╜(V[3],0)╟U'                          °
  747.   'T╜⌐(1╞B)÷1⌐╛(ÉPW+F)÷T' 'U╜(E╜(V[3],C)╞U),[1](B╜T,1╟B)╞A'                    °
  748.   '''D╜εV[4]'' ÉEA ''D╜ÉAV[εV[4]+33⌡V[4]=0]''' 'L0:A╜(T,0)╟A'                  °
  749. X '╕(0=1╞µA)/0' 'U╜U,(((T+V[3]),µD)µD),E,[1]B╞A' '╕L0'                         °
  750. *(1992 12 19 18 32 12 420)                                                     °
  751.  Ftestap ÉFX 'U╜V testap W;B;D;S;T'                                            °
  752.   'Σ Test for existence of specific AP"s' 'D╜''D'',■«■W╜,W'                    °
  753.   'T╜W ÉSVO■D' 'U╜0' '╕((^/B╜2=ÉSVO■D)doif ''T╜ÉEX■ D'')/0'                    °
  754.   '╕(2=ÉNC ''V'')/L0'                                                          °
  755.   'T╜''The following Auxilliary Processor'',(S╜1<+/~B)╞''s'''                  °
  756.   'T,(ε(S+1)╙'' is'' '' are''),'' not available'',(~B)/W' 'L0:U╜1'             °
  757. X 'T╜ÉEX■D'                                                                    °
  758. XCuc 1 26 ABCDEFGHIJKLMNOPQRSTUVWXYZ                                           °
  759.