VSLisp Programmers Guide: VSLisp functions

Next Previous Contents

## 5. VSLisp functions

VSLisp core library contains it's own Lisp dialect. All it's functions will be explained in this chapter.

## 5.1 Essential Lisp functions

`l <-- (list x1 [x2 [x3 ...]])` - Create a new list from elements x1, x2, x3.

`x <-- (car l)` - Get list's head or NIL.

`x <-- (cdr l)` - Get list's tail or NIL.

`x <-- (nth n l)` - Get numbered list element. First element is 0.

`l <-- (cons l1 l2)` - Create a list with head l1 and tail l2.

`l <-- (append l x)` - Append x to l's last tail's head.

> Example:

> > `

> >     Lisp>> (append '(a b c) '(d e f))
> >      << ( a b c ( d e f))

> > `

`l <-- (append1 l x)` - Connect x to l's last tail.

> Example:

> > `

> >     Lisp>> (append1 '(a b c) '(d e f))
> >      << ( a b c d e f)

> > `

`x1 <-- (setq qa x1)` - Define symbol `a` in global table, and set it's value to `x1`. Symbol name is quoted.

`x1 <-- (set x x1)` - The same as `setq`, but symbol name evaluated.

`x1 <-- (setql qa x1 [t])` - Define symbol in local table, or in specified table.

`x1 <-- (setl x x1 [t])` - The same as `setql`, but symbol name evaluated.

`t <-- (stab n)` - Create symbol table with maximum size `n`.

`(atab y)` - Append symbol table to local table.

> Example:

> > `

> >     (defun f (x)
> >       (atab (stab 3))
> >       (setql t (+ x 2))
> >       (/ x t)
> >     )

> > `

> Here `(atab (stab ...))` construction is a something like local variables definition in C function.

`x <-- (eval l)` - Evaluate list `l`. Note - eval works in current context, not like eval in Common Lisp.

`c <-- (symbolp a)` - Check is `a` a symbol name (global symbol table)

## 5.2 Text functions

## 5.3 File functions

## 5.4 All others

## 5.5 COLORS library

`colors` library is defined internally in vslisp4 library, in `LC1` format. Colors named after famous "flavours". It is a something like OOP implementation for VSLisp, and some common functions like `defun`.

Next Previous Contents