Download ALisp User's Guide
Transcript
Table of contents 1. 2. 3. Introduction ......................................................................................................................... 4 Starting ALisp ..................................................................................................................... 4 Basic Primitives .................................................................................................................. 5 3.1. Data types........................................................................................................................ 6 3.2. Symbols........................................................................................................................... 6 3.2.1. Defining functions .................................................................................................. 7 3.2.2. Binding variables .................................................................................................... 8 3.2.3. Symbol manipulation ............................................................................................ 10 3.3. Lists ............................................................................................................................... 11 3.3.1. Destructive list functions ...................................................................................... 13 3.4. Strings ........................................................................................................................... 15 3.5. Numbers ........................................................................................................................ 16 3.6. Logical Functions.......................................................................................................... 17 3.7. Arrays ............................................................................................................................ 18 3.8. Hash Tables ................................................................................................................... 19 3.9. Main memory B-trees ................................................................................................... 20 3.10. Functional arguments and dynamic forms .................................................................... 21 3.10.1. Closures................................................................................................................. 22 3.10.2. Applying functions with variable arity ................................................................. 22 3.10.3. Dynamic evaluation .............................................................................................. 23 3.10.4. System functions for run-time evaluation ............................................................. 23 3.11. Map functions ............................................................................................................... 24 3.12. Control Structures ......................................................................................................... 25 3.12.1. Compound expressions ......................................................................................... 26 3.12.2. Conditional expressions ........................................................................................ 26 3.12.3. Iterative statements ............................................................................................... 27 3.12.4. Non-local returns .................................................................................................. 28 3.13. Macros........................................................................................................................... 28 3.14. Defining structures ........................................................................................................ 31 3.15. Miscellaneous functions................................................................................................ 32 3.16. Hooks ............................................................................................................................ 33 4. Time Functions ................................................................................................................. 34 4.1. System clock ................................................................................................................. 34 4.2. Absolute Time Values................................................................................................... 35 4.3. Relative time values ...................................................................................................... 35 4.4. Relative Date Values..................................................................................................... 35 5. Input and Output ............................................................................................................... 36 5.1. File I/O .......................................................................................................................... 38 5.2. Text streams .................................................................................................................. 39 5.3. Sockets .......................................................................................................................... 39 5.3.1. Point to point communication ............................................................................... 40 5.3.2. Remote evaluation ................................................................................................ 41 6. Error handling ................................................................................................................... 42 6.1. Trapping exceptions ...................................................................................................... 42 2