Mercurial > hg > xemacs-beta
comparison man/lispref/eval.texi @ 5791:9fae6227ede5
Silence texinfo 5.2 warnings, primarily by adding next, prev, and up
pointers to all nodes. See xemacs-patches message with ID
<5315f7bf.sHpFD7lXYR05GH6E%james@xemacs.org>.
author | Jerry James <james@xemacs.org> |
---|---|
date | Thu, 27 Mar 2014 08:59:03 -0600 |
parents | a46c5c8d6564 |
children |
comparison
equal
deleted
inserted
replaced
5790:dcf9067f26bb | 5791:9fae6227ede5 |
---|---|
25 * Forms:: How various sorts of objects are evaluated. | 25 * Forms:: How various sorts of objects are evaluated. |
26 * Quoting:: Avoiding evaluation (to put constants in the program). | 26 * Quoting:: Avoiding evaluation (to put constants in the program). |
27 * Multiple values:: Functions may return more than one result. | 27 * Multiple values:: Functions may return more than one result. |
28 @end menu | 28 @end menu |
29 | 29 |
30 @node Intro Eval | 30 @node Intro Eval, Eval, Evaluation, Evaluation |
31 @section Introduction to Evaluation | 31 @section Introduction to Evaluation |
32 | 32 |
33 The Lisp interpreter, or evaluator, is the program that computes | 33 The Lisp interpreter, or evaluator, is the program that computes |
34 the value of an expression that is given to it. When a function | 34 the value of an expression that is given to it. When a function |
35 written in Lisp is called, the evaluator computes the value of the | 35 written in Lisp is called, the evaluator computes the value of the |
98 effects is @code{(setq foo 1)}. | 98 effects is @code{(setq foo 1)}. |
99 | 99 |
100 The details of what evaluation means for each kind of form are | 100 The details of what evaluation means for each kind of form are |
101 described below (@pxref{Forms}). | 101 described below (@pxref{Forms}). |
102 | 102 |
103 @node Eval | 103 @node Eval, Forms, Intro Eval, Evaluation |
104 @section Eval | 104 @section Eval |
105 @c ??? Perhaps this should be the last section in the chapter. | 105 @c ??? Perhaps this should be the last section in the chapter. |
106 | 106 |
107 Most often, forms are evaluated automatically, by virtue of their | 107 Most often, forms are evaluated automatically, by virtue of their |
108 occurrence in a program being run. On rare occasions, you may need to | 108 occurrence in a program being run. On rare occasions, you may need to |
234 @result{} 1 | 234 @result{} 1 |
235 @end group | 235 @end group |
236 @end example | 236 @end example |
237 @end defvar | 237 @end defvar |
238 | 238 |
239 @node Forms | 239 @node Forms, Quoting, Eval, Evaluation |
240 @section Kinds of Forms | 240 @section Kinds of Forms |
241 | 241 |
242 A Lisp object that is intended to be evaluated is called a @dfn{form}. | 242 A Lisp object that is intended to be evaluated is called a @dfn{form}. |
243 How XEmacs evaluates a form depends on its data type. XEmacs has three | 243 How XEmacs evaluates a form depends on its data type. XEmacs has three |
244 different kinds of form that are evaluated differently: symbols, lists, | 244 different kinds of form that are evaluated differently: symbols, lists, |
258 Also known as special forms. | 258 Also known as special forms. |
259 * Autoloading:: Functions set up to load files | 259 * Autoloading:: Functions set up to load files |
260 containing their real definitions. | 260 containing their real definitions. |
261 @end menu | 261 @end menu |
262 | 262 |
263 @node Self-Evaluating Forms | 263 @node Self-Evaluating Forms, Symbol Forms, Forms, Forms |
264 @subsection Self-Evaluating Forms | 264 @subsection Self-Evaluating Forms |
265 @cindex vector evaluation | 265 @cindex vector evaluation |
266 @cindex literal evaluation | 266 @cindex literal evaluation |
267 @cindex self-evaluating form | 267 @cindex self-evaluating form |
268 | 268 |
312 @print{} #<buffer eval.texi> | 312 @print{} #<buffer eval.texi> |
313 @result{} #<buffer eval.texi> | 313 @result{} #<buffer eval.texi> |
314 @end group | 314 @end group |
315 @end example | 315 @end example |
316 | 316 |
317 @node Symbol Forms | 317 @node Symbol Forms, Classifying Lists, Self-Evaluating Forms, Forms |
318 @subsection Symbol Forms | 318 @subsection Symbol Forms |
319 @cindex symbol evaluation | 319 @cindex symbol evaluation |
320 | 320 |
321 When a symbol is evaluated, it is treated as a variable. The result | 321 When a symbol is evaluated, it is treated as a variable. The result |
322 is the variable's value, if it has one. If it has none (if its value | 322 is the variable's value, if it has one. If it has none (if its value |
346 value of @code{nil} is always @code{nil}, and the value of @code{t} is | 346 value of @code{nil} is always @code{nil}, and the value of @code{t} is |
347 always @code{t}; you cannot set or bind them to any other values. Thus, | 347 always @code{t}; you cannot set or bind them to any other values. Thus, |
348 these two symbols act like self-evaluating forms, even though | 348 these two symbols act like self-evaluating forms, even though |
349 @code{eval} treats them like any other symbol. | 349 @code{eval} treats them like any other symbol. |
350 | 350 |
351 @node Classifying Lists | 351 @node Classifying Lists, Function Indirection, Symbol Forms, Forms |
352 @subsection Classification of List Forms | 352 @subsection Classification of List Forms |
353 @cindex list form evaluation | 353 @cindex list form evaluation |
354 | 354 |
355 A form that is a nonempty list is either a function call, a macro | 355 A form that is a nonempty list is either a function call, a macro |
356 call, or a special form, according to its first element. These three | 356 call, or a special form, according to its first element. These three |
362 element. This element alone determines what kind of form the list is | 362 element. This element alone determines what kind of form the list is |
363 and how the rest of the list is to be processed. The first element is | 363 and how the rest of the list is to be processed. The first element is |
364 @emph{not} evaluated, as it would be in some Lisp dialects such as | 364 @emph{not} evaluated, as it would be in some Lisp dialects such as |
365 Scheme. | 365 Scheme. |
366 | 366 |
367 @node Function Indirection | 367 @node Function Indirection, Function Forms, Classifying Lists, Forms |
368 @subsection Symbol Function Indirection | 368 @subsection Symbol Function Indirection |
369 @cindex symbol function indirection | 369 @cindex symbol function indirection |
370 @cindex indirection | 370 @cindex indirection |
371 @cindex void function | 371 @cindex void function |
372 | 372 |
461 (indirect-function (symbol-function function)) | 461 (indirect-function (symbol-function function)) |
462 function)) | 462 function)) |
463 @end smallexample | 463 @end smallexample |
464 @end defun | 464 @end defun |
465 | 465 |
466 @node Function Forms | 466 @node Function Forms, Macro Forms, Function Indirection, Forms |
467 @subsection Evaluation of Function Forms | 467 @subsection Evaluation of Function Forms |
468 @cindex function form evaluation | 468 @cindex function form evaluation |
469 @cindex function call | 469 @cindex function call |
470 | 470 |
471 If the first element of a list being evaluated is a Lisp function | 471 If the first element of a list being evaluated is a Lisp function |
485 is written in Lisp, the arguments are used to bind the argument | 485 is written in Lisp, the arguments are used to bind the argument |
486 variables of the function (@pxref{Lambda Expressions}); then the forms | 486 variables of the function (@pxref{Lambda Expressions}); then the forms |
487 in the function body are evaluated in order, and the value of the last | 487 in the function body are evaluated in order, and the value of the last |
488 body form becomes the value of the function call. | 488 body form becomes the value of the function call. |
489 | 489 |
490 @node Macro Forms | 490 @node Macro Forms, Special Operators, Function Forms, Forms |
491 @subsection Lisp Macro Evaluation | 491 @subsection Lisp Macro Evaluation |
492 @cindex macro call evaluation | 492 @cindex macro call evaluation |
493 | 493 |
494 If the first element of a list being evaluated is a macro object, then | 494 If the first element of a list being evaluated is a macro object, then |
495 the list is a @dfn{macro call}. When a macro call is evaluated, the | 495 the list is a @dfn{macro call}. When a macro call is evaluated, the |
531 Note that the argument @code{(assq 'handler list)} appears in the | 531 Note that the argument @code{(assq 'handler list)} appears in the |
532 expansion. | 532 expansion. |
533 | 533 |
534 @xref{Macros}, for a complete description of XEmacs Lisp macros. | 534 @xref{Macros}, for a complete description of XEmacs Lisp macros. |
535 | 535 |
536 @node Special Operators | 536 @node Special Operators, Autoloading, Macro Forms, Forms |
537 @subsection Special Operators | 537 @subsection Special Operators |
538 @cindex special operator evaluation | 538 @cindex special operator evaluation |
539 @cindex special form | 539 @cindex special form |
540 | 540 |
541 A @dfn{special operator} (historically, and less logically, a | 541 A @dfn{special operator} (historically, and less logically, a |
641 doesn't exist in Common Lisp. @code{throw} is a special operator in | 641 doesn't exist in Common Lisp. @code{throw} is a special operator in |
642 both Common Lisp and XEmacs Lisp (because it must be able to throw | 642 both Common Lisp and XEmacs Lisp (because it must be able to throw |
643 multiple values).@refill | 643 multiple values).@refill |
644 @end quotation | 644 @end quotation |
645 | 645 |
646 @node Autoloading | 646 @node Autoloading, , Special Operators, Forms |
647 @subsection Autoloading | 647 @subsection Autoloading |
648 | 648 |
649 The @dfn{autoload} feature allows you to call a function or macro | 649 The @dfn{autoload} feature allows you to call a function or macro |
650 whose function definition has not yet been loaded into XEmacs. It | 650 whose function definition has not yet been loaded into XEmacs. It |
651 specifies which file contains the definition. When an autoload object | 651 specifies which file contains the definition. When an autoload object |
652 appears as a symbol's function definition, calling that symbol as a | 652 appears as a symbol's function definition, calling that symbol as a |
653 function automatically loads the specified file; then it calls the real | 653 function automatically loads the specified file; then it calls the real |
654 definition loaded from that file. @xref{Autoload}. | 654 definition loaded from that file. @xref{Autoload}. |
655 | 655 |
656 @node Quoting | 656 @node Quoting, Multiple values, Forms, Evaluation |
657 @section Quoting | 657 @section Quoting |
658 @cindex quoting | 658 @cindex quoting |
659 | 659 |
660 The special operator @code{quote} returns its single argument, as written, | 660 The special operator @code{quote} returns its single argument, as written, |
661 without evaluating it. This provides a way to include constant symbols | 661 without evaluating it. This provides a way to include constant symbols |
708 Other quoting constructs include @code{function} (@pxref{Anonymous | 708 Other quoting constructs include @code{function} (@pxref{Anonymous |
709 Functions}), which causes an anonymous lambda expression written in Lisp | 709 Functions}), which causes an anonymous lambda expression written in Lisp |
710 to be compiled, and @samp{`} (@pxref{Backquote}), which is used to quote | 710 to be compiled, and @samp{`} (@pxref{Backquote}), which is used to quote |
711 only part of a list, while computing and substituting other parts. | 711 only part of a list, while computing and substituting other parts. |
712 | 712 |
713 @node Multiple values | 713 @node Multiple values, , Quoting, Evaluation |
714 @section Multiple values | 714 @section Multiple values |
715 @cindex multiple values | 715 @cindex multiple values |
716 | 716 |
717 @noindent | 717 @noindent |
718 Under XEmacs, expressions can return zero or more results, using the | 718 Under XEmacs, expressions can return zero or more results, using the |