What exactly is a symbol in lisp/scheme?

In Scheme and Racket, a symbol is like an immutable string that happens to be interned so that symbols can be compared with eq? (fast, essentially pointer comparison). Symbols and strings are separate data types. One use for symbols is lightweight enumerations. For example, one might say a direction is either ‘north, ‘south, ‘east, or … Read more

LET versus LET* in Common Lisp

LET itself is not a real primitive in a Functional Programming Language, since it can replaced with LAMBDA. Like this: (let ((a1 b1) (a2 b2) … (an bn)) (some-code a1 a2 … an)) is similar to ((lambda (a1 a2 … an) (some-code a1 a2 … an)) b1 b2 … bn) But (let* ((a1 b1) (a2 … Read more

values function in Common Lisp

Multiple Values in CL The language Common lisp is described in the ANSI standard INCITS 226-1994 (R2004) and has many implementations. Each can implement multiple values as it sees fit, and they are allowed, of course, to cons up a list for them (in fact, the Emacs Lisp compatibility layer for CL does just that … Read more

Variable references in lisp

With lexical scope one does not have access to variables that are not in the current scope. You also cannot pass lexical variables to other functions directly. Lisp evaluates variables and passes the values bound to these variables. There is nothing like first-class references to variables. Think functional! (let ((a 1)) (values (lambda (new-value) (setf … Read more