1 |
@c -*-texinfo-*- |
@c -*-texinfo-*- |
2 |
@c This is part of the GNU Emacs Lisp Reference Manual. |
@c This is part of the GNU Emacs Lisp Reference Manual. |
3 |
@c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1998, 1999, 2003 |
@c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1998, 1999, 2003, 2004 |
4 |
@c Free Software Foundation, Inc. |
@c Free Software Foundation, Inc. |
5 |
@c See the file elisp.texi for copying conditions. |
@c See the file elisp.texi for copying conditions. |
6 |
@setfilename ../info/objects |
@setfilename ../info/objects |
155 |
* Macro Type:: A method of expanding an expression into another |
* Macro Type:: A method of expanding an expression into another |
156 |
expression, more fundamental but less pretty. |
expression, more fundamental but less pretty. |
157 |
* Primitive Function Type:: A function written in C, callable from Lisp. |
* Primitive Function Type:: A function written in C, callable from Lisp. |
158 |
* Byte-Code Type:: A function written in Lisp, then compiled. |
* Funvec Type:: A vector type callable as a function. |
159 |
* Autoload Type:: A type used for automatically loading seldom-used |
* Autoload Type:: A type used for automatically loading seldom-used |
160 |
functions. |
functions. |
161 |
@end menu |
@end menu |
1200 |
@end group |
@end group |
1201 |
@end example |
@end example |
1202 |
|
|
1203 |
@node Byte-Code Type |
@node Funvec Type |
1204 |
@subsection Byte-Code Function Type |
@subsection ``Function Vector' Type |
1205 |
|
@cindex function vector |
1206 |
The byte compiler produces @dfn{byte-code function objects}. |
@cindex funvec |
1207 |
Internally, a byte-code function object is much like a vector; however, |
|
1208 |
the evaluator handles this data type specially when it appears as a |
A @dfn{function vector}, or @dfn{funvec} is a vector-like object whose |
1209 |
function to be called. @xref{Byte Compilation}, for information about |
purpose is to define special kinds of functions. You can examine or |
1210 |
the byte compiler. |
modify the contents of a funvec like a normal vector, using the |
1211 |
|
@code{aref} and @code{aset} functions. |
1212 |
The printed representation and read syntax for a byte-code function |
|
1213 |
object is like that for a vector, with an additional @samp{#} before the |
The behavior of a funvec when called is dependent on the kind of |
1214 |
opening @samp{[}. |
funvec it is, and that is determined by its first element (a |
1215 |
|
zero-length funvec will signal an error if called): |
1216 |
|
|
1217 |
|
@table @asis |
1218 |
|
@item A list |
1219 |
|
A funvec with a list as its first element is a byte-compiled function, |
1220 |
|
produced by the byte compiler; such funvecs are known as |
1221 |
|
@dfn{byte-code function objects}. @xref{Byte Compilation}, for |
1222 |
|
information about the byte compiler. |
1223 |
|
|
1224 |
|
@item The symbol @code{curry} |
1225 |
|
A funvec with @code{curry} as its first element is a ``curried function''. |
1226 |
|
|
1227 |
|
The second element in such a funvec is the function which is |
1228 |
|
being curried, and the remaining elements are a list of arguments. |
1229 |
|
|
1230 |
|
Calling such a funvec operates by calling the embedded function with |
1231 |
|
an argument list composed of the arguments in the funvec followed by |
1232 |
|
the arguments the funvec was called with. @xref{Function Currying}. |
1233 |
|
@end table |
1234 |
|
|
1235 |
|
The printed representation and read syntax for a funvec object is like |
1236 |
|
that for a vector, with an additional @samp{#} before the opening |
1237 |
|
@samp{[}. |
1238 |
|
|
1239 |
|
@defun funvecp object |
1240 |
|
@code{funvecp} returns @code{t} if @var{object} is a function vector |
1241 |
|
object (including byte-code objects), and @code{nil} otherwise. |
1242 |
|
@end defun |
1243 |
|
|
1244 |
|
@defun funvec kind &rest params |
1245 |
|
@code{funvec} returns a new function vector containing @var{kind} and |
1246 |
|
@var{params}. @var{kind} determines the type of funvec; it should be |
1247 |
|
one of the choices listed in the table above. |
1248 |
|
|
1249 |
|
Typically you should use the @code{make-byte-code} function to create |
1250 |
|
byte-code objects, though they are a type of funvec. |
1251 |
|
@end defun |
1252 |
|
|
1253 |
@node Autoload Type |
@node Autoload Type |
1254 |
@subsection Autoload Type |
@subsection Autoload Type |
1663 |
@xref{Buffer Basics, bufferp}. |
@xref{Buffer Basics, bufferp}. |
1664 |
|
|
1665 |
@item byte-code-function-p |
@item byte-code-function-p |
1666 |
@xref{Byte-Code Type, byte-code-function-p}. |
@xref{Funvec Type, byte-code-function-p}. |
1667 |
|
|
1668 |
@item case-table-p |
@item case-table-p |
1669 |
@xref{Case Tables, case-table-p}. |
@xref{Case Tables, case-table-p}. |