Reputation: 1532
When I was learning HTML it was very helpful for me to know that ol
means ordered list
, tr
is table row
, etc. Some of the lisp primitives/forms are easy: funcall
should be function call
, defmacro
- define macro
. Some are in the middle - incf
is... increment... f???
But because common lisp is so old, this primitives/special forms/etc... don't seem to ring a bell. Can you guys, help me with figuring them out? And even more importantly: Where can I find an authoritative resource on learning the meaning/history behind each and every one of them? (I will accept an answer based on this second question)
The documentation doesn't help me too:
* (describe #'let)
#<CLOSURE (:SPECIAL LET) {10013DC6AB}>
[compiled closure]
Lambda-list: (&REST ARGS)
Derived type: (FUNCTION (&REST T) NIL)
Documentation:
T
Source file: SYS:SRC;COMPILER;INFO-FUNCTIONS.LISP
* (documentation 'let 'function)
"LET ({(var [value]) | var}*) declaration* form*
During evaluation of the FORMS, bind the VARS to the result of evaluating the
VALUE forms. The variables are bound in parallel after all of the VALUES forms
have been evaluated."
* (inspect 'let)
The object is a SYMBOL.
0. Name: "LET"
1. Package: #<PACKAGE "COMMON-LISP">
2. Value: "unbound"
3. Function: #<CLOSURE (:SPECIAL LET) {10013DC6AB}>
4. Plist: (SB-WALKER::WALKER-TEMPLATE SB-WALKER::WALK-LET)
What do the following lisp primitives/special forms/special operators/functions mean?
(write more in the comments so we can make a good list!)
Upvotes: 1
Views: 447
Reputation: 139251
let
: LET variable-name be bound to a certain value flet
: LET Function-name be bound to a certain functionprogn
: execute a PROGram sequence and return the Nth value (the last value)car
: Contents of the Address Register (historic)cdr
: Contents of the Decrement Register (historic)acc
: ACCumulatorsetq
: SET Quote, a variant of the set
function, where in setq
the user doesn't quote the variablesetf
: SET Function quoted, shorter name of the original name setfq
. Here the function/place is not evaluated.incf
: INCrement Function quoted, similar to setf
. Increments a place.Other conventions:
f
at the end: setf
, psetf
, incf
, decf
, ...def
or define
in front: defun
, defmethod
, defclass
, define-method-combination
...n
in front, for Non-consing: nreverse
, ...p
or -p
at the end: adjustable-array-p
, alpha-char-p
,...*
at the front and back: *standard-output*
, ...There are other naming conventions.
Upvotes: 8
Reputation: 16156
let
: Well, that's a normal word, and is used like in maths ("let x = 3 in ...").flet
: I'd guess "function let
", because that's what it does.progn
: This is probably related also to prog1
and prog2
. I read is as "program whose nth form dictates the result value". The program has n forms, so it's the last one that forms the result value of the progn
form.car
and cdr
: "Contents address register" resp. "Contents decrement register". This is related to the IBM 704 which Lisp was originally implemented for.setq
: "set quote", originally an abbreviation for (set (quote *abc*) value)
.setf
: "set field", came up when lexical variables appeared. This is a good read on the set
functions. Where can I find an authoritative resource on learning the meaning/history behind each and every one of them?
The HyperSpec is a good place to start, and ultimately the ANSI standard. Though "Common Lisp The Language" could also shine some light on the history of some names.
(Oh, and you got defmacro
wrong, that's "Definition for Mac, Read Only." ;) )
Upvotes: 4