Download ALisp v2 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 ........................................................................................................................... 14
3.5.
Numbers........................................................................................................................ 15
3.6.
Logical Functions.......................................................................................................... 16
3.7.
Arrays............................................................................................................................ 17
3.8.
Hash Tables................................................................................................................... 19
3.9.
Main memory B-trees ................................................................................................... 20
3.10.
Functional arguments and dynamic forms................................................................ 21
3.10.1. Closures................................................................................................................. 21
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 ........................................................................................................... 23
3.12.
Control Structures ..................................................................................................... 25
3.12.1. Compound expressions ......................................................................................... 25
3.12.2. Conditional expressions ........................................................................................ 25
3.12.3. Iterative statements ............................................................................................... 27
3.12.4. Non-local returns .................................................................................................. 27
3.13.
Macros....................................................................................................................... 28
3.14.
Defining structures.................................................................................................... 30
3.15.
Miscellaneous functions............................................................................................ 31
3.16.
Hooks ........................................................................................................................ 32
4.
Time Functions ................................................................................................................. 33
4.1.
System clock ................................................................................................................. 33
4.2.
Absolute Time Values................................................................................................... 34
4.3.
Relative time values...................................................................................................... 34
4.4.
Relative Date Values..................................................................................................... 35
5.
Input and Output ............................................................................................................... 35
5.1.
File I/O .......................................................................................................................... 36
5.2.
Text streams .................................................................................................................. 37
5.3.
Sockets .......................................................................................................................... 38
5.3.1.
Point to point communication............................................................................... 38
5.3.2.
Remote evaluation ................................................................................................ 39
6.
Error handling ................................................................................................................... 40
6.1.
Trapping exceptions...................................................................................................... 41
2