File: iteration.texi

package info (click to toggle)
gcl27 2.7.1-13
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 30,888 kB
  • sloc: lisp: 211,946; ansic: 52,944; sh: 9,347; makefile: 647; tcl: 53; awk: 52
file content (149 lines) | stat: -rwxr-xr-x 3,336 bytes parent folder | download | duplicates (22)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
@node Iteration and Tests, User Interface, Structures, Top
@chapter Iteration and Tests

@deffn {Macro} DO-EXTERNAL-SYMBOLS 
Package:LISP

Syntax:
@example
(do-external-symbols (var [package [result-form]])
          @{decl@}* @{tag | statement@}*)
@end example

Executes STATEMENTs once for each external symbol in the PACKAGE (which
defaults to the current package), with VAR bound to the current symbol.
Then evaluates RESULT-FORM (which defaults to NIL) and returns the value(s).


@end deffn

@deffn {Special Form} DO* 
Package:LISP

Syntax:
@example
(do* (@{(var [init [step]])@}*) (endtest @{result@}*)
          @{decl@}* @{tag | statement@}*)
@end example

Just like DO, but performs variable bindings and assignments in serial, just
like LET* and SETQ do.


@end deffn

@deffn {Macro} DO-ALL-SYMBOLS 
Package:LISP

Syntax:
@example
(do-all-symbols (var [result-form]) @{decl@}* @{tag | statement@}*)
@end example

Executes STATEMENTs once for each symbol in each package, with VAR bound to
the current symbol.  Then evaluates RESULT-FORM (which defaults to NIL) and
returns the value(s).


@end deffn

@defun YES-OR-NO-P (&optional (format-string nil) &rest args)
Package:LISP

Asks the user a question whose answer is either 'YES' or 'NO'.  If FORMAT-
STRING is non-NIL, then FRESH-LINE operation is performed, a message is
printed as if FORMAT-STRING and ARGs were given to FORMAT, and then a prompt
"(Yes or No)" is printed.  Otherwise, no prompt will appear.


@end defun

@defun MAPHASH #'hash-table
Package:LISP

For each entry in HASH-TABLE, calls FUNCTION on the key and value of the
entry; returns NIL.


@end defun

@defun MAPCAR (fun list &rest more-lists)
Package:LISP

Applies FUN to successive cars of LISTs and returns the results as a list.


@end defun

@deffn {Special Form} DOLIST 
Package:LISP

Syntax:
@example
(dolist (var listform [result]) @{decl@}* @{tag | statement@}*)
@end example

Executes STATEMENTs, with VAR bound to each member of the list value of
LISTFORM.  Then returns the value(s) of RESULT (which defaults to NIL).


@end deffn

@defun EQ (x y)
Package:LISP

Returns T if X and Y are the same identical object; NIL otherwise.


@end defun

@defun EQUALP (x y)
Package:LISP

Returns T if X and Y are EQUAL, if they are characters and satisfy CHAR-EQUAL,
if they are numbers and have the same numerical value, or if they have
components that are all EQUALP.  Returns NIL otherwise.


@end defun

@defun EQUAL (x y)
Package:LISP

Returns T if X and Y are EQL or if they are of the same type and corresponding
components are EQUAL.  Returns NIL otherwise.  Strings and bit-vectors are
EQUAL if they are the same length and have identical components.  Other
arrays must be EQ to be EQUAL.


@end defun

@deffn {Macro} DO-SYMBOLS 
Package:LISP

Syntax:
@example
(do-symbols (var [package [result-form]]) @{decl@}* @{tag |
statement@}*)
@end example

Executes STATEMENTs once for each symbol in the PACKAGE (which defaults to
the current package), with VAR bound to the current symbol.  Then evaluates
RESULT-FORM (which defaults to NIL) and returns the value(s).


@end deffn

@deffn {Special Form} LOOP 
Package:LISP

Syntax:
@example
(loop @{form@}*)
@end example

Executes FORMs repeatedly until exited by a THROW or RETURN.  The FORMs are
surrounded by an implicit NIL block.


@end deffn