XLISP

# SAL

## Data Types

Data types used in SAL and XLISP:

`` |  | SAL | XLISP
`` | integer: |  | `1` | `1`
`` | float: |  | `1.0` | `1.0`
`` | string: |  | `"hello"` | `"hello"`
`` | symbol: |  | `name` | `name`
`` | keyword: |  | `symbol:` | `:symbol`
`` | list: |  | `{item-1 item-2 ...}` | `(item-1 item-2 ...)`
`` | array: |  | `array[index]` | `(aref array index)`
`` | boolean: |  | `#t` | `#f` | `t` | `nil`

Data types with different concepts:

SAL:

- expressions - evaluated to produce a return value
- statements - evaluated for side-effects

XLISP:

- character - a single ASCII character
- object - the XLISP object system
- stream - data type of unknown length
- subr - built-in function
- fsubr - special form
- closure - user defined function

A function to print the Lisp code, produced by the SAL compiler, to the screen:

    (defun test (string)
      (if (not (stringp string))
          (error "not a string" string)
          (pprint (third (second (sal-compile string nil nil "<console>"))))))

Back to top