background image

Summary of Contents for 5100

Page 1: ..._ r lAN M ENGEL IBM 5100 APL Reference Manual DEC 1197T o o...

Page 2: ...s IBM 5100 APL Reference Card GX21 9214 APL Language GC26 3847 Third Edition May 1976 This is a major revision of and obsoletes the previous edition SA21 9213 1 and Technical Newsletter SN21 0258 Chan...

Page 3: ...2 I The ERASE Command 15 Primitive Mixed Functions 73 l The FNS Command 16 The p Function Shape Reshape Structure 75 I The LI B Command 16 The Function Rpvel Catenate Laminate 77 The LOA D Command 18...

Page 4: ...2 Stop Contro I 154 CHAPTER 7 SUSPENDED FUNCTION EXECUTION 155 Suspension 155 State Ind icator 155 CHAPTER 8 TAPE AND PRINTER INPUT AND OUTPUT 158 Establishing a Variable to be Shared 158 Opening a Da...

Page 5: ...board a w pe un d ind cator lights communicate informat on V mon tors eh ed sbP ds chesalloW the user to control the operations to the user I the s stem w perform fe tures I b le for the 5100 are an a...

Page 6: ...e display are moyed up so that information can be entered on the two bottom lines again The top lines of the display are lost as the lines are moved off of the display screen SWITCHES The switches on...

Page 7: ...ge CLEAR WS is displayed when the system is ready If the system does not display the message after 20 seconds press RESTART again If the system does not become ready after several attempts call your s...

Page 8: ...G J RENUM REWIND CalcRes COpy APL l LOAD CIQ JCI D lVARS lOUTSELHREWIND DISPLAY DELETE INSERT OGJCDCDGJCDCDmCJCJOCD fI IJ I COCDCOOJCOwCDQO Shift Key CD OJ CD Q CD CD GJ rncoO GJCDGJQCDCDCIJOOOJCD J I...

Page 9: ...hameric keyboard can also be entered using keys to the right of the numeric keys The keyboard contains some keys that perform operations in addition to those performed by a typewriter These keys are d...

Page 10: ...processed by the system This key must be pressed for any input to be processed Command When this key is pressed and held pressing an alphameric key in the top row causes the APL command keyword or ch...

Page 11: ...rk Backspace When this key is pressed once the cursor moves one position to the left When it is held down the cursor continues to move to the left When the cursor reaches position 1 on one input line...

Page 12: ...isplay screen When this key is held down the lines continue to move down Copy Display CD If there is a 5103 Printer when the CMD key is held down and this key is pressed once all the information prese...

Page 13: ...r 5 output is generated before th expression or function has completed execution In such cases even though the system is still processing data the IN PROCESS light goes off and the output is displayed...

Page 14: ...tored Each file has a file header which con tains information about the file See the LI Bsystem command in this chapter for a description of the file header The system commands which are used to contr...

Page 15: ...ace file headers Display the state indicator Display the state indicator and local names Display the number of symbols allowed and used in the active workspace Display the names of the global variable...

Page 16: ...nation of terms and symbols used as parameters for system commands Device file number specifies the tape unit and file to be used The built in tape unit is tape unit 1 and the auxiliary tape unit is t...

Page 17: ...number workspace ID is displayed The CONTI NUE command on the 5100 is similar in function and format to the SAVE command except as noted below and is distinguished from the CONTI NUE command on IBM A...

Page 18: ...name of the workspace to be stored This name must match the workspace ID of both the active workspace and the file to be used on the tape unless the file is marked unused If the file is marked unused...

Page 19: ...the file can no longer be read from the tape When the command is successfully completed DROPPED device file number file ID is displayed Syntax DROP device file number file ID where device file number...

Page 20: ...that starts with an alphabetic character and contains no blanks This sequence of characters determines the starting point for an alphabetic listing The LIB Command The LIB command displays the file he...

Page 21: ...e blocks of storage Number of unused contiguous 1024 byte blocks of storage in the file Number of defective records 512 byte blocks in the file an asterisk is displayed if there are more than nine def...

Page 22: ...the system operation is interrupted and the active workspace is cleared Syntax LOAD device file number workspace 10 password where device file number is the number of the tape unit and the number of...

Page 23: ...tape CLEAR is the value of DWA see Chapter 5 in a clear workspace ACTIVE is th value of DWA just before the contents of the active workspace are written to tape The formula for a data file data writt...

Page 24: ...in communications mode APL is no longer available For more information on the communications feature or the serial I O adapter feature see IBM 5100 Communications Reference Manual SA21 9215 or IBM 510...

Page 25: ...at file type 08 Copy the contents of one tape cartridge to another tape cartridge The customer support cartridge contains the following files File 1 The programs that copy or load IMFs and the program...

Page 26: ...active workspace using the COPY command For example to copy the TRACE function into the active workspace COPY 5 APLAIDS AATRACE Note The PATCH command is not required for using the functions in file 5...

Page 27: ...the copy operation is done Use the LlB command to determine what size the files should be marked The Copy IMF Tape program will issue prompting messages and wait for the user to respond to each messag...

Page 28: ...m the tape Option 5 End of Job This option causes the APL language to be available again Option 6 Tape Recovery The Tape Recovery option allows the user to recover data from a file or files on which t...

Page 29: ...ompleted COPI ED device file number workspace ID is displayed Notes 1 If the active workspace contains suspended functions objects cannot be copied into it 2 If the ATTN key is pressed during a PCOPY...

Page 30: ...is displayed Notes 1 A clear workspace or a workspace with suspended function cannot be written on tape using the SAVE command however a workspace with suspended functions can be written to tape usin...

Page 31: ...preceded by a colon This sequence of characters must be matched when the stored workspace is to be read back into the active workspace If no workspace ID or password is entered the password associate...

Page 32: ...number of symbols allowed in the active workspace Each symbol allowed requires eight bytes of storage in the active workspace Notes 1 The number of symbols allowed is assigned in blocks of 21 therefor...

Page 33: ...t any parameters device file number workspace ID is dis played When the WSID command is issued with parameters WAS device file number workspace ID is displayed Note The WSI D command only affects the...

Page 34: ...sed but only the first 77 characters are significant to APL The assignment arrow is used to assign data to a variable LENGTHi 6 WIDTl lfo8 AREA LENGTHxWIDTH To display the value of a variable enter ju...

Page 35: ...Range Numeric values in the 5100 can range from 7 237005577332262E75 to 7 237005577332262E75 The smallest numeric value the 5100 can use is 5 397604346934028E 79 Numeric Value Precision Numbers in th...

Page 36: ...called a scalar It has no coordinates that is it can be thought of as a geometric point The follow ing are examples of scalars A I A Scalars can be used directly in calculations or can be assigned to...

Page 37: ...used to generate an array is XpY where X is the shape of the array and Y represents the values for the elements of the array For the left argument X you enter a number for each coordinate to be gener...

Page 38: ...the right argument in row order The rank of an array is the number of coordinates it has or the number of indices required to locate any element within that array Scalars are rank O Vectors have a ran...

Page 39: ...s one dimension The result of the shape function is always a vector A 111 222 333 444 555 666 1 The shape of a matrix or N rank array is found the same way 123 M 2 3p1 2 3 1 5 6 M 5 6 M 2 3 i R 2 3 4...

Page 40: ...useful when creating lists see Catenation in this chapter or when branching in a user defined function see Chapter 6 Following are some ways to generate empty arrays Assign 10 to a variable name to ge...

Page 41: ...es the coordinate that will be expanded when A and B are joined If the coordinate is not specified the last coordinate is used When A and Bare matrices and I is 1 the first coordinate number of rows i...

Page 42: ...Rr DR A I J B 38 A 10 20 30 40 50 60 B 11 22 33 44 55 66 77 88 A scalar can also be catenated to an array In the following example a scalar is catenated to a matrix Notice that the scalar is repeated...

Page 43: ...3366B6 45e I 7 7l pPHONE 2 _7___________ The list of telephone numbers now contains two rows INDEXING You may not want to refer to the whole array but just to certain elements Referring to d nly certa...

Page 44: ...st Z 3 I J I B 6 VALUE ErJ rJ D Z I 3 I I 1 B I b 0 Indices whatever is inside the brackets can be expressions provided that when those expressions are finally evaluated the results are values that re...

Page 45: ...ld enter M 2 3J If you want to refer to the third and fourth elements in that row you would enter 8 Similarly to refer to the elements in column 4 rows 1 2 and 1 you would enter I f 8 L You can use th...

Page 46: ...lons required is the rank of the array minus one If the correct number of semicolons is not specified RANK ERROR results 3 L Mt 5 LI p L2 pM Mr 6Jf 9 R NK ERROR M 6 t 9 You can change elements within...

Page 47: ...operators that operate on the primitive functions Examples of the functions and operators are provided throughout this chapter for easy reference and are set up as they would appear on the display PRI...

Page 48: ...is extended to each of the elements of B The shape of the result is the shape of B B 2 3p 3 2 1 0 1 2 B H 3 2 l 1 2 B 2 1 Dyadic Two Argument Form Plus A B The plus function results in the sum of the...

Page 49: ...I 5 6 3 B 4 5 6 7 B 9 B 3 4 5 6 1 8 9 The Function Negation Minus Q Monadic One Argument Form Negation 8 The negation function changes the sign of the argument The argument can be a numeric scalar vec...

Page 50: ...element array the shape of the result is the same as that of the other input argument The single element is applied to every element of the multielement array l 2 5 1 5 l B 2 3p1 2 3 5 6 B MB 2 I 0 1...

Page 51: ...ars vectors or other arrays The arguments must be the same shape unless one of the arguments is a scalar or any single element array Arguments of the same shape have the same shape result 2x2 1 4 2 2...

Page 52: ...Argument Form Divide A B The divide function result is the quotient when argument A is divided by argument B The arguments can be numeric scalars vectors or other arrays The arguments must be the sam...

Page 53: ...r larger than the argument the argument is rounded up unless the argument already is an integer In this case the result is the same as the argument The argument can be a numeric scalar vector or other...

Page 54: ...n less one of the arguments is a scalar or any single element array Arguments of the same shape have the same shape result 3 I r 1 0 6 j 1 1 3 r j o 4 If one argument is a scalar or a single element a...

Page 55: ...ment is an array the function is extended to each of the elements 1 1 1 2 B 2 2pl 1 5 1 6 2 B 1 1 6 LB I 5 2 Note The result of the floor function depends on the OCT system variable see Chapter 5 for...

Page 56: ...of the argument The argument can be a numeric scalar vector or other array The shape of the result is the same as that of the argument 1 00 9 7 9 100 3 3 If the argument is an array the function is e...

Page 57: ...to argument B until a value between argument A and zero is reached 1 The arguments can be numeric scalar vectors or other arrays The arguments must be the same shape unless one of the arguments is a s...

Page 58: ...t of the array 1 2 3 Bi 2pO 1 2 13 B 1 7 389 1 7 1 8 5 20 08l Dyadic Two Argument Form Power A 8 The power function result is argument A raised to the power indicated by argument B The arguments can b...

Page 59: ...828459045 The argument can be a non negative numeric scalar vector or other array The shape of the result is the same as that of the argument m2 7 1 B3 1 m O OBb If the argument is an array the functi...

Page 60: ...argument is an array the function is extended to each element of the array 1 2 3 1 B 2 2 t 2 3 ll B B 11 16 9 1 24 8 6 28 52 1 2 66 Dyadic Two Argument Form Circular Ao B The circular function result...

Page 61: ...yperbolic tangent of 8 tanh 8 Arcsin 8 Arccos 8 Arctan 8 Arccosh 8 Arctanh 8 If 8 is 45 0 here is how to solve for the sine cosine and tangent of 8 45 0 is equiva lent to pi radians divided by 4 B o 1...

Page 62: ...pi divided by 6 H l c 6 B o 3 Sine of 30 0 Oe B o B660 3 4 Cosine of 30 0 B 20 I B o BI 603 Cosine of 30 0 Oc B O t ___________ Sine of 300 J If one argument is a scalar or a single element array the...

Page 63: ...a positive numeric scalar vector or other array The shape of the result is the same as that of the argument p 24 l X2x3X4 24 1 2 4 5 l 6 21 1 120 The factorial function also works with decimal number...

Page 64: ...gle element array Arguments of the same shape have the same shape result 2 l f 2 6 w y Z J Argument B x 11 J 5 0 3 1 The combinations of argument 8 taken 2 3 argument A 2 at a time 3 If one argument i...

Page 65: ...g selected The argument can be a positive integral scalar vector or other array The shape of the result is the same as that of the argument 7300 202 30 3 5 7 9 2 I 4 6 6 5 1 1 76 6 6 6 If the argument...

Page 66: ...rrays The arguments must be the same shape unless one of the arguments is a scalar or any single element array Arguments of the same shape have the same shape result 01 1 And Table 0 1 1 1 Operator 1...

Page 67: ...ctors or other arrays The arguments must be the same shape unless one of the arguments is a scalar or any single element array Arguments of the same shape have the same shape result 1vO OvO o o 0 1 1v...

Page 68: ...alues of the argu ment must be 1 or O The argument can be a scalar vector or other array The shape of the result is the same as that of the argument 1 o If the argument is an array the function is ext...

Page 69: ...O The arguments can be scalars vectors or other arrays The arguments must be the same shape unless one of the arguments is a scalar or any single element array Arguments of the same shape have the sa...

Page 70: ...or O The arguments can be scalars vectors or other arrays The arguments must be the same shape unless one of the arguments is a scalar or any single element array Arguments of the same shape have the...

Page 71: ...nless one of the arguments is a scalar or any single element array Arguments of the same shape have the same shape result o 2 0 o o 1 o 5 1 1 3 5 1 o 1 1 o o 1 If one argument is a scalar or a single...

Page 72: ...one of the arguments is a scalar or any single element array Arguments of the same shape have the same shape result 0 5 1 65 321 1 65 321 1 1 I AI o A I B o 1 1 o I o o 0 If one argument is a scalar...

Page 73: ...the arguments is a scalar or any single element array Arguments of the same shape have the same shape result L 65 2 1 I I 0 o I 12 5 I 1 23 o 5 1 o 1 0 If one argument is a scalar or a single element...

Page 74: ...guments must be the same shape unless one of the arguments is a scalar or any single element array Arguments of the same shape have the same shape result 1 65 2 0 2 0 I 1 5 1 I 1 0 0 If one argument i...

Page 75: ...must be the same shape unless one of the arguments is a scalar or any single element array Arguments of the same shape have the same shape result I I I 0 JIO o 5 1 1 o 0 If one argument is a scalar or...

Page 76: ...ape have the same shape result Ot 5 1 o A t A I 5 I l 3t I 4 o 1 1 If one argument is a scalar or a single element array the shape of the result is the same as that of the other argument The single el...

Page 77: ...73...

Page 78: ...are rotated to the right A B General ized The coordinates of B interchanged as transpose specified by A A B Deal The number of elements specified by A are randomly selected from B without selecting t...

Page 79: ...ap plied to a specific coordinate the operation takes place between corresponding ele ments in the specified coordinate For example assume you have a 3 rank array When the first coordinate planes is s...

Page 80: ...y the elements are repeated If there are more elements in argument B than are required to fill the array only the required number of elements are used Argument A must be a nonnegative integer or vecto...

Page 81: ...taken from argument B in row order Argument B can be a scalar vector or other array The resulting vector contains the same number of elements as argument B 1 2 3 1 5 6 7 8 A 2 2 2pl 2 3 5 6 7 8 A IA 1...

Page 82: ...positive scalar or one element array If no index I is specified the last coordinate is used Matrices of unequal sizes can be joined providing the lengths of the coordinate not specified are the same...

Page 83: ...e that is added al ways has a value or length of 2 The following chart shows the positions of a new coordinate in the shape vector see the following examples when two 3 by 3 matrices are laminated Ind...

Page 84: ...3 I f I I 5 5 i 6 c 6 7 77 8 BB 9 99 pC 3 3 k II Shape Vector The following examples show the result when the two matrices in the preceding example are catenated instead of laminated AI lJB 1 2 5 1 5...

Page 85: ...rdinate being acted on When argument B is a multidimensional array the I index entry is used to specify the coordinate that is acted on If the index entry is omitted the last coordinate columns is ass...

Page 86: ...the same number of 1 s as the length of the argument B coordinate being acted on When argument B is an array the I index entry is used to specify the coordinate that is acted on If the index entry is...

Page 87: ...the index value of the first occurrence appears first in the output The number of elements in the result is the same as the number of elements in the argument 3 1 I 1 2 I f 1 C 3 J 4tAt 6 2 5 I 1 4 2...

Page 88: ...he vector have the same numeric value their position in the vector determines their order in the result the index value of the first occurrence appears first in the output The number of elements in th...

Page 89: ...nd grade up function the grade down function is not the reverse of the grade up function A A J 10 8 7 5 3 3 2 2 1 A AJ 1 2 2 3 3 4 5 7 8 10 Note The result of the f function depends on the 010 system...

Page 90: ...ment for each coordinate of argument B When argument A is positive the first elements of argument B are taken when argument A is negative the last elements are taken If argument A specifies more eleme...

Page 91: ...gument B can be a vector or other array Argument A must be a scalar if argument B is a vector When argument B is an array argument A must have one element for each coordi nate of argument B When argum...

Page 92: ...Index of A 1 8 The index of function result is the index of the first occurrence in argument A of the element s in argument B Argument A must be a vector Argument B can be a scalar vector or array The...

Page 93: ...g the 0 symbol and the I symbol A special form of the function symbol is 9 formed by overstriking the 0 symbol and the symbol Monadic One Argument Form Reverse p I B or f B or aB The reverse function...

Page 94: ...E EVIL 5 2 1 f 5 I SAVE MUCH M I E TIME MORE TIME SAVE MUCH MUCH BAVE TIME MORE EVAS HCUM EROM Et1IT EVAS HCUM EROM EMIT MORE TIME SAVE MUCH A 2 2 I p SAVEMUCHMORETIME A r I A The first coordinate pla...

Page 95: ...r or single element array If argument B is a matrix then argument A must be a scalar or vector When argument A is a vector the number of elements in argument A must be the same as the number of elemen...

Page 96: ...lH 1 lB 1 0 2 3 The first coordinate planes is specified 4 23 6 therefore the rotation is between planes 7 8 9 ArgUment A 19 1 1 1 2 The first element 0 0 13 16 1 1 25 If 7 1 10 1 3 1 6 19 1 I 1 1 1 c...

Page 97: ...n reverses the coordinates of argument B Argument B can be any expression If argument B is a scalar or vector the argument is unchanged by the function ABCD ABeD B 2 B L 2 3 II 2 row 3 column matrix c...

Page 98: ...pecified For example to transpose the rows and columns of a matrix argument A would be 2 1 Hf 2 3 I H I 2 I I J 6 1 I B 1 I J 11 AM 5 3 6 To transpose the rows and columns of a 3 rank three coordinate...

Page 99: ...adic Two Argument Form Deal A B The deal function randomly selects numbers from 0 through 8 1 or 1 through 8 depending on the index origin without selecting the same number twice 80th arguments must b...

Page 100: ...L Lt Ten units in each of these positions equals one unit of the next position to the left Argument B is a vector with these values 7 7 6 The result is the same as doing the following 1 x10 x10x10 x1...

Page 101: ...ument is repeated to match the length of the other 10 L 3 2 5 325 j O 10 10 1 7 777 If argument A is a vector and argument B is a matrix argument A must have an element for each row of B B 2 3pl 5 2 7...

Page 102: ...t hours minutes and second to all seconds 24 60 6011 30 15 5415 The following illustration shows how it was done Argument A number system 24 60 60 1 _________60 units minutes equals one unit of the ne...

Page 103: ...t A Note Be sure argument A is long enough to completely represent argument B or an incorrect answer results For example the representation of 1776 in the decimal number system base 10 10 10 10 10r177...

Page 104: ...lue of the leftmost position of argument A can be zero For example o 3 0 1 0 3 0 f177e 1 6 If both arguments are vectors the result is a matrix Each column in the result con tains the representation f...

Page 105: ...2 1 3 20 10 5 A 3 2pl0 20 10 10 10 5 A B ArB tQA T B t The result can be transposed so that 1 2 3 each row represents the values of 2 3 argument B expressed in the number systems specified by argument...

Page 106: ...column of argument A represents a number system 10 20 L 0 20 A 2 2pl0 20 A B B 88 2 9 1 88 77 66 77 66 ArB 7 n 17 Result of the number system in column 1 of argument A Result of the number system in c...

Page 107: ...equals one unit of the next position to the left 60 units minutes equals one unit of the next position to the left 24 units hours equals one unit of the next position to the left Argument B 5415 seco...

Page 108: ...elements of argument 8 and a 0 for every element that cannot be found The shape of the result is the same as the shape of argument A Arguments A and 8 can be any scalar vector or array l Z j 2 3 1 j...

Page 109: ...is the inverse of a If the matrix does not have an inverse then DOMAIN ERROR results Af 2 2 1 3 5 A 1 3 EIA OMO B7 j o 3 7 0 625 0 125 l 2 3 6 Af 2 2 1 2 3 6 A I IA DOMAIN EI ROR Ij A If argument a i...

Page 110: ...r equations with coefficient matrix B and right hand sides A 2 3 3 S 1 2 7 1 Af 8 3 Bf 2 2pl 2 3 1 AEiB B 2 2p3 j I 2 B If argument B is a square matrix and argument A is a matrix then the columns of...

Page 111: ...nction evaluates and executes argument B as an APL expression Argument B can be any character scalar or vector 1 2 10 p fo l 2 1 A The character vector in the variable A is executed Cfo A 2 B 2 5 A 3...

Page 112: ...6 9 to 1 c J 6 10 B 5 L J 1 2 B 3 4 7 B I 1 12 X fB X This matrix is a character matrix B 1 to 1 2 Dyadic Two Argument Form Format A 8 The dyadic format function result like the monadic format functi...

Page 113: ...1B X I 2 5L 3Q 57 00 12 00 6 3 4 C 1 _ 1 Cf 9 2 B C 1 2EO 1 3 5EO 1 0 0 01 1 2EOl I 1 2E02 1 Width of nine positions left margin Width of nine positions left margin If the width entry in argument A is...

Page 114: ...alue DPW IMPLICIT ERROR will result when the format function is used 2 Even if the specified format causes all of the significant digits to be truncated the sign of the original number is retained For...

Page 115: ...ult is the value of the single element of argument B When argument B is a vector the reduction of that vector is the same as putting the primitive dyadic function between each of the elements 10 10 Bf...

Page 116: ...fore the reduction is between columns 1 5 7 9 7 9 fB 1 2 3 6 I I 1 I B The second coordinate in this case columns is specified B 2 4 P 21 B The first coordinate rows is specified 1 lJ therefore the re...

Page 117: ...ctions Function is performed first and then Dreduction is applied between the results of function The result is an array the shape of the array is all but the last coordinate of argument A catenated t...

Page 118: ...2x5 15 A x1 3 11 35 2 The last coordinate of argument A is the same length as the first coordinate of argument B If both are matrices the column coordinate of argument A is the same length as the row...

Page 119: ...arrays the elements in each row of argument A are acted on by the elements in each plane of argument B A 2 2 2 n8 A 1 2 3 If 5 l 8 B 2 2 2p8 t3 B 9 10 I I 12 13 14 15 j 6 A xB 31 J 38 1 1 4 79 86 l 10...

Page 120: ...nction is A 0 CDB whereG is a dyadic primitive scalar function Arguments A and B can be any expressions Unless argument A is a scalar the shape of the result is the shape of argument A catenated to th...

Page 121: ...e examples Af 2 3 5 5 7 B B 2 3pl 2 3 4 5 6 Ao B Af 2 2p 1 2 3 B 3 3 9 A B 2 3 5 6 7 B 9 Z Ao B pZ 2 2 3 3 z JJII 3 4 5 5 7 B 9 10 fl lf 4 5 6 7 a 9 1 J 1 1 1 1 2 2 1 3 III 5 6 789 10 1 1 12 3 1 4 e 1...

Page 122: ...e result is the same as that of the input argument 1 2 3 1 5 1 3 6 1 0 1 5 This result is the same as doing the 6 10 1 5 1 following for each element in the 1 2 1 2 3 1 2 5 1 1 2 5 1 5 result The firs...

Page 123: ...1 1 6 1 8 20 I 24 6 2B 30 32 34 6 2JA The second coordinate rows is specified I 2 3 If therefore the scan operation is between rows B 1 0 1 2 for each plane 1 5 1 8 21 2l 1 3 I I I 1 6 30 32 31 36 5 1...

Page 124: ...n a later APL statement it has a value of 5 Notes 1 When a value assigned to a variable is used as the argument for a function the value assigned to the variable is used by the function regardless of...

Page 125: ...ignment arrow The value of the APL expression to the right of the arrow is assigned to the quad and will be displayed For example 7 1 2 The 7 displayed is the value assigned to the quad The 12 is the...

Page 126: ...Chapter 6 for more information on quad quote input or output within a user defined function Comment GJ CD The comment symbol is formed by overstriking the n symbol and the 0 symbol The comment symbol...

Page 127: ...e 010 Index origin OPP Printing precision OPW Printing width ORL Random link OLC Line counter OWA Workspace available OLX Latent expression OAV Atomic vector Notes 1 To find the value assigned to a sy...

Page 128: ...1 o 1 Next lower integer power A is 1 therefore the difference between the arguments exceeds OCTxA 1x1 1 Next lower integer power A is 16 therefore the difference between the arguments does not exceed...

Page 129: ...ote All other examples in this manual are shown with the index origin set to 1 Printing Precision DPP The value of this variable determines the number of significant digits displayed for decimal numbe...

Page 130: ...ber of the statement in another function that invoked the function being executed The remaining elements follow the same pattern The user cannot set this variable but can dis play it Attempts to modif...

Page 131: ...lled NAMES will display your first and last name Each name will start at the left margin and each character in the name will be one line lower than the previous character VNAMES D V V A NAMES B OUTPUT...

Page 132: ...ing with the specified character ONC name Name classification The 0 CR Function Canonical Representation The OCR function formats a user defined function into a character matrix This function is monad...

Page 133: ...hanged to I Rf INTG A 1 ApO If 1 STAI T Rr I I I I l I A STAI T To format a matrix created by the OCR function into a user defined function use the OFX function The OFX function is discussed next The...

Page 134: ...me of the user defined function and the original definition of the user defined function if there was one is replaced Now the function INTG can be displayed and executed VINTG JV V R INTG A tJ R ApO 2...

Page 135: ...l 1 2 Lf Lf INTG is made a local function so that the _ _ I global version will not be change the local V CHANbE 1 IN Tb 1 Y version will not exist after the execution of MI J I I t f CHANGE is compl...

Page 136: ...l Names of a name Note If the object being expunged is a shared variable see Chapter 8 it will be retracted The ONL Function Name List The ON L function yields a character matrix each row of the matri...

Page 137: ...The 0 NC Function Name Classification The ONe function is monadic takes one argument the argument is a scalar or array of characters The result of the function is a vector of numbers represent ing the...

Page 138: ...statement is executed MECHANICS OF FUNCTION DEFINITION The following steps are required to define a new function 1 Enter a V followed by the function header see Function Header in this chapter After t...

Page 139: ...cussed later in this chapter The function header also determines whether or not a function has an explicit result If a function has an explicit result the result of the function is tempor arily stored...

Page 140: ...must be a blank between the function name and the arguments Also the same symbol cannot appear more than once in the function header thus Z FUNCTION Z is invalid For user defined functions the order...

Page 141: ...sion START means branch to a statement labeled START When assigning a label to a statement the label must be followed by a colon and must precede the statement The colon separates the labe from the st...

Page 142: ...on continues For example the conditional branch I N START is evaluated as follows 1 First the condition I N is evaluated the result is 1 if the condition is true and 0 if the condition is false 2 The...

Page 143: ...so work if a specific statement number is specified to the right of the For example 3 means branch to statement 3 or 1 3xA means I is assigned the value of 3 times the value of A and the value of I is...

Page 144: ...variable or user defined function or a local name in another function However any reference to the name local to the function will not change the values of any other global or local objects variables...

Page 145: ...4J RESULT LOC GI OB XV EXAMPLE B 5 X X has no value after the function VALUE ERROR has executed X 1 LOC The global value associated with this 10 name was unchanged by the function GLOB II The global v...

Page 146: ...s always the most recent local value of the name Of course as execu tion of the more recently called functions is completed the next earlier value of each local variable will again be accessible A nam...

Page 147: ...played The SIV list contains a com plete set of referents of a name Note See System Functions in Chapter 5 for an example of a local user defined function using the OFX system function If the SIV list...

Page 148: ...e of an interactive function that computes the amount of interest on a capital amount for a given number of years V C1 1J ENTER THE CAPITAL AMOUNT IN DOLLARS 2 A 3 ENTER THE INTEREST IN PERCENT 1 1 I...

Page 149: ...ad quote a quad overstruck with a quote is used input from the keyboard is treated as character data The input begins at the left margin of the display quotes do not need to be entered to define the d...

Page 150: ...n be displayed on the same line For example V X TIMES Y 1 J I I X 2 I I TIMES 3 r l y I J 1 lf I I j J XXY V 2 TIMES 1 2 TIf ES 1 IS B Since the cursor does ilot return to the next line after bare out...

Page 151: ...an only be executed copied or erased it cannot be revised or displayed in any way nor can trace control and stop control see Trace Control and Stop Control later in this chapter be changed A function...

Page 152: ...tement displayed to be edited see Editing Statements in this chapter To display only one statement of the function enter nO where n is the statement number to be displayed APL responds by displaying s...

Page 153: ...sor flashing character at the character to be changed Enter the correct character b To delete a character position the cursor at the character to be deleted Then press the backspace key while holding...

Page 154: ...The entire process can be accomplished on a single line VR 3 S S 1 Vopens the definition of function R enters a new line 3 and termin ates function definition VR D V causes the entire definition of R...

Page 155: ...2 3 THE BUM IS to look like this XV ___ _ Add statements 3 and 4 VAVERAGE L1J V V AVERAGE X Display the function 1 THIS FUNCTIDN CALCULATES AVERAGES AND SUMS 2 THE AVERAGE IS 3 X X X l f J THE SUM IS...

Page 156: ...TD STEVE V where STEVE is the name of the function and V is the vector specifying the statement numbers to be traced For example if TD STEVE 2 3 5 is entered the statements 2 3 and 5 are traced each t...

Page 157: ...I A C D STEVE 2 8TEVE 3 6 16 STEVE 2 Note The following instruction will establish trace control for the first statement of each user defined function in the active workspace J l t I 0 T IJ I NL 3 l J...

Page 158: ...t of the stop control function is S STEVE V where STEVE is the name of the function and V is the vector specifying the statements After the stop the system is in the suspended state see Chapter 7 exec...

Page 159: ...that is not pendent A pendent func tion is a function that called the suspended function If a function called a function that called a suspended function and so on it is also pendent see State Indicat...

Page 160: ...at a suspended function has been edited or a pendent function has been erased and the normal execution of the suspended function can no longer be resumed Therefore when an 51 DAMAGE error occurs the s...

Page 161: ...good practice to clear suspended functions because suspended functions use available storage in the active workspace Repeated use of clears all the suspended functions as the functions are cleared th...

Page 162: ...llowing steps must be performed 1 Establish a variable to be shared 2 Open a data file on tape or specify printer output 3 Transfer the data 4 Close the data file or terminate the printer output 5 Ret...

Page 163: ...1 will also be displayed Note The instruction O tDSVO DNL 2 will display the existing number of shared variables in the system and the instruction O tDSVO DNL 2 1 DNL 2 will display the existing share...

Page 164: ...umber 3 TapeUnit1 Note If fewer than four digits are used tape unit 1 is assumed and the value entered represents only the file number ID file ID optional specifies from 1 to 17 characters enclosed in...

Page 165: ...s placed in the blank positions Negative signs must be replaced by minus signs Enclosing single quotes must be part of any data that represents character constants Also any embedd ed quotes in the cha...

Page 166: ...ed Data is to be transferred to tape from the active workspace a EXAMPLE ADD 3 L lFile 3 on tape unit 1 assumed is to be opened Data is to be transferred into an existing file on tape Note Since the f...

Page 167: ...de For OUT operations to an existing data file writing new data over the existing data any existing data following the new data cannot be used again For ADD operations the new data is written to the d...

Page 168: ...ursor return character is embedded in the data that was written to tape the system will recognize it as an end of record char acter when the data is read from tape If an end of block character was emb...

Page 169: ...re tract the variable name is discussed next RETRACTING THE VARIABLE NAME BEING SHARED The DSVR function is used to retract a variable name being shared That is once the DSVR function has been used s...

Page 170: ...Code Error Message 00 1 eee 20 INVALID FILE 30 INVALID DEVICE or INVALID DEVICE NUMBER 40 INVALID FILE NUMBER 50 NOT WITH OPEN DEVICE 60 INVALID PARAMETER 70 WS FULL 80 DEVICE NOT OPEN Description an...

Page 171: ...exchange file noncharacter data was used as the information required to open a file or non character data was sent to the printer AN EXAMPLE USING TAPE AND PRINTER INPUT OUTPUT In this example file n...

Page 172: ...to an existing data file but the file is closed a vari able name must be established to be shared and the data file opened again Note In this example the variable name SHARE has not been retracted and...

Page 173: ...E FOR THE PRINT OPERATION O 0 WORKt PRNT PRINT4ERROR LODP PRINT4ERROR PRINT ERROR THE RETURN CODE IS WDI K Jot A TERMINATE THE PRINTER OUTPUT lONE PRNTf O ACHECK THE RETURN CODES TO MAKE SURE ALL TAPE...

Page 174: ...e is read displayed and printed PI INT 2 i 56 30 0 SCI E J I 2 1 561 1 00 NUT 21 1 il 5 0 ltJASHER 5 5 lB 00 CI I C BIt i3 7 J 5 BOARD 5 35795 L A W sooo 7000 10 After the operation is complete the sh...

Page 175: ...s available for protecting or removing sensitive data on a tape These methods are Assigning a password to the workspace when writing the active workspace on tape Rewriting a tape file which makes the...

Page 176: ...s of the 5100 Model A2 is 32K Model A3 is 48K Model A4 is 64K In these models all additional storage is allocated to the active workspace For example on the Model A4 the active workspace is approximat...

Page 177: ...ariable see Chapter 8 to transfer the data into the active workspace when required Clear suspended functions see Chapter 7 from the active workspace Group user defined functions by related operations...

Page 178: ...e in Chapter 5 remains the same as it was when the contents of the active workspace were originally written to tape To take advantage of the additional storage in the larger active workspace write the...

Page 179: ...ges to excessive heat more than 130 0 F or sunlight Do not touch or clean the tape surface If a data cartridge has been exposed to a temperature drop exceeding 30 F since the last usage move the tape...

Page 180: ...e forms loss of data will occur as the print head leaves the form Capability of using individual or continuous forms Maximum number of copies is six but for optimum feeding and stacking IBM recommends...

Page 181: ...guide rack in the horizontal position The diagrams below and to the left show the proper forms path for singlepart and multipart forms Push the paper release lever to the rear to acti vate the fricti...

Page 182: ...osition 16 Turn the paper advance knob to position the form for the first line to be printed The paper should exit over the form guide rack Note To move the form backward turn either paper advance kno...

Page 183: ...ntrol dial toward 0 one click at a time to obtain the legibility you desire If you are using multipart forms and the ribbon is smudging the first sheet rotate the copy control dial toward 8 one click...

Page 184: ...areful to disengage it from the clip on the print head 9 Lay the ribbon loop on the top of the ribbon in the rib bon box Pick up the entire ribbon and discard it Disk Ribbon Holder 10 Eject the new ri...

Page 185: ...he loop through the slot in the bottom of the ribbon box 18 Thread the ribbon through the guide shoe and around the left guide post O_Feed Roll 19 Release Knob Insert the horizontal part of the ribbon...

Page 186: ...viously defined global variable name An invalid edit request was made in function definition mode An attempt was made to edit a pen dent function An attempt was made to read a data file and the file i...

Page 187: ...second tape not ready Uneven winding of the tape The tape cartridge is not inserted in the indicated tape unit An attempt was made to write on a tape that is file protected The SAFE switch on the tap...

Page 188: ...eviously assigned an invalid value or was undefined in a function due to the system variable being made local to the function Note This error message is not displayed until the system variable in erro...

Page 189: ...de to load a data file or read a workspace file An attempt was made to load or copy a damaged file The file was probably damaged by the tape being removed from the tape unit before a save operation wa...

Page 190: ...em An attempt was made to index a portion of an array with a rank greater than 14 An attempt was made to use a take or drop operator on an array with a rank greater than 9 An attempt was made to lamin...

Page 191: ...era tion other than CLEAR after a SYSTEM ERROR occurred An attempt was made to use a function that requires the rank of the arguments to conform but they do not For example a function requires the ran...

Page 192: ...value If the object is a function name the function header did not specify a result the function did not assign a value to the result variable or the function does not exist User s Response Use the SI...

Page 193: ...the active workspace exceeds the avail able storage Too many symbols were specified in a SYMBOLS command The workspace is password protected but no password or the wrong pass word was specified in the...

Page 194: ...stored with the CONTINUE command into the active workspace but IMFs have been applied reducing the available internal storage An attempt was made to write the active workspace using the CONTINUE comma...

Page 195: ...climated to the operating environment before turning it on If the machine was exposed to heat allow it to cool enough so that you can place your hand on the surface without discomfort before turning i...

Page 196: ...POWER switch to OFF and call for service Do not continue with these instructions If the fan is operating wait for about 20 seconds and your 5100 will be ready for operation APL Checkout Procedure o 1...

Page 197: ...n press the backspace key above EXECUTE to backspace the cursor then press the correct key Where the bottom portion of the key is shown shaded hold the shift key down while you press the character key...

Page 198: ...the word SAFE Note Do not use any prerecorded tape cartridges that were shipped with your machine This edge goes into machine first o 5A Insert the tape cartridge into the 5100 metal bottom down and p...

Page 199: ...ad from tape the program must be erased from the workspace To do th is press the following keys To read the program from tape into the 5100 press the following keys When LOADED 1002 WS is displayed pr...

Page 200: ...BASIC Checkout Procedures in Appendix C of the IBM 5100 BASIC Reference Manual SA21 9217 If you already did the BASIC checkout procedures continue with step 11 o 11 If the auxiliary tape unit is to b...

Page 201: ...the rear panel as shown in the preceding diagram o 4 Remove the shipping tape from the power line and plug the power line into a grounded electrical outlet 05 06 Set the auxiliary tape unit POWE swit...

Page 202: ...the arrow is pointing away from the word SAFE o 2 Press the following keys to read in the program that was stored on tape during the 5100 checkout procedure o 3 After the message LOADED 2002 WS appea...

Page 203: ...the connector fits squarely Turn the knob in a clockwise direction until the connectors fit together firmly BNC Connector for TV Monitor Forms Tractor Storage Position for Terminator Plug 5100 Portab...

Page 204: ...in the printer Use the printer information in this manual if you need help in inserting the paper see Chapter 10 o 7 Set both the printer and 5100 POWER switches to ON and continue on to the checkout...

Page 205: ...keyboard plus the followinq overstruck characters Function Character Keys Used Comment Execute Factorial combination Format Grade down W Grade up th Logarithm 6 Matrix division Nand Nor V Protected f...

Page 206: ...RESERVED RESERVED RESERVED I I BE RVED REBEI VED I ESEI VED REBE I VED I LEFT BI ACI ET I I GHT B l f CI ET LEFT PARENTHESIS I IGHT PARENTHESIS SEMICOLON BACI BI iBH LEFT f I RD J I IGHT ARI v 1 I EB...

Page 207: ...ET CUP UNDEI BCDI E TI f lNSPOSE BEAt1 NULL SMALL CIRCLE Ui D Ut D UDTE LOG NAND NOR I LAf1 P COt 1MENT GRf ll E UP Gl i tIE DOI JN OVEI Sl I UCI C1 1 CI E HYPHEN DVE I ST I UCI SLi SH HY PHEN OVERSTR...

Page 208: ...E I UNDE I CD I E N UNDE I SC I E N UNDEI BC RE UNDEI SCOI E P UNDEI SCDRE UNDE I BCD I E R UNDEI BCDI E S UNDE I BCO I E T UNDERBCORE U UNDE I BCClI E V UNDE RSCD RE J J UNDE I SCO I E X UNDE I BC I...

Page 209: ...O I ECTED DEL UNUSED UNUSED UNUSED UNUSED UNUSED UNUSED UNUBED LENGTH OF Z SYf 1BOL Tf BL E O U T FOR COMMUNICATION TAPE LOGICAL NOT DOUBLE QUOTE PERCENT PROTECTED DEL Tf BULLS EYE I UMLAUT o UMLAUT...

Page 210: ...at specifies the device and file number where a workspace is to be SAVE d or LOAD ed If the number is less than 4 digits it is only the file number device 1 is assumed otherwise the high order 1 or 2...

Page 211: ...mplemented with only one workspace area no spare therefore the following error messages have been added 1 2 Function name statement number LINE TOO LONG Cannot save functions with statements greater t...

Page 212: ...OSVO is 2 since if it is a valid share it is always accepted before the APL user regains control If an unsupported processor is specified the response is 1 The response to DSVR is the same as the resp...

Page 213: ...he ability to edit lines of data directly therefore the following changes were made to function definition NO Now displays line N in the display screen lines 1 and 0 for editing NOM N Has the same res...

Page 214: ...nts all characters all numeric or all logical assign To use the assignment arrow to associate a name with a value available storage The number of unused 1024 byte blocks of storage in a file on tape 2...

Page 215: ...rkspace the file ID is the same as the stored workspace ID file number The files on tape are sequentially numbered starting from one file type Identifies the type of data stored in a file function bod...

Page 216: ...of a coordinate of other arrays is the number of items specified by that coor dinate For example a matrix has a row coordinate with the length of 2 therefore the matrix has two rows 212 local name A n...

Page 217: ...A single data item that does not have a dimension p p 0 scalar function The results of the scalar functions are the same shape as the arguments The function is applied to corresponding elements in the...

Page 218: ...tion of a user defined function trace vector Specifies the statements when using trace control transferring data Using a shared variable to write data to tape read data from tape or output data to the...

Page 219: ...output 146 ffifunction 105 e raised to a power 54 l symbol 134 138 m character 145 155 password 12 14 18 25 29 function 44 function 45 x function 46 function 48 rfunction 49 Lfunction 51 Ifunction 52...

Page 220: ...commands system 10 216 comment A 121 135 communications adapter 1 communications mode 20 communications program 20 comparison tolerance OCT 124 81 138 44 88 compress data 163 compress function conditi...

Page 221: ...0 forms an array 76 forms thickness 179 formula for file size 19 forward space key 6 function definition 134 function definition mode 134 function definition reopen 148 function editing 147 function h...

Page 222: ...13 maximum function r 49 membership function E 104 minimum function L 52 minus function 46 mixed functions 43 218 models 172 monadic 43 monadic functions 135 monadic mixed functions 73 MSG OFF 161 166...

Page 223: ...me execution 155 retract shared variable 16 165 retract the variable name being shared 165 return codes 162 REVERSE DISPLAY switch 5 reverse function p 89 reverses the coordinates of the argument 93 r...

Page 224: ...3 take elements from an argument 86 take function t 86 tape 10 220 11 tape cartridge care 175 handling 175 tape error recovery program 24 25 tape input and output 158 tape storage 19 tape unit auxilia...

Page 225: ...this form for technical questions about the system or for requests for additional publications this only delays the response Instead direct your inquiries or requests to your IBM representative or to...

Page 226: ...ications Dept 245 Rochester Minnesota 55901 International Business Machines Corporation General Systems Division 57750 Glenridge Drive N E Atlanta Georgia 30301 USA Only IBM World Trade Corporation 82...

Page 227: ...o o o o o o o...

Page 228: ...l Business Machines Corporation General Systems Division 57750 Glenridge Drive N_E_ Atlanta Georgia 30301 USA Only IBM World Trade Corporation 821 United Netions Plaza New York New York 10011 Internat...

Reviews: