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

Separate Namespaces for Functions and Variables in Common Lisp versus Scheme

The two different approaches have names: Lisp-1 and Lisp-2. A Lisp-1 has a single namespace for both variables and functions (as in Scheme) while a Lisp-2 has separate namespaces for variables and functions (as in Common Lisp). I mention this because you may not be aware of the terminology since you didn’t refer to it … Read more

Why do we need funcall in Lisp?

Strictly speaking, funcall would not be needed, but there are some lisps (lisp-2 variants, such as Common Lisp) that separate the variable name space of the function name space. Lisp-1 variants (e.g. Scheme) do not make this distinction. More specifically, in your case, test-func is in the variable name space. (defun foo (test-func args) (funcall … Read more

How do multimethods solve the namespace issue?

Dynamic dispatch and namespace resolution are two different things. In many object systems classes are also used for namespaces. Also note that often both the class and the namespace are tied to a file. So these object systems conflate at least three things: class definitions with their slots and methods the namespace for identifiers the … Read more

What does the f in setf stand for?

The actual meaning of F is often forgotten. According to some sources, f suffix could stand for: Field (see for example this answer) Form (as seen in various teaching materials and manuals) However, according to Gabriel and Steele’s The Evolution of Lisp, SETF comes from Peter Deutsch’s A Lisp Machine with Very Compact Programs (published … Read more

How do I increment or decrement a number in Common Lisp?

Use the built-in “+” or “-” functions, or their shorthand “1+” or “1-“, if you just want to use the result, without modifying the original number (the argument). If you do want to modify the original place (containing a number), then use the built-in “incf” or “decf” functions. Using the addition operator: (setf num 41) … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)