1、INTERNATIONAL STANDARD IS0 8485 First edition 1989-11-01 Programming languages - APL Langages de programmation - APL Reference number IS0 8485 : 1989 (E) Processed and adopted by ASC NCITS and approved by ANSI as an American National Standard.Date of ANSI Approval: 1/13/99Published by American Natio
2、nal Standards Institute,11 West 42nd Street, New York, New York 10036Copyright 1999 by Information Technology Industry Council (ITI).All rights reserved.These materials are subject to copyright claims of International Standardization Organization (ISO),International Electrotechnical Commission (IEC)
3、, American National Standards Institute (ANSI), andInformation Technology Industry Council (ITI). Not for resale. No part of this publication may be reproducedin any form, including an electronic retrieval system, without the prior written permission of ITI. All requestspertaining to this standard s
4、hould be submitted to ITI, 1250 Eye Street NW, Washington, DC 20005.Printed in the United States of AmericaAdopted by INCITS (InterNational Committee for Information Technology Standards) as an American National Standard.Date of ANSI Approval: 1/13/99Published by American National Standards Institut
5、e,25 West 43rd Street, New York, New York 10036Copyright 2002 by Information Technology Industry Council (ITI).All rights reserved.These materials are subject to copyright claims of International Standardization Organization (ISO), InternationalElectrotechnical Commission (IEC), American National St
6、andards Institute (ANSI), and Information Technology Industry Council(ITI). Not for resale. No part of this publication may be reproduced in any form, including an electronic retrieval system, withoutthe prior written permission of ITI. All requests pertaining to this standard should be submitted to
7、 ITI, 1250 Eye Street NW,Washington, DC 20005.Printed in the United States of AmericaISO8485:1989(E) Foreword IS0 (the International Organization for Standardization) is a worldwide federation of national standards bodies (IS0 member bodies). The work of preparing International Standards is normally
8、 carried out through IS0 technical committees. Each member body interested in a subject for which a technical committee has been established has the right to be represented on that committee. International organizations, govern- mental and non-governmental, in liaison with ISO, also take part in the
9、 work. IS0 collaborates closely with the International Electrotechnical Commission (IEC) on all matters of electrotechnical standardization. Draft International Standards adopted by the technical committees are circulated to the member bodies for approval before their acceptance as International Sta
10、ndards by the IS0 Council. They are approved in accordance with IS0 procedures requiring at least 75 % approval by the member bodies voting. International Standard IS0 8485 was prepared by Technical Committee ISO/TC 97, Information processing systems. Users should note that all International Standar
11、ds undergo revision from time to time and that any reference made herein to any other International Standard implies its latest edition, unless otherwise stated. Annexes A and 8 are for information only. 0 IS0 1989 All rights reserved. No part of this publication may be reproduced or utilized in any
12、 form or by any means, electronic or mechanical, including photocopying and microfilm, without permission in writing from the publisher. International Organization for Standardization Case postale 56 . CH-1211 Geneve 20 . Switzerland Printed in Switzerland ii IS0 8485 : 1989 (E) CONTENTS 0 Introduct
13、ion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 1 Scope and Field of Application . 5 2 References 7 3 Form ofthestandard . . 9 3.1 Form ofDefinitions 9 3.2 Named Arrays in Examples . 10 3.3 Notes . 10 3.4 Cross-Ref
14、erences 10 3.5 General Definitions . 11 4 Compliance . . . 13 4.1 Conforming Implementations 13 4.1.1 Required Behaviour for Conforming Implementations 13 4.1.2 Required Documentation for Conforming Implementations 14 4.1.2.1 Documentation of Optional-Facilities 14 4.t.2.2 Documentation of Implement
15、ation-Defined-Facilities 14 4.1.2.3 Consistent Extensions . 14 4.2 Conforming Programs 15 4.2.1 Required Behaviour for Conforming Programs . 15 4.2.2 Required Documentation for Conforming Programs 15 5 Definitions . . . . . . . . . . . . 17 5.1 Characters . 17 5.2 Numbers . 19 5.2.1 Elementary Opera
16、tions . 19 5.2.2 Number Constants 5.2.3 SubsetsoftheSetof(;mbe;s:. 20 . 21 5.2.4 Implementation Algorithms 23 5.2.5 Defined Operations 24 5.3 Objects 26 5.3.1 Lists . 26 5.3.2 Arrays 27 5.3.3 Defined-Functions . 29 5.3.4 Tokens . 30 5.3.4.1 Metaclasses 32 5.3.4.2 Index-List 33 5.3.5 Symbols 33 5.3.6
17、 Contexts 34 5.3.7 Workspaces . 34 5.3.8 Sessions 35 5.3.9 Shared-Variables . 36 5.3.10 Systems 5.4 EvaluationSequkn .i l,7 9.3.2 Inner Product 2 t A f . g B 118 10 MixedFunctions . . . . . ,I1 9 10.1 Monadic Mixed Functions . 119 10.1.1 Roll 2 c ? B 10.1.2 Grade Up Z c . Z c fj B 10.1.7 Ex,ecute .
18、Z t Q B 10.2 Dyadic Mixed Functions 10.2.1 Join Along an Axis . Z t A , K B 10.2.2 lndexof . Z t A 1 B 10.2.3 Member of . Z t A E B 10.2.4 Deal Z t A ? B 10.2.5 Compress . Z t A / B 10.2.5 Compress . Z c A f B 10.2.5 Compress . Z + A /K B 10.2.5 Compress . Z + A fK B 10.2.6Expand 2 t A B 10.2.6 Expa
19、nd Z + A + B 10.2.6 Expand Z t A K B 10.2.6 Expand 2 + A +K B 10.2.7 Rotate Z c A $ B 10.2.7 Rotate Z + A 8 B 10.2.7 Rotate Z t A c$K B 10.2.7 Rotate Z t A eK B 10.2.8 Base Value Z t A I B 10.2.9 Representation . Z t A T B 10.2.10 Dyadic Transpose Z + A Q B 10.2.11 Take . z + A + B 10.2.12 Drop . z
20、t ,q + B 10.2.13 Matrix Divide Z + A 8 B 10.2.14 Indexed Reference z t A I 10.2.15 Indexed Assignment . 2 c IrI t B . . . . 119 121 122 123 123 123 123 124 125 126 . . . . . . . . . 127 127 130 131 132 133 133 133 133 135 135 135 135 137 137 137 137 139 140 142 144 145 146 147 148 CONTENTS v IS0 848
21、5 : 1989 (El 11 System Functions . 15 1 11.1 Introduction 151 11.2 Definition I5 1 11.3 Diagram I5 1 11.4 Niladic System Functions 152 11.4.1 Time Stamp 2 + II!?,5 152 14.4.2 AtomicVector 2 + IIAV 153 11.4.3 Line Counter . 2 c 3Lc 153 11.5 Monadic System Functions 154 11.5.1 Delay . z t JDL B 154 11
22、.5.2 Name Class z + uflc B 155 11.5.3Expunge . z + IJEX B 156 11.5.4 Name List . z + OA7L B 156 11.5.5 QLJeStOp Z + USTop B 157 11.5.6 Query Trace z t JTRACE B 157 11.6 Dyadic System Functions 158 11.6.1 Name List . z t A OflL B 158 11.6.2 Set Stop . Z + A USTOP B 158 11.6.3 Set Trace z t A OrRACE B
23、 159 12 System Variables 161 12.1 Definitions . I6 1 12.2 Evaluation Sequences I6 2 12.2.1 Comparison Tolerance Z + OCT f- B 162 12.2.1 Comparison Tolerance Z + UCT 162 12.2.2 Random Link . Z c ORL t B 163 12.2.2 Random Link . Z t GIRL 163 12.2.3 Print Precision Z c Opp c B 164 12.2.3 Print Precisio
24、n Z c fJPP 164 12.2.4 Index Origin Z c IJIO t B 165 12.2.4 Index Origin Z c III0 165 12.2.5 Latent Expression . Z c !X,X c B 166 12.2.5 Latent Expression . Z c IJLX 166 12.2.5 Latent Expression . Z c OLXI t B 166 13 Defined Functions . 16 7 13.1 Introduction 167 13.2 Definitions . 168 13.3 Diagrams
25、. I7 1 13.4 Operations . 174 13.4.1 Call-Defined-Function . Z t DFN 174 13.4.1 Call-Defined-Function . Z c DFN B 174 13.4.1 Call-Defined-Function . Z t A DFN B 174 13.4.2 Defined-Function-Control . 175 13.4.3 Function Fix Z t OFX B 176 13.4.4 Character Representation . Z t CCR B 177 13.5 Function Ed
26、iting . 178 13.5.1 Evaluate-Function-Definition-Request 178 13.5.2 Evaluate-Editing-Request . 180 13.5.3 Diagrams 181 14 SharedVariables . . 14.1 Informal Introduction . 14.2 Definitions . 14.3 Diagrams . 14.4 Operations 14.4.1 Primary-Name . 14.4.2 Surrogate-Name . 14.4.3 Degree-of-Coupling . 14.4.
27、4 Access-Control-Vector . 14.4.5 Offer 14.4.6 Retract 14.4.7 Shared-Variable-Reset . 183 . 183 . 186 . 186 . 186 . 186 . 186 . 188 . 186 . 187 . 188 . 188 vi APL Standard 1s0 8485: 1989 (El 14.5 Shared Variable Forms . 189 14.5.1 Shared Variable Reference Z t SHV 189 14.5.2 Shared Variable Assignmen
28、t . Z + SHV c B 189 14.5.3 Shared Variable Indexed Assignment Z t sHvI t B 190 14.6 Shared Variable System Functions 191 14.6.1 Shared Variable Access Control Inquiry . Z + QSVC B 191 14.6.2 Shared Variable Query . Z t IJsVg B 192 14.6.3 Shared Variable Degree of Coupling . Z + OSVO B 193 14.6.4 Sha
29、red Variable Offer Z t A fJSV0 B 194 14.6.5 Shared Variable Retraction Z c IJSVR B 195 14.6.6 Shared Variable Access Control Set . Z =+ A IsVC! B 196 15 Formatting and Numeric Conversion , . , . , , . 197 15.1 Introduction .lg 7 15.2 Numeric Conversion . 197 15.2.1 Numeric-Input-Conversion 198 15.2.
30、2 Numeric-Output-Conversion . 199 15.3 Diagrams 199 15.4 Operations 203 15.4.1 Monadic Format . Z c m B 203 15.4.2 Dyadic Format Z + A m B 206 16 Input and Output . . . . . . 20 9 16.1 Introduction 209 16.2 Definitions . 20 9 16.2.1 User Facilities . 209 16.2.2 Implementation Algorithms . 210 16.2.3
31、 Prompts . 211 16.3 Diagrams . 211 16.4 Operations 212 16.4.1 Immediate-Execution . . . 16.4.2 Quad Input z + 17 g?i 16.4.3 Quote Quad Input Z t II 214 16.4.4 Quad Output . z t 0 t B 214 16.4.5 Quote Quad Output Z + fJ + B 215 17 System Commands . . . . . . . . 217 17.1 Introduction 217 17.2 Definit
32、ions . 217 17.3 Diagrams . 218 17.4 Operations 219 17.4.1 Evaluate-System-Command . 219 17.5 Diagrams and Evaluation Sequences . 220 Annex A. The APL Character Set for Workspace Interchange . , . , , 225 Annex B: The Workspace Interchange Convention . 233 B.l Introduction 233 B.l.1 Purpose of the Co
33、nvention 8.1.2 Organisation of the Convention 233 233 8.2 Level1 Description . 234 8.2.1 Canonical Representation Vectors 234 8.2.2 Representation of Variables . 235 8.2.3 Representation of Functions . 236 8.2.4 Representation of Executable Expressions 237 B.3 Level 2 Description . 238 8.3.1 Multipl
34、e Canonical Representation Vectors . 238 B.3.2 Workspace Environment 238 8.3.3 Pseudovariables 239 B.3.4 Interchange Convention Identifier . 239 8.3.5 Escape . 239 8.3.6 Bits . 239 8.3.7 Translate: 1: : 1: : :.23 9 8.3.8 Note . 240 8.3.9 Workspace Identifier . 240 B.3.10 End of the Stream 240 CONTEN
35、TS vii IS0 8485 : 1989 (El 8.3.11 Inclusion of Nonstandard Material 240 8.3.12 Use ofOtherTypes . 241 8.4 Level 3 Description . 242 8.4.1 Atoms 24 2 8.4.2 Registered character sets . 242 8.4.3 Escapesequences 24 2 8.4.4 Reqistered characters : : . 242 B.4.5 ISO-APL characters . 242 8.4.6 Characters
36、8.4.7 The Translate Tabie . : : : : : : : : : : 1 : : : : : : : : : : : : : 1 : : : : : : 1 : : : : : : : : : : : : : : : 243 243 8.4.8 Example 244 B.4.9 Escape . 2 44 8.4.10 Bits . 244 B.4.11 Translate 244 8.4.12 Example .:24 5 B.4.13 Mapping of Characters to Bits 245 8.4.14 StagelTranslation . : 2
37、45 8.4.15 Stage 2 Translation . 245 8.4.16 Example . 246 8.4.17 Summary 24 6 B.5 Level 4 Description . 247 B.S.1 Physical Media . 247 B.S.2 Nine-track Magnetic Tape . 247 B.6 ExtendedExample . 24 8 Bibliography . , .*.,.,., . 253 INDEX . . . . . . . . 256 . . . VIII APL Standard INTERNATIONAL STANDA
38、RD IS0 - the words “chapter”, “section” and “subsection” are understood to mean “clause”, “subclause” and “sub- subclause”, respectively. 0. Introduction 3 IS0 9495 : 1999 (E) 1 SCOPE AND FIELD OF APPLICATION This standard defines the programming language APL and the environment in which APL program
39、s are executed. Its purpose is to facilitate interchange and promote portability of APL programs and programming skills. This standard specifies the syntax and semantics of APL programs and the characteristics of the environment in which APL programs are executed. It also specifies requirements for
40、conformance to this standard, including the publication of values and characteristics of implementation properties so that conforming implementations can be meaningfully compared. This standard does not specify: implementation properties that are likely to vary with the particular equipment or opera
41、ting system used; required values for implementation limits such as APL workspace size or numeric precision; the data structures used to represent APL objects; the facilities available through shared variables. I. Scope and Field of Application 5 IS0 8485 : 1999 (E) 2 REFERENCES IS0 2375 : 1985, Dat
42、a processing - Procedure for registration of escape sequences. IS0 2382-l 5 : 1985, Data processing - Vocabulary - Part 15: Programming languages. 2. References 7 IS0 8485 : 1989 (E) 3 FORM OF THE STANDARD This standard is a formal model of an APL machine, specified as a collection of finite sets, d
43、iagrams, and evaluation sequences, and objects constructed from finite sets, diagrams, and evaluation sequences. The finite sets are the implementation-defined character-set. the implementation-defined set of numbers, and the enumerated sets array-type, class-names, keyboard-states, mode-names, requ
44、ired-character-set, and workspace-presence. Diagrams are directed graphs used to designate syntactic forms. Evaluation sequences are formal procedures that operate on finite sets, diagrams, other evaluation sequences and objects defined in the standard. Objects are entities consisting of enumerated
45、set members and other objects. The objects are list, array, defined-function, token, symbol, context, workspace, session, shared-variable, and system, Each object has attributes describing its state. The attributes of an array, for example, are its typical element, its shape, and its ravel. Objects
46、often have defined properties derived from their attributes. The rank of an array, for example, is the shape of the shape of the array. 3.1 FORM OF DEFINITIONS Defined terms in this standard are always set in bold and indexed. The index entry begins with the page number of the definition followed by
47、 the page numbers of all references to the term. If the definition and a use of a term occur on the same page, that page number will occur twice in the Index. The following terms occur throughout the document and are not cross-indexed: character, content, class, item, and number. Note: Terms m thrs
48、document include both phrases such as implementatiorrparameter and words such as nil. Each definition in this standard takes one of four forms. (1) Regular definitions consist of the term being defined followed by a colon and the body of the definition. The term Boolean is defined in this way. (2) M
49、embers of an enumerated set are defined simply by being listed in the definition of the enumerated set. The term nil is defined in this way, as a member of the enumerated set class-names. (3) Diagrams are defined by directed graphs. The term expression is defined in this way. (4) Definitions of terms that designate evaluation sequences take the following form: The term being defined, such as scan. The forms that the evaluation mechanism used in the standard recognises as designating this term, such as 2