diff options
Diffstat (limited to 'lispref/objects.texi')
| -rw-r--r-- | lispref/objects.texi | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/lispref/objects.texi b/lispref/objects.texi index 3b51b96c780..cfb3864e9c9 100644 --- a/lispref/objects.texi +++ b/lispref/objects.texi | |||
| @@ -632,7 +632,7 @@ come to refer to any structure made out of cons cells. | |||
| 632 | 632 | ||
| 633 | @cindex atom | 633 | @cindex atom |
| 634 | Because cons cells are so central to Lisp, we also have a word for | 634 | Because cons cells are so central to Lisp, we also have a word for |
| 635 | ``an object which is not a cons cell''. These objects are called | 635 | ``an object which is not a cons cell.'' These objects are called |
| 636 | @dfn{atoms}. | 636 | @dfn{atoms}. |
| 637 | 637 | ||
| 638 | @cindex parenthesis | 638 | @cindex parenthesis |
| @@ -1195,18 +1195,19 @@ Hash tables have no read syntax, and print using hash notation. | |||
| 1195 | @node Function Type | 1195 | @node Function Type |
| 1196 | @subsection Function Type | 1196 | @subsection Function Type |
| 1197 | 1197 | ||
| 1198 | Just as functions in other programming languages are executable, | 1198 | Lisp functions are executable code, just like functions in other |
| 1199 | @dfn{Lisp function} objects are pieces of executable code. However, | 1199 | programming languages. In Lisp, unlike most languages, functions are |
| 1200 | functions in Lisp are primarily Lisp objects, and only secondarily the | 1200 | also Lisp objects. A non-compiled function in Lisp is a lambda |
| 1201 | text which represents them. These Lisp objects are lambda expressions: | 1201 | expression: that is, a list whose first element is the symbol |
| 1202 | lists whose first element is the symbol @code{lambda} (@pxref{Lambda | 1202 | @code{lambda} (@pxref{Lambda Expressions}). |
| 1203 | Expressions}). | ||
| 1204 | 1203 | ||
| 1205 | In most programming languages, it is impossible to have a function | 1204 | In most programming languages, it is impossible to have a function |
| 1206 | without a name. In Lisp, a function has no intrinsic name. A lambda | 1205 | without a name. In Lisp, a function has no intrinsic name. A lambda |
| 1207 | expression is also called an @dfn{anonymous function} (@pxref{Anonymous | 1206 | expression can be called as a function even though it has no name; to |
| 1208 | Functions}). A named function in Lisp is actually a symbol with a valid | 1207 | emphasize this, we also call it an @dfn{anonymous function} |
| 1209 | function in its function cell (@pxref{Defining Functions}). | 1208 | (@pxref{Anonymous Functions}). A named function in Lisp is just a |
| 1209 | symbol with a valid function in its function cell (@pxref{Defining | ||
| 1210 | Functions}). | ||
| 1210 | 1211 | ||
| 1211 | Most of the time, functions are called when their names are written in | 1212 | Most of the time, functions are called when their names are written in |
| 1212 | Lisp expressions in Lisp programs. However, you can construct or obtain | 1213 | Lisp expressions in Lisp programs. However, you can construct or obtain |
| @@ -1238,7 +1239,7 @@ without qualification, we mean a Lisp macro, not a keyboard macro. | |||
| 1238 | A @dfn{primitive function} is a function callable from Lisp but | 1239 | A @dfn{primitive function} is a function callable from Lisp but |
| 1239 | written in the C programming language. Primitive functions are also | 1240 | written in the C programming language. Primitive functions are also |
| 1240 | called @dfn{subrs} or @dfn{built-in functions}. (The word ``subr'' is | 1241 | called @dfn{subrs} or @dfn{built-in functions}. (The word ``subr'' is |
| 1241 | derived from ``subroutine''.) Most primitive functions evaluate all | 1242 | derived from ``subroutine.'') Most primitive functions evaluate all |
| 1242 | their arguments when they are called. A primitive function that does | 1243 | their arguments when they are called. A primitive function that does |
| 1243 | not evaluate all its arguments is called a @dfn{special form} | 1244 | not evaluate all its arguments is called a @dfn{special form} |
| 1244 | (@pxref{Special Forms}).@refill | 1245 | (@pxref{Special Forms}).@refill |
| @@ -1822,12 +1823,14 @@ This function returns a symbol naming the primitive type of | |||
| 1822 | @example | 1823 | @example |
| 1823 | (type-of 1) | 1824 | (type-of 1) |
| 1824 | @result{} integer | 1825 | @result{} integer |
| 1826 | @group | ||
| 1825 | (type-of 'nil) | 1827 | (type-of 'nil) |
| 1826 | @result{} symbol | 1828 | @result{} symbol |
| 1827 | (type-of '()) ; @r{@code{()} is @code{nil}.} | 1829 | (type-of '()) ; @r{@code{()} is @code{nil}.} |
| 1828 | @result{} symbol | 1830 | @result{} symbol |
| 1829 | (type-of '(x)) | 1831 | (type-of '(x)) |
| 1830 | @result{} cons | 1832 | @result{} cons |
| 1833 | @end group | ||
| 1831 | @end example | 1834 | @end example |
| 1832 | @end defun | 1835 | @end defun |
| 1833 | 1836 | ||