lisp-aez-notes

Home

lisp-logo.png

Table of Contents

Common Lisp

Syntax: white space

Additional white space and new lines are ignored!

Functions

Here is a simple example showing a function which returns a list of integer from a to b.

(defun seqint (a b) (loop for i from a to b collect i))

Loops: doloop

The following list will print the numbers 1 to 10.

(dolist (a (seqint 1 10)) (print a))

Global variables

The following expression creates a global parameter *foo* with the value 123. Note that the asterisk at the start and end are there by convention.

(defparameter *foo* 123)

There is also defvar which is the same but will not change a variable's value after it has been defined.

(defvar *foo* 321)

To change the value of a global variable use setf.

Author: Alexander E. Zarebski

Created: 2023-02-19 Sun 18:39

Validate