summaryrefslogtreecommitdiffstats
path: root/srfi-1.txi
blob: 4b2ed74da2314b6ac81622f8da25bd464386b4bc (plain)
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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
@code{(require 'srfi-1)}
@ftindex srfi-1

@noindent
Implements the @dfn{SRFI-1} @dfn{list-processing library} as described
@cindex SRFI-1
@cindex list-processing library
at @url{http://srfi.schemers.org/srfi-1/srfi-1.html}

@subheading Constructors


@defun xcons d a
@code{(define (xcons d a) (cons a d))}.
@end defun

@defun list-tabulate len proc
Returns a list of length @var{len}.  Element @var{i} is @code{(@var{proc}
@var{i})} for 0 <= @var{i} < @var{len}.
@end defun

@defun cons* obj1 obj2

@end defun

@defun list-copy flist

@end defun

@defun iota count start step


@defunx iota count start

@defunx iota count
Returns a list of @var{count} numbers: (@var{start}, @var{start}+@var{step}, @dots{},  @var{start}+(@var{count}-1)*@var{step}).
@end defun

@defun circular-list obj1 obj2 @dots{}

Returns a circular list of @var{obj1}, @var{obj2}, @dots{}.
@end defun
@subheading Predicates


@defun proper-list? obj

@end defun

@defun circular-list? x

@end defun

@defun dotted-list? obj

@end defun

@defun null-list? obj

@end defun

@defun not-pair? obj

@end defun

@defun list= =pred list @dots{}

@end defun
@subheading Selectors


@defun first pair

@end defun

@defun second pair

@end defun

@defun third pair

@end defun

@defun fourth pair

@end defun

@defun fifth pair
@defunx sixth obj
@defunx seventh obj
@defunx eighth obj
@defunx ninth obj
@defunx tenth obj

@end defun

@defun car+cdr pair

@end defun

@defun drop lst k
@defunx take lst k

@end defun

@deffn {Procedure} take! lst k

@end deffn

@defun take-right lst k

@end defun

@defun drop-right lst k

@end defun

@deffn {Procedure} drop-right! lst k

@end deffn

@defun split-at lst k

@end defun

@deffn {Procedure} split-at! lst k

@end deffn

@defun last lst

(car (last-pair lst))
@end defun
@subheading Miscellaneous


@defun length+ obj

@end defun

@defun concatenate lists
@defunx concatenate! lists

@end defun

@deffn {Procedure} reverse! lst

@end deffn

@defun append-reverse rev-head tail
@defunx append-reverse! rev-head tail

@end defun

@defun zip list1 list2 @dots{}

@end defun

@defun unzip1 lst
@defunx unzip2 lst
@defunx unzip3 lst
@defunx unzip4 lst
@defunx unzip5 lst

@end defun

@defun count pred list1 list2 @dots{}

@end defun
@subheading Fold and Unfold


@deffn {Procedure} map! f list1 clist2 @dots{}

@end deffn

@defun pair-for-each f clist1 clist2 @dots{}

@end defun
@subheading Filtering and Partitioning


@defun filter pred lis

@end defun

@deffn {Procedure} filter! pred l

@end deffn

@defun partition pred list

@end defun
@subheading Searching


@defun find pred list

@end defun

@defun find-tail pred list

@end defun

@defun remove pred l

@end defun

@deffn {Procedure} remove! pred l

@end deffn

@defun any pred clist1 clist2 @dots{}

@end defun

@defun list-index pred clist1 clist2 @dots{}

@end defun

@defun span pred list

@end defun

@defun member obj list pred


@defunx member obj list

@code{member} returns the first sublist of @var{list} whose car is @var{obj}, where the sublists
of @var{list} are the non-empty lists returned by @t{(list-tail @var{list} @var{k})}
for @var{k} less than the length of @var{list}.  If @var{obj} does not occur in @var{list},
then @t{#f} (not the empty list) is returned.  The procedure @var{pred} is
used for testing equality.  If @var{pred} is not provided, @samp{equal?} is
used.
@end defun
@subheading Deleting

@subheading Association lists


@defun assoc obj alist pred


@defunx assoc obj alist

@var{alist} (for ``association list'') must be a list of pairs.  These
procedures find the first pair in @var{alist} whose car field is @var{obj}, and
returns that pair.  If no pair in @var{alist} has @var{obj} as its car, then @t{#f}
(not the empty list) is returned.  The procedure @var{pred} is used for
testing equality.  If @var{pred} is not provided, @samp{equal?} is used.
@end defun
@subheading Set operations