comparison man/lispref/functions.texi @ 4905:755ae5b97edb

Change "special form" to "special operator" in our sources. Add a compatible function alias, and the relevant manual index entries. src/ChangeLog addition: 2010-01-31 Aidan Kehoe <kehoea@parhasard.net> * symbols.c (Fspecial_operator_p, syms_of_symbols): * eval.c (print_subr, Finteractive_p, Ffuncall) (Ffunction_min_args, Ffunction_max_args, vars_of_eval): * editfns.c: * data.c (Fsubr_max_args): * doc.c (Fbuilt_in_symbol_file): Change "special form" to "special operator" in our sources. man/ChangeLog addition: 2010-01-31 Aidan Kehoe <kehoea@parhasard.net> * xemacs/programs.texi (Defuns): * lispref/variables.texi (Local Variables, Defining Variables) (Setting Variables, Default Value): * lispref/symbols.texi (Definitions): * lispref/searching.texi (Saving Match Data): * lispref/positions.texi (Excursions, Narrowing): * lispref/objects.texi (Primitive Function Type): * lispref/macros.texi (Defining Macros, Backquote): * lispref/lispref.texi (Top): * lispref/intro.texi (A Sample Function Description): * lispref/help.texi (Help Functions): * lispref/functions.texi (What Is a Function, Simple Lambda) (Defining Functions, Calling Functions, Anonymous Functions): * lispref/frames.texi (Input Focus): * lispref/eval.texi (Forms, Function Indirection) (Special Operators, Quoting): * lispref/edebug-inc.texi (Instrumenting) (Specification Examples): * lispref/debugging.texi (Internals of Debugger): * lispref/control.texi (Control Structures, Sequencing): (Conditionals, Combining Conditions, Iteration): (Catch and Throw, Handling Errors): * lispref/commands.texi (Defining Commands, Using Interactive): Terminology change; special operator -> special form. Don't attempt to change this in texinfo.texi or cl.texi, which use macros I don't understand. * lispref/macros.texi (Defining Macros): Give an anonymous macro example here. * lispref/positions.texi (Excursions): Correct some documentation that called a couple of macros special forms. * lispref/searching.texi (Saving Match Data): Drop some documentation of how to write code that works with Emacs 18. * lispref/specifiers.texi (Adding Specifications): Correct this; #'let-specifier is a macro, not a special operator. * lispref/windows.texi (Window Configurations) (Selecting Windows): Correct this, #'save-selected-window and #'save-window-excursion are macros, not special operators. lisp/ChangeLog addition: 2010-01-31 Aidan Kehoe <kehoea@parhasard.net> * obsolete.el: * loadhist.el (symbol-file): * help.el (describe-function-1): * bytecomp.el: (byte-compile-save-current-buffer): * byte-optimize.el (byte-optimize-form-code-walker): * subr.el (subr-arity): Change "special form" to "special operator" in these files, it's the more logical term. * subr.el (special-form-p): Provide this alias for #'special-operator-p.
author Aidan Kehoe <kehoea@parhasard.net>
date Sun, 31 Jan 2010 20:28:01 +0000
parents 6780963faf78
children 99f8ebc082d9
comparison
equal deleted inserted replaced
4904:e91e3e353805 4905:755ae5b97edb
40 @table @dfn 40 @table @dfn
41 @item function 41 @item function
42 @cindex function 42 @cindex function
43 In XEmacs Lisp, a @dfn{function} is anything that can be applied to 43 In XEmacs Lisp, a @dfn{function} is anything that can be applied to
44 arguments in a Lisp program. In some cases, we use it more 44 arguments in a Lisp program. In some cases, we use it more
45 specifically to mean a function written in Lisp. Special forms and 45 specifically to mean a function written in Lisp. Special operators and
46 macros are not functions. 46 macros are not functions.
47 47
48 @item command 48 @item command
49 @cindex command 49 @cindex command
50 50
82 @cindex primitive 82 @cindex primitive
83 @cindex subr 83 @cindex subr
84 @cindex built-in function 84 @cindex built-in function
85 A @dfn{primitive} is a function callable from Lisp that is written in C, 85 A @dfn{primitive} is a function callable from Lisp that is written in C,
86 such as @code{car} or @code{append}. These functions are also called 86 such as @code{car} or @code{append}. These functions are also called
87 @dfn{built-in} functions or @dfn{subrs}. (Special forms are also 87 @dfn{built-in} functions or @dfn{subrs}. (Special operators are also
88 considered primitives.) 88 considered primitives.)
89 89
90 Usually the reason that a function is a primitives is because it is 90 Usually the reason that a function is a primitives is because it is
91 fundamental, because it provides a low-level interface to operating 91 fundamental, because it provides a low-level interface to operating
92 system services, or because it needs to run fast. Primitives can be 92 system services, or because it needs to run fast. Primitives can be
99 These are described in the following section. 99 These are described in the following section.
100 @ifinfo 100 @ifinfo
101 @xref{Lambda Expressions}. 101 @xref{Lambda Expressions}.
102 @end ifinfo 102 @end ifinfo
103 103
104 @item special form 104 @item special operator
105 A @dfn{special form} is a primitive that is like a function but does not 105 A @dfn{special operator} is a primitive that is like a function but does not
106 evaluate all of its arguments in the usual way. It may evaluate only 106 evaluate all of its arguments in the usual way. It may evaluate only
107 some of the arguments, or may evaluate them in an unusual order, or 107 some of the arguments, or may evaluate them in an unusual order, or
108 several times. Many special forms are described in @ref{Control 108 several times. Many special operators are described in @ref{Control
109 Structures}. 109 Structures}.
110 110
111 @item macro 111 @item macro
112 @cindex macro 112 @cindex macro
113 A @dfn{macro} is a construct defined in Lisp by the programmer. It 113 A @dfn{macro} is a construct defined in Lisp by the programmer. It
114 differs from a function in that it translates a Lisp expression that you 114 differs from a function in that it translates a Lisp expression that you
115 write into an equivalent expression to be evaluated instead of the 115 write into an equivalent expression to be evaluated instead of the
116 original expression. Macros enable Lisp programmers to do the sorts of 116 original expression. Macros enable Lisp programmers to do the sorts of
117 things that special forms can do. @xref{Macros}, for how to define and 117 things that special operators can do. @xref{Macros}, for how to define and
118 use macros. 118 use macros.
119 119
120 @item compiled function 120 @item compiled function
121 A @dfn{compiled function} is a function that has been compiled by the 121 A @dfn{compiled function} is a function that has been compiled by the
122 byte compiler. @xref{Compiled-Function Type}. 122 byte compiler. @xref{Compiled-Function Type}.
265 4)} from left to right. Then it applies the lambda expression to the 265 4)} from left to right. Then it applies the lambda expression to the
266 argument values 1, 6 and 1 to produce the value 8. 266 argument values 1, 6 and 1 to produce the value 8.
267 267
268 It is not often useful to write a lambda expression as the @sc{car} of 268 It is not often useful to write a lambda expression as the @sc{car} of
269 a form in this way. You can get the same result, of making local 269 a form in this way. You can get the same result, of making local
270 variables and giving them values, using the special form @code{let} 270 variables and giving them values, using the special operator @code{let}
271 (@pxref{Local Variables}). And @code{let} is clearer and easier to use. 271 (@pxref{Local Variables}). And @code{let} is clearer and easier to use.
272 In practice, lambda expressions are either stored as the function 272 In practice, lambda expressions are either stored as the function
273 definitions of symbols, to produce named functions, or passed as 273 definitions of symbols, to produce named functions, or passed as
274 arguments to other functions (@pxref{Anonymous Functions}). 274 arguments to other functions (@pxref{Anonymous Functions}).
275 275
276 However, calls to explicit lambda expressions were very useful in the 276 However, calls to explicit lambda expressions were very useful in the
277 old days of Lisp, before the special form @code{let} was invented. At 277 old days of Lisp, before the special operator @code{let} was invented. At
278 that time, they were the only way to bind and initialize local 278 that time, they were the only way to bind and initialize local
279 variables. 279 variables.
280 280
281 @node Argument List 281 @node Argument List
282 @subsection Advanced Features of Argument Lists 282 @subsection Advanced Features of Argument Lists
470 @section Defining Functions 470 @section Defining Functions
471 @cindex defining a function 471 @cindex defining a function
472 472
473 We usually give a name to a function when it is first created. This 473 We usually give a name to a function when it is first created. This
474 is called @dfn{defining a function}, and it is done with the 474 is called @dfn{defining a function}, and it is done with the
475 @code{defun} special form. 475 @code{defun} special operator.
476 476
477 @defspec defun name argument-list body-forms 477 @defspec defun name argument-list body-forms
478 @code{defun} is the usual way to define new Lisp functions. It 478 @code{defun} is the usual way to define new Lisp functions. It
479 defines the symbol @var{name} as a function that looks like this: 479 defines the symbol @var{name} as a function that looks like this:
480 480
545 deliberate redefinition from unintentional redefinition. 545 deliberate redefinition from unintentional redefinition.
546 @end defspec 546 @end defspec
547 547
548 @defun define-function name definition 548 @defun define-function name definition
549 @defunx defalias name definition 549 @defunx defalias name definition
550 These equivalent special forms define the symbol @var{name} as a 550 These equivalent primitives define the symbol @var{name} as a
551 function, with definition @var{definition} (which can be any valid Lisp 551 function, with definition @var{definition} (which can be any valid Lisp
552 function). 552 function).
553 553
554 The proper place to use @code{define-function} or @code{defalias} is 554 The proper place to use @code{define-function} or @code{defalias} is
555 where a specific function name is being defined---especially where that 555 where a specific function name is being defined---especially where that
599 @emph{not} evaluated a second time in the act of calling @var{function}; 599 @emph{not} evaluated a second time in the act of calling @var{function};
600 @code{funcall} enters the normal procedure for calling a function at the 600 @code{funcall} enters the normal procedure for calling a function at the
601 place where the arguments have already been evaluated. 601 place where the arguments have already been evaluated.
602 602
603 The argument @var{function} must be either a Lisp function or a 603 The argument @var{function} must be either a Lisp function or a
604 primitive function. Special forms and macros are not allowed, because 604 primitive function. Special operators and macros are not allowed, because
605 they make sense only when given the ``unevaluated'' argument 605 they make sense only when given the ``unevaluated'' argument
606 expressions. @code{funcall} cannot provide these because, as we saw 606 expressions. @code{funcall} cannot provide these because, as we saw
607 above, it never knows them in the first place. 607 above, it never knows them in the first place.
608 608
609 @example 609 @example
635 argument. We also say that @code{apply} @dfn{spreads} this list so that 635 argument. We also say that @code{apply} @dfn{spreads} this list so that
636 each individual element becomes an argument. 636 each individual element becomes an argument.
637 637
638 @code{apply} returns the result of calling @var{function}. As with 638 @code{apply} returns the result of calling @var{function}. As with
639 @code{funcall}, @var{function} must either be a Lisp function or a 639 @code{funcall}, @var{function} must either be a Lisp function or a
640 primitive function; special forms and macros do not make sense in 640 primitive function; special operators and macros do not make sense in
641 @code{apply}. 641 @code{apply}.
642 642
643 @example 643 @example
644 @group 644 @group
645 (setq f 'list) 645 (setq f 'list)
828 @result{} (4 22) 828 @result{} (4 22)
829 @end group 829 @end group
830 @end example 830 @end example
831 831
832 @noindent 832 @noindent
833 In such cases, we usually use the special form @code{function} instead 833 In such cases, we usually use the special operator @code{function} instead
834 of simple quotation to quote the anonymous function. 834 of simple quotation to quote the anonymous function.
835 835
836 @defspec function function-object 836 @defspec function function-object
837 @cindex function quoting 837 @cindex function quoting
838 This special form returns @var{function-object} without evaluating it. 838 This special operator returns @var{function-object} without evaluating it.
839 In this, it is equivalent to @code{quote}. However, it serves as a 839 In this, it is equivalent to @code{quote}. However, it serves as a
840 note to the XEmacs Lisp compiler that @var{function-object} is intended 840 note to the XEmacs Lisp compiler that @var{function-object} is intended
841 to be used only as a function, and therefore can safely be compiled. 841 to be used only as a function, and therefore can safely be compiled.
842 Contrast this with @code{quote}, in @ref{Quoting}. 842 Contrast this with @code{quote}, in @ref{Quoting}.
843 @end defspec 843 @end defspec