199 |
New lists can be constructed by calling one of the following |
New lists can be constructed by calling one of the following |
200 |
procedures. |
procedures. |
201 |
|
|
202 |
@deffn procedure xcons d a |
@deffn {Scheme Procedure} xcons d a |
203 |
Like @code{cons}, but with interchanged arguments. Useful mostly when |
Like @code{cons}, but with interchanged arguments. Useful mostly when |
204 |
passed to higher-order procedures. |
passed to higher-order procedures. |
205 |
@end deffn |
@end deffn |
206 |
|
|
207 |
@deffn procedure list-tabulate n init-proc |
@deffn {Scheme Procedure} list-tabulate n init-proc |
208 |
Return an @var{n}-element list, where each list element is produced by |
Return an @var{n}-element list, where each list element is produced by |
209 |
applying the procedure @var{init-proc} to the corresponding list |
applying the procedure @var{init-proc} to the corresponding list |
210 |
index. The order in which @var{init-proc} is applied to the indices |
index. The order in which @var{init-proc} is applied to the indices |
211 |
is not specified. |
is not specified. |
212 |
@end deffn |
@end deffn |
213 |
|
|
214 |
@deffn procedure circular-list elt1 elt2 @dots{} |
@deffn {Scheme Procedure} circular-list elt1 elt2 @dots{} |
215 |
Return a circular list containing the given arguments @var{elt1} |
Return a circular list containing the given arguments @var{elt1} |
216 |
@var{elt2} @dots{}. |
@var{elt2} @dots{}. |
217 |
@end deffn |
@end deffn |
218 |
|
|
219 |
@deffn procedure iota count [start step] |
@deffn {Scheme Procedure} iota count [start step] |
220 |
Return a list containing @var{count} elements, where each element is |
Return a list containing @var{count} elements, where each element is |
221 |
calculated as follows: |
calculated as follows: |
222 |
|
|
233 |
|
|
234 |
The procedures in this section test specific properties of lists. |
The procedures in this section test specific properties of lists. |
235 |
|
|
236 |
@deffn procedure proper-list? obj |
@deffn {Scheme Procedure} proper-list? obj |
237 |
Return @code{#t} if @var{obj} is a proper list, that is a finite list, |
Return @code{#t} if @var{obj} is a proper list, that is a finite list, |
238 |
terminated with the empty list. Otherwise, return @code{#f}. |
terminated with the empty list. Otherwise, return @code{#f}. |
239 |
@end deffn |
@end deffn |
240 |
|
|
241 |
@deffn procedure circular-list? obj |
@deffn {Scheme Procedure} circular-list? obj |
242 |
Return @code{#t} if @var{obj} is a circular list, otherwise return |
Return @code{#t} if @var{obj} is a circular list, otherwise return |
243 |
@code{#f}. |
@code{#f}. |
244 |
@end deffn |
@end deffn |
245 |
|
|
246 |
@deffn procedure dotted-list? obj |
@deffn {Scheme Procedure} dotted-list? obj |
247 |
Return @code{#t} if @var{obj} is a dotted list, return @code{#f} |
Return @code{#t} if @var{obj} is a dotted list, return @code{#f} |
248 |
otherwise. A dotted list is a finite list which is not terminated by |
otherwise. A dotted list is a finite list which is not terminated by |
249 |
the empty list, but some other value. |
the empty list, but some other value. |
250 |
@end deffn |
@end deffn |
251 |
|
|
252 |
@deffn procedure null-list? lst |
@deffn {Scheme Procedure} null-list? lst |
253 |
Return @code{#t} if @var{lst} is the empty list @code{()}, @code{#f} |
Return @code{#t} if @var{lst} is the empty list @code{()}, @code{#f} |
254 |
otherwise. If something else than a proper or circular list is passed |
otherwise. If something else than a proper or circular list is passed |
255 |
as @var{lst}, an error is signalled. This procedure is recommended |
as @var{lst}, an error is signalled. This procedure is recommended |
257 |
not allowed. |
not allowed. |
258 |
@end deffn |
@end deffn |
259 |
|
|
260 |
@deffn procedure not-pair? obj |
@deffn {Scheme Procedure} not-pair? obj |
261 |
Return @code{#t} is @var{obj} is not a pair, @code{#f} otherwise. |
Return @code{#t} is @var{obj} is not a pair, @code{#f} otherwise. |
262 |
This is shorthand notation @code{(not (pair? @var{obj}))} and is |
This is shorthand notation @code{(not (pair? @var{obj}))} and is |
263 |
supposed to be used for end-of-list checking in contexts where dotted |
supposed to be used for end-of-list checking in contexts where dotted |
264 |
lists are allowed. |
lists are allowed. |
265 |
@end deffn |
@end deffn |
266 |
|
|
267 |
@deffn procedure list= elt= list1 @dots{} |
@deffn {Scheme Procedure} list= elt= list1 @dots{} |
268 |
Return @code{#t} if all argument lists are equal, @code{#f} otherwise. |
Return @code{#t} if all argument lists are equal, @code{#f} otherwise. |
269 |
List equality is determined by testing whether all lists have the same |
List equality is determined by testing whether all lists have the same |
270 |
length and the corresponding elements are equal in the sense of the |
length and the corresponding elements are equal in the sense of the |
278 |
|
|
279 |
@c FIXME::martin: Review me! |
@c FIXME::martin: Review me! |
280 |
|
|
281 |
@deffn procedure first pair |
@deffn {Scheme Procedure} first pair |
282 |
@deffnx procedure second pair |
@deffnx {Scheme Procedure} second pair |
283 |
@deffnx procedure third pair |
@deffnx {Scheme Procedure} third pair |
284 |
@deffnx procedure fourth pair |
@deffnx {Scheme Procedure} fourth pair |
285 |
@deffnx procedure fifth pair |
@deffnx {Scheme Procedure} fifth pair |
286 |
@deffnx procedure sixth pair |
@deffnx {Scheme Procedure} sixth pair |
287 |
@deffnx procedure seventh pair |
@deffnx {Scheme Procedure} seventh pair |
288 |
@deffnx procedure eighth pair |
@deffnx {Scheme Procedure} eighth pair |
289 |
@deffnx procedure ninth pair |
@deffnx {Scheme Procedure} ninth pair |
290 |
@deffnx procedure tenth pair |
@deffnx {Scheme Procedure} tenth pair |
291 |
These are synonyms for @code{car}, @code{cadr}, @code{caddr}, @dots{}. |
These are synonyms for @code{car}, @code{cadr}, @code{caddr}, @dots{}. |
292 |
@end deffn |
@end deffn |
293 |
|
|
294 |
@deffn procedure car+cdr pair |
@deffn {Scheme Procedure} car+cdr pair |
295 |
Return two values, the @sc{car} and the @sc{cdr} of @var{pair}. |
Return two values, the @sc{car} and the @sc{cdr} of @var{pair}. |
296 |
@end deffn |
@end deffn |
297 |
|
|
298 |
@deffn procedure take lst i |
@deffn {Scheme Procedure} take lst i |
299 |
@deffnx procedure take! lst i |
@deffnx {Scheme Procedure} take! lst i |
300 |
Return a list containing the first @var{i} elements of @var{lst}. |
Return a list containing the first @var{i} elements of @var{lst}. |
301 |
|
|
302 |
@code{take!} may modify the structure of the argument list @var{lst} |
@code{take!} may modify the structure of the argument list @var{lst} |
303 |
in order to produce the result. |
in order to produce the result. |
304 |
@end deffn |
@end deffn |
305 |
|
|
306 |
@deffn procedure drop lst i |
@deffn {Scheme Procedure} drop lst i |
307 |
Return a list containing all but the first @var{i} elements of |
Return a list containing all but the first @var{i} elements of |
308 |
@var{lst}. |
@var{lst}. |
309 |
@end deffn |
@end deffn |
310 |
|
|
311 |
@deffn procedure take-right lst i |
@deffn {Scheme Procedure} take-right lst i |
312 |
Return the a list containing the @var{i} last elements of @var{lst}. |
Return the a list containing the @var{i} last elements of @var{lst}. |
313 |
@end deffn |
@end deffn |
314 |
|
|
315 |
@deffn procedure drop-right lst i |
@deffn {Scheme Procedure} drop-right lst i |
316 |
@deffnx procedure drop-right! lst i |
@deffnx {Scheme Procedure} drop-right! lst i |
317 |
Return the a list containing all but the @var{i} last elements of |
Return the a list containing all but the @var{i} last elements of |
318 |
@var{lst}. |
@var{lst}. |
319 |
|
|
321 |
@var{lst} in order to produce the result. |
@var{lst} in order to produce the result. |
322 |
@end deffn |
@end deffn |
323 |
|
|
324 |
@deffn procedure split-at lst i |
@deffn {Scheme Procedure} split-at lst i |
325 |
@deffnx procedure split-at! lst i |
@deffnx {Scheme Procedure} split-at! lst i |
326 |
Return two values, a list containing the first @var{i} elements of the |
Return two values, a list containing the first @var{i} elements of the |
327 |
list @var{lst} and a list containing the remaining elements. |
list @var{lst} and a list containing the remaining elements. |
328 |
|
|
330 |
@var{lst} in order to produce the result. |
@var{lst} in order to produce the result. |
331 |
@end deffn |
@end deffn |
332 |
|
|
333 |
@deffn procedure last lst |
@deffn {Scheme Procedure} last lst |
334 |
Return the last element of the non-empty, finite list @var{lst}. |
Return the last element of the non-empty, finite list @var{lst}. |
335 |
@end deffn |
@end deffn |
336 |
|
|
340 |
|
|
341 |
@c FIXME::martin: Review me! |
@c FIXME::martin: Review me! |
342 |
|
|
343 |
@deffn procedure length+ lst |
@deffn {Scheme Procedure} length+ lst |
344 |
Return the length of the argument list @var{lst}. When @var{lst} is a |
Return the length of the argument list @var{lst}. When @var{lst} is a |
345 |
circular list, @code{#f} is returned. |
circular list, @code{#f} is returned. |
346 |
@end deffn |
@end deffn |
347 |
|
|
348 |
@deffn procedure concatenate list-of-lists |
@deffn {Scheme Procedure} concatenate list-of-lists |
349 |
@deffnx procedure concatenate! list-of-lists |
@deffnx {Scheme Procedure} concatenate! list-of-lists |
350 |
Construct a list by appending all lists in @var{list-of-lists}. |
Construct a list by appending all lists in @var{list-of-lists}. |
351 |
|
|
352 |
@code{concatenate!} may modify the structure of the given lists in |
@code{concatenate!} may modify the structure of the given lists in |
353 |
order to produce the result. |
order to produce the result. |
354 |
@end deffn |
@end deffn |
355 |
|
|
356 |
@deffn procedure append-reverse rev-head tail |
@deffn {Scheme Procedure} append-reverse rev-head tail |
357 |
@deffnx procedure append-reverse! rev-head tail |
@deffnx {Scheme Procedure} append-reverse! rev-head tail |
358 |
Reverse @var{rev-head}, append @var{tail} and return the result. This |
Reverse @var{rev-head}, append @var{tail} and return the result. This |
359 |
is equivalent to @code{(append (reverse @var{rev-head}) @var{tail})}, |
is equivalent to @code{(append (reverse @var{rev-head}) @var{tail})}, |
360 |
but more efficient. |
but more efficient. |
363 |
the result. |
the result. |
364 |
@end deffn |
@end deffn |
365 |
|
|
366 |
@deffn procedure zip lst1 lst2 @dots{} |
@deffn {Scheme Procedure} zip lst1 lst2 @dots{} |
367 |
Return a list as long as the shortest of the argument lists, where |
Return a list as long as the shortest of the argument lists, where |
368 |
each element is a list. The first list contains the first elements of |
each element is a list. The first list contains the first elements of |
369 |
the argument lists, the second list contains the second elements, and |
the argument lists, the second list contains the second elements, and |
370 |
so on. |
so on. |
371 |
@end deffn |
@end deffn |
372 |
|
|
373 |
@deffn procedure unzip1 lst |
@deffn {Scheme Procedure} unzip1 lst |
374 |
@deffnx procedure unzip2 lst |
@deffnx {Scheme Procedure} unzip2 lst |
375 |
@deffnx procedure unzip3 lst |
@deffnx {Scheme Procedure} unzip3 lst |
376 |
@deffnx procedure unzip4 lst |
@deffnx {Scheme Procedure} unzip4 lst |
377 |
@deffnx procedure unzip5 lst |
@deffnx {Scheme Procedure} unzip5 lst |
378 |
@code{unzip1} takes a list of lists, and returns a list containing the |
@code{unzip1} takes a list of lists, and returns a list containing the |
379 |
first elements of each list, @code{unzip2} returns two lists, the |
first elements of each list, @code{unzip2} returns two lists, the |
380 |
first containing the first elements of each lists and the second |
first containing the first elements of each lists and the second |
387 |
|
|
388 |
@c FIXME::martin: Review me! |
@c FIXME::martin: Review me! |
389 |
|
|
390 |
@deffn procedure fold kons knil lst1 lst2 @dots{} |
@deffn {Scheme Procedure} fold kons knil lst1 lst2 @dots{} |
391 |
Fold the procedure @var{kons} across all elements of @var{lst1}, |
Fold the procedure @var{kons} across all elements of @var{lst1}, |
392 |
@var{lst2}, @dots{}. Produce the result of |
@var{lst2}, @dots{}. Produce the result of |
393 |
|
|
398 |
@dots{}. |
@dots{}. |
399 |
@end deffn |
@end deffn |
400 |
|
|
401 |
@deffn procedure fold-right kons knil lst1 lst2 @dots{} |
@deffn {Scheme Procedure} fold-right kons knil lst1 lst2 @dots{} |
402 |
Similar to @code{fold}, but applies @var{kons} in right-to-left order |
Similar to @code{fold}, but applies @var{kons} in right-to-left order |
403 |
to the list elements, that is: |
to the list elements, that is: |
404 |
|
|
406 |
@var{e22} @dots{} (@var{kons} @var{en1} @var{en2} @var{knil})))}, |
@var{e22} @dots{} (@var{kons} @var{en1} @var{en2} @var{knil})))}, |
407 |
@end deffn |
@end deffn |
408 |
|
|
409 |
@deffn procedure pair-fold kons knil lst1 lst2 @dots{} |
@deffn {Scheme Procedure} pair-fold kons knil lst1 lst2 @dots{} |
410 |
Like @code{fold}, but apply @var{kons} to the pairs of the list |
Like @code{fold}, but apply @var{kons} to the pairs of the list |
411 |
instead of the list elements. |
instead of the list elements. |
412 |
@end deffn |
@end deffn |
413 |
|
|
414 |
@deffn procedure pair-fold-right kons knil lst1 lst2 @dots{} |
@deffn {Scheme Procedure} pair-fold-right kons knil lst1 lst2 @dots{} |
415 |
Like @code{fold-right}, but apply @var{kons} to the pairs of the list |
Like @code{fold-right}, but apply @var{kons} to the pairs of the list |
416 |
instead of the list elements. |
instead of the list elements. |
417 |
@end deffn |
@end deffn |
418 |
|
|
419 |
@deffn procedure reduce f ridentity lst |
@deffn {Scheme Procedure} reduce f ridentity lst |
420 |
@code{reduce} is a variant of @code{reduce}. If @var{lst} is |
@code{reduce} is a variant of @code{reduce}. If @var{lst} is |
421 |
@code{()}, @var{ridentity} is returned. Otherwise, @code{(fold (car |
@code{()}, @var{ridentity} is returned. Otherwise, @code{(fold (car |
422 |
@var{lst}) (cdr @var{lst}))} is returned. |
@var{lst}) (cdr @var{lst}))} is returned. |
423 |
@end deffn |
@end deffn |
424 |
|
|
425 |
@deffn procedure reduce-right f ridentity lst |
@deffn {Scheme Procedure} reduce-right f ridentity lst |
426 |
This is the @code{fold-right} variant of @var{reduce}. |
This is the @code{fold-right} variant of @var{reduce}. |
427 |
@end deffn |
@end deffn |
428 |
|
|
429 |
@deffn procedure unfold p f g seed [tail-gen] |
@deffn {Scheme Procedure} unfold p f g seed [tail-gen] |
430 |
@code{unfold} is defined as follows: |
@code{unfold} is defined as follows: |
431 |
|
|
432 |
@lisp |
@lisp |
458 |
left-to-right order, and @var{p} tells when to stop unfolding. |
left-to-right order, and @var{p} tells when to stop unfolding. |
459 |
@end deffn |
@end deffn |
460 |
|
|
461 |
@deffn procedure unfold-right p f g seed [tail] |
@deffn {Scheme Procedure} unfold-right p f g seed [tail] |
462 |
Construct a list with the following loop. |
Construct a list with the following loop. |
463 |
|
|
464 |
@lisp |
@lisp |
487 |
|
|
488 |
@end deffn |
@end deffn |
489 |
|
|
490 |
@deffn procedure map f lst1 lst2 @dots{} |
@deffn {Scheme Procedure} map f lst1 lst2 @dots{} |
491 |
Map the procedure over the list(s) @var{lst1}, @var{lst2}, @dots{} and |
Map the procedure over the list(s) @var{lst1}, @var{lst2}, @dots{} and |
492 |
return a list containing the results of the procedure applications. |
return a list containing the results of the procedure applications. |
493 |
This procedure is extended with respect to R5RS, because the argument |
This procedure is extended with respect to R5RS, because the argument |
496 |
will be applied to the list element(s) is not specified. |
will be applied to the list element(s) is not specified. |
497 |
@end deffn |
@end deffn |
498 |
|
|
499 |
@deffn procedure for-each f lst1 lst2 @dots{} |
@deffn {Scheme Procedure} for-each f lst1 lst2 @dots{} |
500 |
Apply the procedure @var{f} to each pair of corresponding elements of |
Apply the procedure @var{f} to each pair of corresponding elements of |
501 |
the list(s) @var{lst1}, @var{lst2}, @dots{}. The return value is not |
the list(s) @var{lst1}, @var{lst2}, @dots{}. The return value is not |
502 |
specified. This procedure is extended with respect to R5RS, because |
specified. This procedure is extended with respect to R5RS, because |
506 |
|
|
507 |
@end deffn |
@end deffn |
508 |
|
|
509 |
@deffn procedure append-map f lst1 lst2 @dots{} |
@deffn {Scheme Procedure} append-map f lst1 lst2 @dots{} |
510 |
@deffnx procedure append-map! f lst1 lst2 @dots{} |
@deffnx {Scheme Procedure} append-map! f lst1 lst2 @dots{} |
511 |
Equivalent to |
Equivalent to |
512 |
|
|
513 |
@lisp |
@lisp |
530 |
made is not specified. |
made is not specified. |
531 |
@end deffn |
@end deffn |
532 |
|
|
533 |
@deffn procedure map! f lst1 lst2 @dots{} |
@deffn {Scheme Procedure} map! f lst1 lst2 @dots{} |
534 |
Linear-update variant of @code{map} -- @code{map!} is allowed, but not |
Linear-update variant of @code{map} -- @code{map!} is allowed, but not |
535 |
required, to alter the cons cells of @var{lst1} to construct the |
required, to alter the cons cells of @var{lst1} to construct the |
536 |
result list. |
result list. |
540 |
@dots{} must have at least as many elements as @var{lst1}. |
@dots{} must have at least as many elements as @var{lst1}. |
541 |
@end deffn |
@end deffn |
542 |
|
|
543 |
@deffn procedure pair-for-each f lst1 lst2 @dots{} |
@deffn {Scheme Procedure} pair-for-each f lst1 lst2 @dots{} |
544 |
Like @code{for-each}, but applies the procedure @var{f} to the pairs |
Like @code{for-each}, but applies the procedure @var{f} to the pairs |
545 |
from which the argument lists are constructed, instead of the list |
from which the argument lists are constructed, instead of the list |
546 |
elements. The return value is not specified. |
elements. The return value is not specified. |
547 |
@end deffn |
@end deffn |
548 |
|
|
549 |
@deffn procedure filter-map f lst1 lst2 @dots{} |
@deffn {Scheme Procedure} filter-map f lst1 lst2 @dots{} |
550 |
Like @code{map}, but only results from the applications of @var{f} |
Like @code{map}, but only results from the applications of @var{f} |
551 |
which are true are saved in the result list. |
which are true are saved in the result list. |
552 |
@end deffn |
@end deffn |
562 |
list elements, one which contains the elements satisfying a condition, |
list elements, one which contains the elements satisfying a condition, |
563 |
and the other for the elements which don't. |
and the other for the elements which don't. |
564 |
|
|
565 |
@deffn procedure filter pred lst |
@deffn {Scheme Procedure} filter pred lst |
566 |
@deffnx procedure filter! pred lst |
@deffnx {Scheme Procedure} filter! pred lst |
567 |
Return a list containing all elements from @var{lst} which satisfy the |
Return a list containing all elements from @var{lst} which satisfy the |
568 |
predicate @var{pred}. The elements in the result list have the same |
predicate @var{pred}. The elements in the result list have the same |
569 |
order as in @var{lst}. The order in which @var{pred} is applied to |
order as in @var{lst}. The order in which @var{pred} is applied to |
572 |
@code{filter!} is allowed, but not required to modify the structure of |
@code{filter!} is allowed, but not required to modify the structure of |
573 |
@end deffn |
@end deffn |
574 |
|
|
575 |
@deffn procedure partition pred lst |
@deffn {Scheme Procedure} partition pred lst |
576 |
@deffnx procedure partition! pred lst |
@deffnx {Scheme Procedure} partition! pred lst |
577 |
Return two lists, one containing all elements from @var{lst} which |
Return two lists, one containing all elements from @var{lst} which |
578 |
satisfy the predicate @var{pred}, and one list containing the elements |
satisfy the predicate @var{pred}, and one list containing the elements |
579 |
which do not satisfy the predicated. The elements in the result lists |
which do not satisfy the predicated. The elements in the result lists |
584 |
the input list. |
the input list. |
585 |
@end deffn |
@end deffn |
586 |
|
|
587 |
@deffn procedure remove pred lst |
@deffn {Scheme Procedure} remove pred lst |
588 |
@deffnx procedure remove! pred lst |
@deffnx {Scheme Procedure} remove! pred lst |
589 |
Return a list containing all elements from @var{lst} which do not |
Return a list containing all elements from @var{lst} which do not |
590 |
satisfy the predicate @var{pred}. The elements in the result list |
satisfy the predicate @var{pred}. The elements in the result list |
591 |
have the same order as in @var{lst}. The order in which @var{pred} is |
have the same order as in @var{lst}. The order in which @var{pred} is |
605 |
predicate or a comparison object for determining which elements are to |
predicate or a comparison object for determining which elements are to |
606 |
be searched. |
be searched. |
607 |
|
|
608 |
@deffn procedure find pred lst |
@deffn {Scheme Procedure} find pred lst |
609 |
Return the first element of @var{lst} which satisfies the predicate |
Return the first element of @var{lst} which satisfies the predicate |
610 |
@var{pred} and @code{#f} if no such element is found. |
@var{pred} and @code{#f} if no such element is found. |
611 |
@end deffn |
@end deffn |
612 |
|
|
613 |
@deffn procedure find-tail pred lst |
@deffn {Scheme Procedure} find-tail pred lst |
614 |
Return the first pair of @var{lst} whose @sc{car} satisfies the |
Return the first pair of @var{lst} whose @sc{car} satisfies the |
615 |
predicate @var{pred} and @code{#f} if no such element is found. |
predicate @var{pred} and @code{#f} if no such element is found. |
616 |
@end deffn |
@end deffn |
617 |
|
|
618 |
@deffn procedure take-while pred lst |
@deffn {Scheme Procedure} take-while pred lst |
619 |
@deffnx procedure take-while! pred lst |
@deffnx {Scheme Procedure} take-while! pred lst |
620 |
Return the longest initial prefix of @var{lst} whose elements all |
Return the longest initial prefix of @var{lst} whose elements all |
621 |
satisfy the predicate @var{pred}. |
satisfy the predicate @var{pred}. |
622 |
|
|
624 |
list while producing the result. |
list while producing the result. |
625 |
@end deffn |
@end deffn |
626 |
|
|
627 |
@deffn procedure drop-while pred lst |
@deffn {Scheme Procedure} drop-while pred lst |
628 |
Drop the longest initial prefix of @var{lst} whose elements all |
Drop the longest initial prefix of @var{lst} whose elements all |
629 |
satisfy the predicate @var{pred}. |
satisfy the predicate @var{pred}. |
630 |
@end deffn |
@end deffn |
631 |
|
|
632 |
@deffn procedure span pred lst |
@deffn {Scheme Procedure} span pred lst |
633 |
@deffnx procedure span! pred lst |
@deffnx {Scheme Procedure} span! pred lst |
634 |
@deffnx procedure break pred lst |
@deffnx {Scheme Procedure} break pred lst |
635 |
@deffnx procedure break! pred lst |
@deffnx {Scheme Procedure} break! pred lst |
636 |
@code{span} splits the list @var{lst} into the longest initial prefix |
@code{span} splits the list @var{lst} into the longest initial prefix |
637 |
whose elements all satisfy the predicate @var{pred}, and the remaining |
whose elements all satisfy the predicate @var{pred}, and the remaining |
638 |
tail. @code{break} inverts the sense of the predicate. |
tail. @code{break} inverts the sense of the predicate. |
642 |
result. |
result. |
643 |
@end deffn |
@end deffn |
644 |
|
|
645 |
@deffn procedure any pred lst1 lst2 @dots{} |
@deffn {Scheme Procedure} any pred lst1 lst2 @dots{} |
646 |
Apply @var{pred} across the lists and return a true value if the |
Apply @var{pred} across the lists and return a true value if the |
647 |
predicate returns true for any of the list elements(s); return |
predicate returns true for any of the list elements(s); return |
648 |
@code{#f} otherwise. The true value returned is always the result of |
@code{#f} otherwise. The true value returned is always the result of |
649 |
the first successful application of @var{pred}. |
the first successful application of @var{pred}. |
650 |
@end deffn |
@end deffn |
651 |
|
|
652 |
@deffn procedure every pred lst1 lst2 @dots{} |
@deffn {Scheme Procedure} every pred lst1 lst2 @dots{} |
653 |
Apply @var{pred} across the lists and return a true value if the |
Apply @var{pred} across the lists and return a true value if the |
654 |
predicate returns true for every of the list elements(s); return |
predicate returns true for every of the list elements(s); return |
655 |
@code{#f} otherwise. The true value returned is always the result of |
@code{#f} otherwise. The true value returned is always the result of |
656 |
the final successful application of @var{pred}. |
the final successful application of @var{pred}. |
657 |
@end deffn |
@end deffn |
658 |
|
|
659 |
@deffn procedure list-index pred lst1 lst2 @dots{} |
@deffn {Scheme Procedure} list-index pred lst1 lst2 @dots{} |
660 |
Return the index of the leftmost element that satisfies @var{pred}. |
Return the index of the leftmost element that satisfies @var{pred}. |
661 |
@end deffn |
@end deffn |
662 |
|
|
663 |
@deffn procedure member x lst [=] |
@deffn {Scheme Procedure} member x lst [=] |
664 |
Return the first sublist of @var{lst} whose @sc{car} is equal to |
Return the first sublist of @var{lst} whose @sc{car} is equal to |
665 |
@var{x}. If @var{x} does no appear in @var{lst}, return @code{#f}. |
@var{x}. If @var{x} does no appear in @var{lst}, return @code{#f}. |
666 |
Equality is determined by the equality predicate @var{=}, or |
Equality is determined by the equality predicate @var{=}, or |
677 |
predicate or a comparison object for determining which elements are to |
predicate or a comparison object for determining which elements are to |
678 |
be removed. |
be removed. |
679 |
|
|
680 |
@deffn procedure delete x lst [=] |
@deffn {Scheme Procedure} delete x lst [=] |
681 |
@deffnx procedure delete! x lst [=] |
@deffnx {Scheme Procedure} delete! x lst [=] |
682 |
Return a list containing all elements from @var{lst}, but without the |
Return a list containing all elements from @var{lst}, but without the |
683 |
elements equal to @var{x}. Equality is determined by the equality |
elements equal to @var{x}. Equality is determined by the equality |
684 |
predicate @var{=}, which defaults to @code{equal?} if not given. |
predicate @var{=}, which defaults to @code{equal?} if not given. |
687 |
the argument list in order to produce the result. |
the argument list in order to produce the result. |
688 |
@end deffn |
@end deffn |
689 |
|
|
690 |
@deffn procedure delete-duplicates lst [=] |
@deffn {Scheme Procedure} delete-duplicates lst [=] |
691 |
@deffnx procedure delete-duplicates! lst [=] |
@deffnx {Scheme Procedure} delete-duplicates! lst [=] |
692 |
Return a list containing all elements from @var{lst}, but without |
Return a list containing all elements from @var{lst}, but without |
693 |
duplicate elements. Equality of elements is determined by the |
duplicate elements. Equality of elements is determined by the |
694 |
equality predicate @var{=}, which defaults to @code{equal?} if not |
equality predicate @var{=}, which defaults to @code{equal?} if not |
708 |
Lists}. The present section only documents the additional procedures |
Lists}. The present section only documents the additional procedures |
709 |
for dealing with association lists defined by SRFI-1. |
for dealing with association lists defined by SRFI-1. |
710 |
|
|
711 |
@deffn procedure assoc key alist [=] |
@deffn {Scheme Procedure} assoc key alist [=] |
712 |
Return the pair from @var{alist} which matches @var{key}. Equality is |
Return the pair from @var{alist} which matches @var{key}. Equality is |
713 |
determined by @var{=}, which defaults to @code{equal?} if not given. |
determined by @var{=}, which defaults to @code{equal?} if not given. |
714 |
@var{alist} must be an association lists---a list of pairs. |
@var{alist} must be an association lists---a list of pairs. |
715 |
@end deffn |
@end deffn |
716 |
|
|
717 |
@deffn procedure alist-cons key datum alist |
@deffn {Scheme Procedure} alist-cons key datum alist |
718 |
Equivalent to |
Equivalent to |
719 |
|
|
720 |
@lisp |
@lisp |
725 |
association list. |
association list. |
726 |
@end deffn |
@end deffn |
727 |
|
|
728 |
@deffn procedure alist-copy alist |
@deffn {Scheme Procedure} alist-copy alist |
729 |
Return a newly allocated copy of @var{alist}, that means that the |
Return a newly allocated copy of @var{alist}, that means that the |
730 |
spine of the list as well as the pairs are copied. |
spine of the list as well as the pairs are copied. |
731 |
@end deffn |
@end deffn |
732 |
|
|
733 |
@deffn procedure alist-delete key alist [=] |
@deffn {Scheme Procedure} alist-delete key alist [=] |
734 |
@deffnx procedure alist-delete! key alist [=] |
@deffnx {Scheme Procedure} alist-delete! key alist [=] |
735 |
Return a list containing the pairs of @var{alist}, but without the |
Return a list containing the pairs of @var{alist}, but without the |
736 |
pairs whose @sc{cars} are equal to @var{key}. Equality is determined |
pairs whose @sc{cars} are equal to @var{key}. Equality is determined |
737 |
by @var{=}, which defaults to @code{equal?} if not given. |
by @var{=}, which defaults to @code{equal?} if not given. |
759 |
argument. This predicate is used for testing the objects in the list |
argument. This predicate is used for testing the objects in the list |
760 |
sets for sameness. |
sets for sameness. |
761 |
|
|
762 |
@deffn procedure lset<= = list1 @dots{} |
@deffn {Scheme Procedure} lset<= = list1 @dots{} |
763 |
Return @code{#t} if every @var{listi} is a subset of @var{listi+1}, |
Return @code{#t} if every @var{listi} is a subset of @var{listi+1}, |
764 |
otherwise return @code{#f}. Returns @code{#t} if called with less |
otherwise return @code{#f}. Returns @code{#t} if called with less |
765 |
than two arguments. @var{=} is used for testing element equality. |
than two arguments. @var{=} is used for testing element equality. |
766 |
@end deffn |
@end deffn |
767 |
|
|
768 |
@deffn procedure lset= = list1 list2 @dots{} |
@deffn {Scheme Procedure} lset= = list1 list2 @dots{} |
769 |
Return @code{#t} if all argument lists are equal. @var{=} is used for |
Return @code{#t} if all argument lists are equal. @var{=} is used for |
770 |
testing element equality. |
testing element equality. |
771 |
@end deffn |
@end deffn |
772 |
|
|
773 |
@deffn procedure lset-adjoin = list elt1 @dots{} |
@deffn {Scheme Procedure} lset-adjoin = list elt1 @dots{} |
774 |
@deffnx procedure lset-adjoin! = list elt1 @dots{} |
@deffnx {Scheme Procedure} lset-adjoin! = list elt1 @dots{} |
775 |
Add all @var{elts} to the list @var{list}, suppressing duplicates and |
Add all @var{elts} to the list @var{list}, suppressing duplicates and |
776 |
return the resulting list. @code{lset-adjoin!} is allowed, but not |
return the resulting list. @code{lset-adjoin!} is allowed, but not |
777 |
required to modify its first argument. @var{=} is used for testing |
required to modify its first argument. @var{=} is used for testing |
778 |
element equality. |
element equality. |
779 |
@end deffn |
@end deffn |
780 |
|
|
781 |
@deffn procedure lset-union = list1 @dots{} |
@deffn {Scheme Procedure} lset-union = list1 @dots{} |
782 |
@deffnx procedure lset-union! = list1 @dots{} |
@deffnx {Scheme Procedure} lset-union! = list1 @dots{} |
783 |
Return the union of all argument list sets. The union is the set of |
Return the union of all argument list sets. The union is the set of |
784 |
all elements which appear in any of the argument sets. |
all elements which appear in any of the argument sets. |
785 |
@code{lset-union!} is allowed, but not required to modify its first |
@code{lset-union!} is allowed, but not required to modify its first |
786 |
argument. @var{=} is used for testing element equality. |
argument. @var{=} is used for testing element equality. |
787 |
@end deffn |
@end deffn |
788 |
|
|
789 |
@deffn procedure lset-intersection = list1 list2 @dots{} |
@deffn {Scheme Procedure} lset-intersection = list1 list2 @dots{} |
790 |
@deffnx procedure lset-intersection! = list1 list2 @dots{} |
@deffnx {Scheme Procedure} lset-intersection! = list1 list2 @dots{} |
791 |
Return the intersection of all argument list sets. The intersection |
Return the intersection of all argument list sets. The intersection |
792 |
is the set containing all elements which appear in all argument sets. |
is the set containing all elements which appear in all argument sets. |
793 |
@code{lset-intersection!} is allowed, but not required to modify its |
@code{lset-intersection!} is allowed, but not required to modify its |
794 |
first argument. @var{=} is used for testing element equality. |
first argument. @var{=} is used for testing element equality. |
795 |
@end deffn |
@end deffn |
796 |
|
|
797 |
@deffn procedure lset-difference = list1 list2 @dots{} |
@deffn {Scheme Procedure} lset-difference = list1 list2 @dots{} |
798 |
@deffnx procedure lset-difference! = list1 list2 @dots{} |
@deffnx {Scheme Procedure} lset-difference! = list1 list2 @dots{} |
799 |
Return the difference of all argument list sets. The difference is |
Return the difference of all argument list sets. The difference is |
800 |
the the set containing all elements of the first list which do not |
the the set containing all elements of the first list which do not |
801 |
appear in the other lists. @code{lset-difference!} is allowed, but |
appear in the other lists. @code{lset-difference!} is allowed, but |
803 |
element equality. |
element equality. |
804 |
@end deffn |
@end deffn |
805 |
|
|
806 |
@deffn procedure lset-xor = list1 @dots{} |
@deffn {Scheme Procedure} lset-xor = list1 @dots{} |
807 |
@deffnx procedure lset-xor! = list1 @dots{} |
@deffnx {Scheme Procedure} lset-xor! = list1 @dots{} |
808 |
Return the set containing all elements which appear in the first |
Return the set containing all elements which appear in the first |
809 |
argument list set, but not in the second; or, more generally: which |
argument list set, but not in the second; or, more generally: which |
810 |
appear in an odd number of sets. @code{lset-xor!} is allowed, but |
appear in an odd number of sets. @code{lset-xor!} is allowed, but |
812 |
element equality. |
element equality. |
813 |
@end deffn |
@end deffn |
814 |
|
|
815 |
@deffn procedure lset-diff+intersection = list1 list2 @dots{} |
@deffn {Scheme Procedure} lset-diff+intersection = list1 list2 @dots{} |
816 |
@deffnx procedure lset-diff+intersection! = list1 list2 @dots{} |
@deffnx {Scheme Procedure} lset-diff+intersection! = list1 list2 @dots{} |
817 |
Return two values, the difference and the intersection of the argument |
Return two values, the difference and the intersection of the argument |
818 |
list sets. This works like a combination of @code{lset-difference} and |
list sets. This works like a combination of @code{lset-difference} and |
819 |
@code{lset-intersection}, but is more efficient. |
@code{lset-intersection}, but is more efficient. |
939 |
@code{make-s8vector}, @code{u16vector}, @code{u32vector-length}, |
@code{make-s8vector}, @code{u16vector}, @code{u32vector-length}, |
940 |
@code{s64vector-ref}, @code{f32vector-set!} or @code{f64vector->list}. |
@code{s64vector-ref}, @code{f32vector-set!} or @code{f64vector->list}. |
941 |
|
|
942 |
@deffn primitive TAGvector? obj |
@deffn {Scheme Procedure} TAGvector? obj |
943 |
Return @code{#t} if @var{obj} is a homogeneous numeric vector of type |
Return @code{#t} if @var{obj} is a homogeneous numeric vector of type |
944 |
@code{TAG}. |
@code{TAG}. |
945 |
@end deffn |
@end deffn |
946 |
|
|
947 |
@deffn primitive make-TAGvector n [value] |
@deffn {Scheme Procedure} make-TAGvector n [value] |
948 |
Create a newly allocated homogeneous numeric vector of type |
Create a newly allocated homogeneous numeric vector of type |
949 |
@code{TAG}, which can hold @var{n} elements. If @var{value} is given, |
@code{TAG}, which can hold @var{n} elements. If @var{value} is given, |
950 |
the vector is initialized with the value, otherwise, the contents of |
the vector is initialized with the value, otherwise, the contents of |
951 |
the returned vector is not specified. |
the returned vector is not specified. |
952 |
@end deffn |
@end deffn |
953 |
|
|
954 |
@deffn primitive TAGvector value1 @dots{} |
@deffn {Scheme Procedure} TAGvector value1 @dots{} |
955 |
Create a newly allocated homogeneous numeric vector of type |
Create a newly allocated homogeneous numeric vector of type |
956 |
@code{TAG}. The returned vector is as long as the number of arguments |
@code{TAG}. The returned vector is as long as the number of arguments |
957 |
given, and is initialized with the argument values. |
given, and is initialized with the argument values. |
958 |
@end deffn |
@end deffn |
959 |
|
|
960 |
@deffn primitive TAGvector-length TAGvec |
@deffn {Scheme Procedure} TAGvector-length TAGvec |
961 |
Return the number of elements in @var{TAGvec}. |
Return the number of elements in @var{TAGvec}. |
962 |
@end deffn |
@end deffn |
963 |
|
|
964 |
@deffn primitive TAGvector-ref TAGvec i |
@deffn {Scheme Procedure} TAGvector-ref TAGvec i |
965 |
Return the element at index @var{i} in @var{TAGvec}. |
Return the element at index @var{i} in @var{TAGvec}. |
966 |
@end deffn |
@end deffn |
967 |
|
|
968 |
@deffn primitive TAGvector-ref TAGvec i value |
@deffn {Scheme Procedure} TAGvector-ref TAGvec i value |
969 |
Set the element at index @var{i} in @var{TAGvec} to @var{value}. The |
Set the element at index @var{i} in @var{TAGvec} to @var{value}. The |
970 |
return value is not specified. |
return value is not specified. |
971 |
@end deffn |
@end deffn |
972 |
|
|
973 |
@deffn primitive TAGvector->list TAGvec |
@deffn {Scheme Procedure} TAGvector->list TAGvec |
974 |
Return a newly allocated list holding all elements of @var{TAGvec}. |
Return a newly allocated list holding all elements of @var{TAGvec}. |
975 |
@end deffn |
@end deffn |
976 |
|
|
977 |
@deffn primitive list->TAGvector lst |
@deffn {Scheme Procedure} list->TAGvector lst |
978 |
Return a newly allocated homogeneous numeric vector of type @code{TAG}, |
Return a newly allocated homogeneous numeric vector of type @code{TAG}, |
979 |
initialized with the elements of the list @var{lst}. |
initialized with the elements of the list @var{lst}. |
980 |
@end deffn |
@end deffn |
1079 |
Please note the quote before the @code{#,(file ...)} expression. This |
Please note the quote before the @code{#,(file ...)} expression. This |
1080 |
is necessary because ports are not self-evaluating in Guile. |
is necessary because ports are not self-evaluating in Guile. |
1081 |
|
|
1082 |
@deffn procedure define-reader-ctor symbol proc |
@deffn {Scheme Procedure} define-reader-ctor symbol proc |
1083 |
Define @var{proc} as the reader constructor for hash-comma forms with a |
Define @var{proc} as the reader constructor for hash-comma forms with a |
1084 |
tag @var{symbol}. @var{proc} will be applied to the datum(s) following |
tag @var{symbol}. @var{proc} will be applied to the datum(s) following |
1085 |
the tag in the hash-comma expression after the complete form has been |
the tag in the hash-comma expression after the complete form has been |
1196 |
which are already in the Guile core, the string predicates |
which are already in the Guile core, the string predicates |
1197 |
@code{string-any} and @code{string-every} are defined by SRFI-13. |
@code{string-any} and @code{string-every} are defined by SRFI-13. |
1198 |
|
|
1199 |
@deffn primitive string-any pred s [start end] |
@deffn {Scheme Procedure} string-any pred s [start end] |
1200 |
Check if the predicate @var{pred} is true for any character in |
Check if the predicate @var{pred} is true for any character in |
1201 |
the string @var{s}, proceeding from left (index @var{start}) to |
the string @var{s}, proceeding from left (index @var{start}) to |
1202 |
right (index @var{end}). If @code{string-any} returns true, |
right (index @var{end}). If @code{string-any} returns true, |
1204 |
successful application of @var{pred}. |
successful application of @var{pred}. |
1205 |
@end deffn |
@end deffn |
1206 |
|
|
1207 |
@deffn primitive string-every pred s [start end] |
@deffn {Scheme Procedure} string-every pred s [start end] |
1208 |
Check if the predicate @var{pred} is true for every character |
Check if the predicate @var{pred} is true for every character |
1209 |
in the string @var{s}, proceeding from left (index @var{start}) |
in the string @var{s}, proceeding from left (index @var{start}) |
1210 |
to right (index @var{end}). If @code{string-every} returns |
to right (index @var{end}). If @code{string-every} returns |
1222 |
addition to @code{make-string} and @code{string} (available in the Guile |
addition to @code{make-string} and @code{string} (available in the Guile |
1223 |
core library), the procedure @code{string-tabulate} does exist. |
core library), the procedure @code{string-tabulate} does exist. |
1224 |
|
|
1225 |
@deffn primitive string-tabulate proc len |
@deffn {Scheme Procedure} string-tabulate proc len |
1226 |
@var{proc} is an integer->char procedure. Construct a string |
@var{proc} is an integer->char procedure. Construct a string |
1227 |
of size @var{len} by applying @var{proc} to each index to |
of size @var{len} by applying @var{proc} to each index to |
1228 |
produce the corresponding string element. The order in which |
produce the corresponding string element. The order in which |
1241 |
converting a list of characters into a string (@pxref{List/String |
converting a list of characters into a string (@pxref{List/String |
1242 |
Conversion}). |
Conversion}). |
1243 |
|
|
1244 |
@deffn primitive string->list str [start end] |
@deffn {Scheme Procedure} string->list str [start end] |
1245 |
Convert the string @var{str} into a list of characters. |
Convert the string @var{str} into a list of characters. |
1246 |
@end deffn |
@end deffn |
1247 |
|
|
1248 |
@deffn primitive reverse-list->string chrs |
@deffn {Scheme Procedure} reverse-list->string chrs |
1249 |
An efficient implementation of @code{(compose string->list |
An efficient implementation of @code{(compose string->list |
1250 |
reverse)}: |
reverse)}: |
1251 |
|
|
1254 |
@end smalllisp |
@end smalllisp |
1255 |
@end deffn |
@end deffn |
1256 |
|
|
1257 |
@deffn primitive string-join ls [delimiter grammar] |
@deffn {Scheme Procedure} string-join ls [delimiter grammar] |
1258 |
Append the string in the string list @var{ls}, using the string |
Append the string in the string list @var{ls}, using the string |
1259 |
@var{delim} as a delimiter between the elements of @var{ls}. |
@var{delim} as a delimiter between the elements of @var{ls}. |
1260 |
@var{grammar} is a symbol which specifies how the delimiter is |
@var{grammar} is a symbol which specifies how the delimiter is |
1294 |
@code{string-copy} is also available in core Guile, but this version |
@code{string-copy} is also available in core Guile, but this version |
1295 |
accepts additional start/end indices. |
accepts additional start/end indices. |
1296 |
|
|
1297 |
@deffn primitive string-copy str [start end] |
@deffn {Scheme Procedure} string-copy str [start end] |
1298 |
Return a freshly allocated copy of the string @var{str}. If |
Return a freshly allocated copy of the string @var{str}. If |
1299 |
given, @var{start} and @var{end} delimit the portion of |
given, @var{start} and @var{end} delimit the portion of |
1300 |
@var{str} which is copied. |
@var{str} which is copied. |
1301 |
@end deffn |
@end deffn |
1302 |
|
|
1303 |
@deffn primitive substring/shared str start [end] |
@deffn {Scheme Procedure} substring/shared str start [end] |
1304 |
Like @code{substring}, but the result may share memory with the |
Like @code{substring}, but the result may share memory with the |
1305 |
argument @var{str}. |
argument @var{str}. |
1306 |
@end deffn |
@end deffn |
1307 |
|
|
1308 |
@deffn primitive string-copy! target tstart s [start end] |
@deffn {Scheme Procedure} string-copy! target tstart s [start end] |
1309 |
Copy the sequence of characters from index range [@var{start}, |
Copy the sequence of characters from index range [@var{start}, |
1310 |
@var{end}) in string @var{s} to string @var{target}, beginning |
@var{end}) in string @var{s} to string @var{target}, beginning |
1311 |
at index @var{tstart}. The characters are copied left-to-right |
at index @var{tstart}. The characters are copied left-to-right |
1315 |
string. |
string. |
1316 |
@end deffn |
@end deffn |
1317 |
|
|
1318 |
@deffn primitive string-take s n |
@deffn {Scheme Procedure} string-take s n |
1319 |
@deffnx primitive string-take-right s n |
@deffnx {Scheme Procedure} string-take-right s n |
1320 |
Return the @var{n} first/last characters of @var{s}. |
Return the @var{n} first/last characters of @var{s}. |
1321 |
@end deffn |
@end deffn |
1322 |
|
|
1323 |
@deffn primitive string-drop s n |
@deffn {Scheme Procedure} string-drop s n |
1324 |
@deffnx primitive string-drop-right s n |
@deffnx {Scheme Procedure} string-drop-right s n |
1325 |
Return all but the first/last @var{n} characters of @var{s}. |
Return all but the first/last @var{n} characters of @var{s}. |
1326 |
@end deffn |
@end deffn |
1327 |
|
|
1328 |
@deffn primitive string-pad s len [chr start end] |
@deffn {Scheme Procedure} string-pad s len [chr start end] |
1329 |
@deffnx primitive string-pad-right s len [chr start end] |
@deffnx {Scheme Procedure} string-pad-right s len [chr start end] |
1330 |
Take that characters from @var{start} to @var{end} from the |
Take that characters from @var{start} to @var{end} from the |
1331 |
string @var{s} and return a new string, right(left)-padded by the |
string @var{s} and return a new string, right(left)-padded by the |
1332 |
character @var{chr} to length @var{len}. If the resulting |
character @var{chr} to length @var{len}. If the resulting |
1333 |
string is longer than @var{len}, it is truncated on the right (left). |
string is longer than @var{len}, it is truncated on the right (left). |
1334 |
@end deffn |
@end deffn |
1335 |
|
|
1336 |
@deffn primitive string-trim s [char_pred start end] |
@deffn {Scheme Procedure} string-trim s [char_pred start end] |
1337 |
@deffnx primitive string-trim-right s [char_pred start end] |
@deffnx {Scheme Procedure} string-trim-right s [char_pred start end] |
1338 |
@deffnx primitive string-trim-both s [char_pred start end] |
@deffnx {Scheme Procedure} string-trim-both s [char_pred start end] |
1339 |
Trim @var{s} by skipping over all characters on the left/right/both |
Trim @var{s} by skipping over all characters on the left/right/both |
1340 |
sides of the string that satisfy the parameter @var{char_pred}: |
sides of the string that satisfy the parameter @var{char_pred}: |
1341 |
|
|
1368 |
@code{string-set!} is documented in the Strings section (@pxref{String |
@code{string-set!} is documented in the Strings section (@pxref{String |
1369 |
Modification}). |
Modification}). |
1370 |
|
|
1371 |
@deffn primitive string-fill! str chr [start end] |
@deffn {Scheme Procedure} string-fill! str chr [start end] |
1372 |
Stores @var{chr} in every element of the given @var{str} and |
Stores @var{chr} in every element of the given @var{str} and |
1373 |
returns an unspecified value. |
returns an unspecified value. |
1374 |
@end deffn |
@end deffn |
1387 |
@code{string-hash} and @code{string-hash-ci} are for calculating hash |
@code{string-hash} and @code{string-hash-ci} are for calculating hash |
1388 |
values for strings, useful for implementing fast lookup mechanisms. |
values for strings, useful for implementing fast lookup mechanisms. |
1389 |
|
|
1390 |
@deffn primitive string-compare s1 s2 proc_lt proc_eq proc_gt [start1 end1 start2 end2] |
@deffn {Scheme Procedure} string-compare s1 s2 proc_lt proc_eq proc_gt [start1 end1 start2 end2] |
1391 |
@deffnx primitive string-compare-ci s1 s2 proc_lt proc_eq proc_gt [start1 end1 start2 end2] |
@deffnx {Scheme Procedure} string-compare-ci s1 s2 proc_lt proc_eq proc_gt [start1 end1 start2 end2] |
1392 |
Apply @var{proc_lt}, @var{proc_eq}, @var{proc_gt} to the |
Apply @var{proc_lt}, @var{proc_eq}, @var{proc_gt} to the |
1393 |
mismatch index, depending upon whether @var{s1} is less than, |
mismatch index, depending upon whether @var{s1} is less than, |
1394 |
equal to, or greater than @var{s2}. The mismatch index is the |
equal to, or greater than @var{s2}. The mismatch index is the |
1398 |
character comparison is done case-insensitively. |
character comparison is done case-insensitively. |
1399 |
@end deffn |
@end deffn |
1400 |
|
|
1401 |
@deffn primitive string= s1 s2 [start1 end1 start2 end2] |
@deffn {Scheme Procedure} string= s1 s2 [start1 end1 start2 end2] |
1402 |
@deffnx primitive string<> s1 s2 [start1 end1 start2 end2] |
@deffnx {Scheme Procedure} string<> s1 s2 [start1 end1 start2 end2] |
1403 |
@deffnx primitive string< s1 s2 [start1 end1 start2 end2] |
@deffnx {Scheme Procedure} string< s1 s2 [start1 end1 start2 end2] |
1404 |
@deffnx primitive string> s1 s2 [start1 end1 start2 end2] |
@deffnx {Scheme Procedure} string> s1 s2 [start1 end1 start2 end2] |
1405 |
@deffnx primitive string<= s1 s2 [start1 end1 start2 end2] |
@deffnx {Scheme Procedure} string<= s1 s2 [start1 end1 start2 end2] |
1406 |
@deffnx primitive string>= s1 s2 [start1 end1 start2 end2] |
@deffnx {Scheme Procedure} string>= s1 s2 [start1 end1 start2 end2] |
1407 |
Compare @var{s1} and @var{s2} and return @code{#f} if the predicate |
Compare @var{s1} and @var{s2} and return @code{#f} if the predicate |
1408 |
fails. Otherwise, the mismatch index is returned (or @var{end1} in the |
fails. Otherwise, the mismatch index is returned (or @var{end1} in the |
1409 |
case of @code{string=}. |
case of @code{string=}. |
1410 |
@end deffn |
@end deffn |
1411 |
|
|
1412 |
@deffn primitive string-ci= s1 s2 [start1 end1 start2 end2] |
@deffn {Scheme Procedure} string-ci= s1 s2 [start1 end1 start2 end2] |
1413 |
@deffnx primitive string-ci<> s1 s2 [start1 end1 start2 end2] |
@deffnx {Scheme Procedure} string-ci<> s1 s2 [start1 end1 start2 end2] |
1414 |
@deffnx primitive string-ci< s1 s2 [start1 end1 start2 end2] |
@deffnx {Scheme Procedure} string-ci< s1 s2 [start1 end1 start2 end2] |
1415 |
@deffnx primitive string-ci> s1 s2 [start1 end1 start2 end2] |
@deffnx {Scheme Procedure} string-ci> s1 s2 [start1 end1 start2 end2] |
1416 |
@deffnx primitive string-ci<= s1 s2 [start1 end1 start2 end2] |
@deffnx {Scheme Procedure} string-ci<= s1 s2 [start1 end1 start2 end2] |
1417 |
@deffnx primitive string-ci>= s1 s2 [start1 end1 start2 end2] |
@deffnx {Scheme Procedure} string-ci>= s1 s2 [start1 end1 start2 end2] |
1418 |
Compare @var{s1} and @var{s2} and return @code{#f} if the predicate |
Compare @var{s1} and @var{s2} and return @code{#f} if the predicate |
1419 |
fails. Otherwise, the mismatch index is returned (or @var{end1} in the |
fails. Otherwise, the mismatch index is returned (or @var{end1} in the |
1420 |
case of @code{string=}. These are the case-insensitive variants. |
case of @code{string=}. These are the case-insensitive variants. |
1421 |
@end deffn |
@end deffn |
1422 |
|
|
1423 |
@deffn primitive string-hash s [bound start end] |
@deffn {Scheme Procedure} string-hash s [bound start end] |
1424 |
@deffnx primitive string-hash-ci s [bound start end] |
@deffnx {Scheme Procedure} string-hash-ci s [bound start end] |
1425 |
Return a hash value of the string @var{s} in the range 0 @dots{} |
Return a hash value of the string @var{s} in the range 0 @dots{} |
1426 |
@var{bound} - 1. @code{string-hash-ci} is the case-insensitive variant. |
@var{bound} - 1. @code{string-hash-ci} is the case-insensitive variant. |
1427 |
@end deffn |
@end deffn |
1436 |
prefix or suffix of another string or how long a common prefix/suffix |
prefix or suffix of another string or how long a common prefix/suffix |
1437 |
is. |
is. |
1438 |
|
|
1439 |
@deffn primitive string-prefix-length s1 s2 [start1 end1 start2 end2] |
@deffn {Scheme Procedure} string-prefix-length s1 s2 [start1 end1 start2 end2] |
1440 |
@deffnx primitive string-prefix-length-ci s1 s2 [start1 end1 start2 end2] |
@deffnx {Scheme Procedure} string-prefix-length-ci s1 s2 [start1 end1 start2 end2] |
1441 |
@deffnx primitive string-suffix-length s1 s2 [start1 end1 start2 end2] |
@deffnx {Scheme Procedure} string-suffix-length s1 s2 [start1 end1 start2 end2] |
1442 |
@deffnx primitive string-suffix-length-ci s1 s2 [start1 end1 start2 end2] |
@deffnx {Scheme Procedure} string-suffix-length-ci s1 s2 [start1 end1 start2 end2] |
1443 |
Return the length of the longest common prefix/suffix of the two |
Return the length of the longest common prefix/suffix of the two |
1444 |
strings. @code{string-prefix-length-ci} and |
strings. @code{string-prefix-length-ci} and |
1445 |
@code{string-suffix-length-ci} are the case-insensitive variants. |
@code{string-suffix-length-ci} are the case-insensitive variants. |
1446 |
@end deffn |
@end deffn |
1447 |
|
|
1448 |
@deffn primitive string-prefix? s1 s2 [start1 end1 start2 end2] |
@deffn {Scheme Procedure} string-prefix? s1 s2 [start1 end1 start2 end2] |
1449 |
@deffnx primitive string-prefix-ci? s1 s2 [start1 end1 start2 end2] |
@deffnx {Scheme Procedure} string-prefix-ci? s1 s2 [start1 end1 start2 end2] |
1450 |
@deffnx primitive string-suffix? s1 s2 [start1 end1 start2 end2] |
@deffnx {Scheme Procedure} string-suffix? s1 s2 [start1 end1 start2 end2] |
1451 |
@deffnx primitive string-suffix-ci? s1 s2 [start1 end1 start2 end2] |
@deffnx {Scheme Procedure} string-suffix-ci? s1 s2 [start1 end1 start2 end2] |
1452 |
Is @var{s1} a prefix/suffix of @var{s2}. @code{string-prefix-ci?} and |
Is @var{s1} a prefix/suffix of @var{s2}. @code{string-prefix-ci?} and |
1453 |
@code{string-suffix-ci?} are the case-insensitive variants. |
@code{string-suffix-ci?} are the case-insensitive variants. |
1454 |
@end deffn |
@end deffn |
1462 |
Use these procedures to find out whether a string contains a given |
Use these procedures to find out whether a string contains a given |
1463 |
character or a given substring, or a character from a set of characters. |
character or a given substring, or a character from a set of characters. |
1464 |
|
|
1465 |
@deffn primitive string-index s char_pred [start end] |
@deffn {Scheme Procedure} string-index s char_pred [start end] |
1466 |
@deffnx primitive string-index-right s char_pred [start end] |
@deffnx {Scheme Procedure} string-index-right s char_pred [start end] |
1467 |
Search through the string @var{s} from left to right (right to left), |
Search through the string @var{s} from left to right (right to left), |
1468 |
returning the index of the first (last) occurrence of a character which |
returning the index of the first (last) occurrence of a character which |
1469 |
|
|
1480 |
@end itemize |
@end itemize |
1481 |
@end deffn |
@end deffn |
1482 |
|
|
1483 |
@deffn primitive string-skip s char_pred [start end] |
@deffn {Scheme Procedure} string-skip s char_pred [start end] |
1484 |
@deffnx primitive string-skip-right s char_pred [start end] |
@deffnx {Scheme Procedure} string-skip-right s char_pred [start end] |
1485 |
Search through the string @var{s} from left to right (right to left), |
Search through the string @var{s} from left to right (right to left), |
1486 |
returning the index of the first (last) occurrence of a character which |
returning the index of the first (last) occurrence of a character which |
1487 |
|
|
1498 |
@end itemize |
@end itemize |
1499 |
@end deffn |
@end deffn |
1500 |
|
|
1501 |
@deffn primitive string-count s char_pred [start end] |
@deffn {Scheme Procedure} string-count s char_pred [start end] |
1502 |
Return the count of the number of characters in the string |
Return the count of the number of characters in the string |
1503 |
@var{s} which |
@var{s} which |
1504 |
|
|
1514 |
@end itemize |
@end itemize |
1515 |
@end deffn |
@end deffn |
1516 |
|
|
1517 |
@deffn primitive string-contains s1 s2 [start1 end1 start2 end2] |
@deffn {Scheme Procedure} string-contains s1 s2 [start1 end1 start2 end2] |
1518 |
@deffnx primitive string-contains-ci s1 s2 [start1 end1 start2 end2] |
@deffnx {Scheme Procedure} string-contains-ci s1 s2 [start1 end1 start2 end2] |
1519 |
Does string @var{s1} contain string @var{s2}? Return the index |
Does string @var{s1} contain string @var{s2}? Return the index |
1520 |
in @var{s1} where @var{s2} occurs as a substring, or false. |
in @var{s1} where @var{s2} occurs as a substring, or false. |
1521 |
The optional start/end indices restrict the operation to the |
The optional start/end indices restrict the operation to the |
1534 |
similar to the procedures in the Guile core, but are extended to handle |
similar to the procedures in the Guile core, but are extended to handle |
1535 |
optional start/end indices. |
optional start/end indices. |
1536 |
|
|
1537 |
@deffn primitive string-upcase s [start end] |
@deffn {Scheme Procedure} string-upcase s [start end] |
1538 |
@deffnx primitive string-upcase! s [start end] |
@deffnx {Scheme Procedure} string-upcase! s [start end] |
1539 |
Upcase every character in @var{s}. @code{string-upcase!} is the |
Upcase every character in @var{s}. @code{string-upcase!} is the |
1540 |
side-effecting variant. |
side-effecting variant. |
1541 |
@end deffn |
@end deffn |
1542 |
|
|
1543 |
@deffn primitive string-downcase s [start end] |
@deffn {Scheme Procedure} string-downcase s [start end] |
1544 |
@deffnx primitive string-downcase! s [start end] |
@deffnx {Scheme Procedure} string-downcase! s [start end] |
1545 |
Downcase every character in @var{s}. @code{string-downcase!} is the |
Downcase every character in @var{s}. @code{string-downcase!} is the |
1546 |
side-effecting variant. |
side-effecting variant. |
1547 |
@end deffn |
@end deffn |
1548 |
|
|
1549 |
@deffn primitive string-titlecase s [start end] |
@deffn {Scheme Procedure} string-titlecase s [start end] |
1550 |
@deffnx primitive string-titlecase! s [start end] |
@deffnx {Scheme Procedure} string-titlecase! s [start end] |
1551 |
Upcase every first character in every word in @var{s}, downcase the |
Upcase every first character in every word in @var{s}, downcase the |
1552 |
other characters. @code{string-titlecase!} is the side-effecting |
other characters. @code{string-titlecase!} is the side-effecting |
1553 |
variant. |
variant. |
1562 |
One appending procedure, @code{string-append} is the same in R5RS and in |
One appending procedure, @code{string-append} is the same in R5RS and in |
1563 |
SRFI-13, so it is not redefined. |
SRFI-13, so it is not redefined. |
1564 |
|
|
1565 |
@deffn primitive string-reverse str [start end] |
@deffn {Scheme Procedure} string-reverse str [start end] |
1566 |
@deffnx primitive string-reverse! str [start end] |
@deffnx {Scheme Procedure} string-reverse! str [start end] |
1567 |
Reverse the string @var{str}. The optional arguments |
Reverse the string @var{str}. The optional arguments |
1568 |
@var{start} and @var{end} delimit the region of @var{str} to |
@var{start} and @var{end} delimit the region of @var{str} to |
1569 |
operate on. |
operate on. |
1572 |
unspecified value. |
unspecified value. |
1573 |
@end deffn |
@end deffn |
1574 |
|
|
1575 |
@deffn primitive string-append/shared ls @dots{} |
@deffn {Scheme Procedure} string-append/shared ls @dots{} |
1576 |
Like @code{string-append}, but the result may share memory |
Like @code{string-append}, but the result may share memory |
1577 |
with the argument strings. |
with the argument strings. |
1578 |
@end deffn |
@end deffn |
1579 |
|
|
1580 |
@deffn primitive string-concatenate ls |
@deffn {Scheme Procedure} string-concatenate ls |
1581 |
Append the elements of @var{ls} (which must be strings) |
Append the elements of @var{ls} (which must be strings) |
1582 |
together into a single string. Guaranteed to return a freshly |
together into a single string. Guaranteed to return a freshly |
1583 |
allocated string. |
allocated string. |
1584 |
@end deffn |
@end deffn |
1585 |
|
|
1586 |
@deffn primitive string-concatenate/shared ls |
@deffn {Scheme Procedure} string-concatenate/shared ls |
1587 |
Like @code{string-concatenate}, but the result may share memory |
Like @code{string-concatenate}, but the result may share memory |
1588 |
with the strings in the list @var{ls}. |
with the strings in the list @var{ls}. |
1589 |
@end deffn |
@end deffn |
1590 |
|
|
1591 |
@deffn primitive string-concatenate-reverse ls final_string end |
@deffn {Scheme Procedure} string-concatenate-reverse ls final_string end |
1592 |
Without optional arguments, this procedure is equivalent to |
Without optional arguments, this procedure is equivalent to |
1593 |
|
|
1594 |
@smalllisp |
@smalllisp |
1604 |
Guaranteed to return a freshly allocated string. |
Guaranteed to return a freshly allocated string. |
1605 |
@end deffn |
@end deffn |
1606 |
|
|
1607 |
@deffn primitive string-concatenate-reverse/shared ls final_string end |
@deffn {Scheme Procedure} string-concatenate-reverse/shared ls final_string end |
1608 |
Like @code{string-concatenate-reverse}, but the result may |
Like @code{string-concatenate-reverse}, but the result may |
1609 |
share memory with the the strings in the @var{ls} arguments. |
share memory with the the strings in the @var{ls} arguments. |
1610 |
@end deffn |
@end deffn |
1619 |
the characters a string is composed of. The fold and unfold procedures |
the characters a string is composed of. The fold and unfold procedures |
1620 |
are list iterators and constructors. |
are list iterators and constructors. |
1621 |
|
|
1622 |
@deffn primitive string-map proc s [start end] |
@deffn {Scheme Procedure} string-map proc s [start end] |
1623 |
@var{proc} is a char->char procedure, it is mapped over |
@var{proc} is a char->char procedure, it is mapped over |
1624 |
@var{s}. The order in which the procedure is applied to the |
@var{s}. The order in which the procedure is applied to the |
1625 |
string elements is not specified. |
string elements is not specified. |
1626 |
@end deffn |
@end deffn |
1627 |
|
|
1628 |
@deffn primitive string-map! proc s [start end] |
@deffn {Scheme Procedure} string-map! proc s [start end] |
1629 |
@var{proc} is a char->char procedure, it is mapped over |
@var{proc} is a char->char procedure, it is mapped over |
1630 |
@var{s}. The order in which the procedure is applied to the |
@var{s}. The order in which the procedure is applied to the |
1631 |
string elements is not specified. The string @var{s} is |
string elements is not specified. The string @var{s} is |
1632 |
modified in-place, the return value is not specified. |
modified in-place, the return value is not specified. |
1633 |
@end deffn |
@end deffn |
1634 |
|
|
1635 |
@deffn primitive string-fold kons knil s [start end] |
@deffn {Scheme Procedure} string-fold kons knil s [start end] |
1636 |
@deffnx primitive string-fold-right kons knil s [start end] |
@deffnx {Scheme Procedure} string-fold-right kons knil s [start end] |
1637 |
Fold @var{kons} over the characters of @var{s}, with @var{knil} as the |
Fold @var{kons} over the characters of @var{s}, with @var{knil} as the |
1638 |
terminating element, from left to right (or right to left, for |
terminating element, from left to right (or right to left, for |
1639 |
@code{string-fold-right}). @var{kons} must expect two arguments: The |
@code{string-fold-right}). @var{kons} must expect two arguments: The |
1640 |
actual character and the last result of @var{kons}' application. |
actual character and the last result of @var{kons}' application. |
1641 |
@end deffn |
@end deffn |
1642 |
|
|
1643 |
@deffn primitive string-unfold p f g seed [base make_final] |
@deffn {Scheme Procedure} string-unfold p f g seed [base make_final] |
1644 |
@deffnx primitive string-unfold-right p f g seed [base make_final] |
@deffnx {Scheme Procedure} string-unfold-right p f g seed [base make_final] |
1645 |
These are the fundamental string constructors. |
These are the fundamental string constructors. |
1646 |
@itemize @bullet |
@itemize @bullet |
1647 |
@item @var{g} is used to generate a series of @emph{seed} |
@item @var{g} is used to generate a series of @emph{seed} |
1662 |
@end itemize |
@end itemize |
1663 |
@end deffn |
@end deffn |
1664 |
|
|
1665 |
@deffn primitive string-for-each proc s [start end] |
@deffn {Scheme Procedure} string-for-each proc s [start end] |
1666 |
@var{proc} is mapped over @var{s} in left-to-right order. The |
@var{proc} is mapped over @var{s} in left-to-right order. The |
1667 |
return value is not specified. |
return value is not specified. |
1668 |
@end deffn |
@end deffn |
1684 |
"foofoo" |
"foofoo" |
1685 |
@end lisp |
@end lisp |
1686 |
|
|
1687 |
@deffn primitive xsubstring s from [to start end] |
@deffn {Scheme Procedure} xsubstring s from [to start end] |
1688 |
This is the @emph{extended substring} procedure that implements |
This is the @emph{extended substring} procedure that implements |
1689 |
replicated copying of a substring of some string. |
replicated copying of a substring of some string. |
1690 |
|
|
1697 |
defaults to @var{from} + (@var{end} - @var{start}). |
defaults to @var{from} + (@var{end} - @var{start}). |
1698 |
@end deffn |
@end deffn |
1699 |
|
|
1700 |
@deffn primitive string-xcopy! target tstart s sfrom [sto start end] |
@deffn {Scheme Procedure} string-xcopy! target tstart s sfrom [sto start end] |
1701 |
Exactly the same as @code{xsubstring}, but the extracted text |
Exactly the same as @code{xsubstring}, but the extracted text |
1702 |
is written into the string @var{target} starting at index |
is written into the string @var{target} starting at index |
1703 |
@var{tstart}. The operation is not defined if @code{(eq? |
@var{tstart}. The operation is not defined if @code{(eq? |
1715 |
another string and @code{string-tokenize} splits a string into a list of |
another string and @code{string-tokenize} splits a string into a list of |
1716 |
strings, breaking it up at a specified character. |
strings, breaking it up at a specified character. |
1717 |
|
|
1718 |
@deffn primitive string-replace s1 s2 [start1 end1 start2 end2] |
@deffn {Scheme Procedure} string-replace s1 s2 [start1 end1 start2 end2] |
1719 |
Return the string @var{s1}, but with the characters |
Return the string @var{s1}, but with the characters |
1720 |
@var{start1} @dots{} @var{end1} replaced by the characters |
@var{start1} @dots{} @var{end1} replaced by the characters |
1721 |
@var{start2} @dots{} @var{end2} from @var{s2}. |
@var{start2} @dots{} @var{end2} from @var{s2}. |
1722 |
@end deffn |
@end deffn |
1723 |
|
|
1724 |
@deffn primitive string-tokenize s [token_char start end] |
@deffn {Scheme Procedure} string-tokenize s [token_char start end] |
1725 |
Split the string @var{s} into a list of substrings, where each |
Split the string @var{s} into a list of substrings, where each |
1726 |
substring is a maximal non-empty contiguous sequence of |
substring is a maximal non-empty contiguous sequence of |
1727 |
characters equal to the character @var{token_char}, or |
characters equal to the character @var{token_char}, or |
1739 |
@dfn{Filtering} means to remove all characters from a string which do |
@dfn{Filtering} means to remove all characters from a string which do |
1740 |
not match a given criteria, @dfn{deleting} means the opposite. |
not match a given criteria, @dfn{deleting} means the opposite. |
1741 |
|
|
1742 |
@deffn primitive string-filter s char_pred [start end] |
@deffn {Scheme Procedure} string-filter s char_pred [start end] |
1743 |
Filter the string @var{s}, retaining only those characters that |
Filter the string @var{s}, retaining only those characters that |
1744 |
satisfy the @var{char_pred} argument. If the argument is a |
satisfy the @var{char_pred} argument. If the argument is a |
1745 |
procedure, it is applied to each character as a predicate, if |
procedure, it is applied to each character as a predicate, if |
1747 |
character set, it is tested for membership. |
character set, it is tested for membership. |
1748 |
@end deffn |
@end deffn |
1749 |
|
|
1750 |
@deffn primitive string-delete s char_pred [start end] |
@deffn {Scheme Procedure} string-delete s char_pred [start end] |
1751 |
Filter the string @var{s}, retaining only those characters that |
Filter the string @var{s}, retaining only those characters that |
1752 |
do not satisfy the @var{char_pred} argument. If the argument |
do not satisfy the @var{char_pred} argument. If the argument |
1753 |
is a procedure, it is applied to each character as a predicate, |
is a procedure, it is applied to each character as a predicate, |
1823 |
@code{char-set-hash} can be used for calculating a hash value, maybe for |
@code{char-set-hash} can be used for calculating a hash value, maybe for |
1824 |
usage in fast lookup procedures. |
usage in fast lookup procedures. |
1825 |
|
|
1826 |
@deffn primitive char-set? obj |
@deffn {Scheme Procedure} char-set? obj |
1827 |
Return @code{#t} if @var{obj} is a character set, @code{#f} |
Return @code{#t} if @var{obj} is a character set, @code{#f} |
1828 |
otherwise. |
otherwise. |
1829 |
@end deffn |
@end deffn |
1830 |
|
|
1831 |
@deffn primitive char-set= cs1 @dots{} |
@deffn {Scheme Procedure} char-set= cs1 @dots{} |
1832 |
Return @code{#t} if all given character sets are equal. |
Return @code{#t} if all given character sets are equal. |
1833 |
@end deffn |
@end deffn |
1834 |
|
|
1835 |
@deffn primitive char-set<= cs1 @dots{} |
@deffn {Scheme Procedure} char-set<= cs1 @dots{} |
1836 |
Return @code{#t} if every character set @var{cs}i is a subset |
Return @code{#t} if every character set @var{cs}i is a subset |
1837 |
of character set @var{cs}i+1. |
of character set @var{cs}i+1. |
1838 |
@end deffn |
@end deffn |
1839 |
|
|
1840 |
@deffn primitive char-set-hash cs [bound] |
@deffn {Scheme Procedure} char-set-hash cs [bound] |
1841 |
Compute a hash value for the character set @var{cs}. If |
Compute a hash value for the character set @var{cs}. If |
1842 |
@var{bound} is given and not @code{#f}, it restricts the |
@var{bound} is given and not @code{#f}, it restricts the |
1843 |
returned value to the range 0 @dots{} @var{bound - 1}. |
returned value to the range 0 @dots{} @var{bound - 1}. |
1859 |
Additionally, mapping and (un-)folding procedures for character sets are |
Additionally, mapping and (un-)folding procedures for character sets are |
1860 |
provided. |
provided. |
1861 |
|
|
1862 |
@deffn primitive char-set-cursor cs |
@deffn {Scheme Procedure} char-set-cursor cs |
1863 |
Return a cursor into the character set @var{cs}. |
Return a cursor into the character set @var{cs}. |
1864 |
@end deffn |
@end deffn |
1865 |
|
|
1866 |
@deffn primitive char-set-ref cs cursor |
@deffn {Scheme Procedure} char-set-ref cs cursor |
1867 |
Return the character at the current cursor position |
Return the character at the current cursor position |
1868 |
@var{cursor} in the character set @var{cs}. It is an error to |
@var{cursor} in the character set @var{cs}. It is an error to |
1869 |
pass a cursor for which @code{end-of-char-set?} returns true. |
pass a cursor for which @code{end-of-char-set?} returns true. |
1870 |
@end deffn |
@end deffn |
1871 |
|
|
1872 |
@deffn primitive char-set-cursor-next cs cursor |
@deffn {Scheme Procedure} char-set-cursor-next cs cursor |
1873 |
Advance the character set cursor @var{cursor} to the next |
Advance the character set cursor @var{cursor} to the next |
1874 |
character in the character set @var{cs}. It is an error if the |
character in the character set @var{cs}. It is an error if the |
1875 |
cursor given satisfies @code{end-of-char-set?}. |
cursor given satisfies @code{end-of-char-set?}. |
1876 |
@end deffn |
@end deffn |
1877 |
|
|
1878 |
@deffn primitive end-of-char-set? cursor |
@deffn {Scheme Procedure} end-of-char-set? cursor |
1879 |
Return @code{#t} if @var{cursor} has reached the end of a |
Return @code{#t} if @var{cursor} has reached the end of a |
1880 |
character set, @code{#f} otherwise. |
character set, @code{#f} otherwise. |
1881 |
@end deffn |
@end deffn |
1882 |
|
|
1883 |
@deffn primitive char-set-fold kons knil cs |
@deffn {Scheme Procedure} char-set-fold kons knil cs |
1884 |
Fold the procedure @var{kons} over the character set @var{cs}, |
Fold the procedure @var{kons} over the character set @var{cs}, |
1885 |
initializing it with @var{knil}. |
initializing it with @var{knil}. |
1886 |
@end deffn |
@end deffn |
1887 |
|
|
1888 |
@deffn primitive char-set-unfold p f g seed [base_cs] |
@deffn {Scheme Procedure} char-set-unfold p f g seed [base_cs] |
1889 |
@deffnx primitive char-set-unfold! p f g seed base_cs |
@deffnx {Scheme Procedure} char-set-unfold! p f g seed base_cs |
1890 |
This is a fundamental constructor for character sets. |
This is a fundamental constructor for character sets. |
1891 |
@itemize @bullet |
@itemize @bullet |
1892 |
@item @var{g} is used to generate a series of ``seed'' values |
@item @var{g} is used to generate a series of ``seed'' values |
1902 |
@code{char-set-unfold!} is the side-effecting variant. |
@code{char-set-unfold!} is the side-effecting variant. |
1903 |
@end deffn |
@end deffn |
1904 |
|
|
1905 |
@deffn primitive char-set-for-each proc cs |
@deffn {Scheme Procedure} char-set-for-each proc cs |
1906 |
Apply @var{proc} to every character in the character set |
Apply @var{proc} to every character in the character set |
1907 |
@var{cs}. The return value is not specified. |
@var{cs}. The return value is not specified. |
1908 |
@end deffn |
@end deffn |
1909 |
|
|
1910 |
@deffn primitive char-set-map proc cs |
@deffn {Scheme Procedure} char-set-map proc cs |
1911 |
Map the procedure @var{proc} over every character in @var{cs}. |
Map the procedure @var{proc} over every character in @var{cs}. |
1912 |
@var{proc} must be a character -> character procedure. |
@var{proc} must be a character -> character procedure. |
1913 |
@end deffn |
@end deffn |
1920 |
|
|
1921 |
New character sets are produced with these procedures. |
New character sets are produced with these procedures. |
1922 |
|
|
1923 |
@deffn primitive char-set-copy cs |
@deffn {Scheme Procedure} char-set-copy cs |
1924 |
Return a newly allocated character set containing all |
Return a newly allocated character set containing all |
1925 |
characters in @var{cs}. |
characters in @var{cs}. |
1926 |
@end deffn |
@end deffn |
1927 |
|
|
1928 |
@deffn primitive char-set char1 @dots{} |
@deffn {Scheme Procedure} char-set char1 @dots{} |
1929 |
Return a character set containing all given characters. |
Return a character set containing all given characters. |
1930 |
@end deffn |
@end deffn |
1931 |
|
|
1932 |
@deffn primitive list->char-set char_list [base_cs] |
@deffn {Scheme Procedure} list->char-set char_list [base_cs] |
1933 |
@deffnx primitive list->char-set! char_list base_cs |
@deffnx {Scheme Procedure} list->char-set! char_list base_cs |
1934 |
Convert the character list @var{list} to a character set. If |
Convert the character list @var{list} to a character set. If |
1935 |
the character set @var{base_cs} is given, the character in this |
the character set @var{base_cs} is given, the character in this |
1936 |
set are also included in the result. |
set are also included in the result. |
1938 |
@code{list->char-set!} is the side-effecting variant. |
@code{list->char-set!} is the side-effecting variant. |
1939 |
@end deffn |
@end deffn |
1940 |
|
|
1941 |
@deffn primitive string->char-set s [base_cs] |
@deffn {Scheme Procedure} string->char-set s [base_cs] |
1942 |
@deffnx primitive string->char-set! s base_cs |
@deffnx {Scheme Procedure} string->char-set! s base_cs |
1943 |
Convert the string @var{str} to a character set. If the |
Convert the string @var{str} to a character set. If the |
1944 |
character set @var{base_cs} is given, the characters in this |
character set @var{base_cs} is given, the characters in this |
1945 |
set are also included in the result. |
set are also included in the result. |
1947 |
@code{string->char-set!} is the side-effecting variant. |
@code{string->char-set!} is the side-effecting variant. |
1948 |
@end deffn |
@end deffn |
1949 |
|
|
1950 |
@deffn primitive char-set-filter pred cs [base_cs] |
@deffn {Scheme Procedure} char-set-filter pred cs [base_cs] |
1951 |
@deffnx primitive char-set-filter! pred cs base_cs |
@deffnx {Scheme Procedure} char-set-filter! pred cs base_cs |
1952 |
Return a character set containing every character from @var{cs} |
Return a character set containing every character from @var{cs} |
1953 |
so that it satisfies @var{pred}. If provided, the characters |
so that it satisfies @var{pred}. If provided, the characters |
1954 |
from @var{base_cs} are added to the result. |
from @var{base_cs} are added to the result. |
1956 |
@code{char-set-filter!} is the side-effecting variant. |
@code{char-set-filter!} is the side-effecting variant. |
1957 |
@end deffn |
@end deffn |
1958 |
|
|
1959 |
@deffn primitive ucs-range->char-set lower upper [error? base_cs] |
@deffn {Scheme Procedure} ucs-range->char-set lower upper [error? base_cs] |
1960 |
@deffnx primitive uce-range->char-set! lower upper error? base_cs |
@deffnx {Scheme Procedure} uce-range->char-set! lower upper error? base_cs |
1961 |
Return a character set containing all characters whose |
Return a character set containing all characters whose |
1962 |
character codes lie in the half-open range |
character codes lie in the half-open range |
1963 |
[@var{lower},@var{upper}). |
[@var{lower},@var{upper}). |
1974 |
@code{ucs-range->char-set!} is the side-effecting variant. |
@code{ucs-range->char-set!} is the side-effecting variant. |
1975 |
@end deffn |
@end deffn |
1976 |
|
|
1977 |
@deffn procedure ->char-set x |
@deffn {Scheme Procedure} ->char-set x |
1978 |
Coerce @var{x} into a character set. @var{x} may be a string, a |
Coerce @var{x} into a character set. @var{x} may be a string, a |
1979 |
character or a character set. |
character or a character set. |
1980 |
@end deffn |
@end deffn |
1988 |
Access the elements and other information of a character set with these |
Access the elements and other information of a character set with these |
1989 |
procedures. |
procedures. |
1990 |
|
|
1991 |
@deffn primitive char-set-size cs |
@deffn {Scheme Procedure} char-set-size cs |
1992 |
Return the number of elements in character set @var{cs}. |
Return the number of elements in character set @var{cs}. |
1993 |
@end deffn |
@end deffn |
1994 |
|
|
1995 |
@deffn primitive char-set-count pred cs |
@deffn {Scheme Procedure} char-set-count pred cs |
1996 |
Return the number of the elements int the character set |
Return the number of the elements int the character set |
1997 |
@var{cs} which satisfy the predicate @var{pred}. |
@var{cs} which satisfy the predicate @var{pred}. |
1998 |
@end deffn |
@end deffn |
1999 |
|
|
2000 |
@deffn primitive char-set->list cs |
@deffn {Scheme Procedure} char-set->list cs |
2001 |
Return a list containing the elements of the character set |
Return a list containing the elements of the character set |
2002 |
@var{cs}. |
@var{cs}. |
2003 |
@end deffn |
@end deffn |
2004 |
|
|
2005 |
@deffn primitive char-set->string cs |
@deffn {Scheme Procedure} char-set->string cs |
2006 |
Return a string containing the elements of the character set |
Return a string containing the elements of the character set |
2007 |
@var{cs}. The order in which the characters are placed in the |
@var{cs}. The order in which the characters are placed in the |
2008 |
string is not defined. |
string is not defined. |
2009 |
@end deffn |
@end deffn |
2010 |
|
|
2011 |
@deffn primitive char-set-contains? cs char |
@deffn {Scheme Procedure} char-set-contains? cs char |
2012 |
Return @code{#t} iff the character @var{ch} is contained in the |
Return @code{#t} iff the character @var{ch} is contained in the |
2013 |
character set @var{cs}. |
character set @var{cs}. |
2014 |
@end deffn |
@end deffn |
2015 |
|
|
2016 |
@deffn primitive char-set-every pred cs |
@deffn {Scheme Procedure} char-set-every pred cs |
2017 |
Return a true value if every character in the character set |
Return a true value if every character in the character set |
2018 |
@var{cs} satisfies the predicate @var{pred}. |
@var{cs} satisfies the predicate @var{pred}. |
2019 |
@end deffn |
@end deffn |
2020 |
|
|
2021 |
@deffn primitive char-set-any pred cs |
@deffn {Scheme Procedure} char-set-any pred cs |
2022 |
Return a true value if any character in the character set |
Return a true value if any character in the character set |
2023 |
@var{cs} satisfies the predicate @var{pred}. |
@var{cs} satisfies the predicate @var{pred}. |
2024 |
@end deffn |
@end deffn |
2034 |
provide side-effecting variants, which modify their character set |
provide side-effecting variants, which modify their character set |
2035 |
argument(s). |
argument(s). |
2036 |
|
|
2037 |
@deffn primitive char-set-adjoin cs char1 @dots{} |
@deffn {Scheme Procedure} char-set-adjoin cs char1 @dots{} |
2038 |
@deffnx primitive char-set-adjoin! cs char1 @dots{} |
@deffnx {Scheme Procedure} char-set-adjoin! cs char1 @dots{} |
2039 |
Add all character arguments to the first argument, which must |
Add all character arguments to the first argument, which must |
2040 |
be a character set. |
be a character set. |
2041 |
@end deffn |
@end deffn |
2042 |
|
|
2043 |
@deffn primitive char-set-delete cs char1 @dots{} |
@deffn {Scheme Procedure} char-set-delete cs char1 @dots{} |
2044 |
@deffnx primitive char-set-delete! cs char1 @dots{} |
@deffnx {Scheme Procedure} char-set-delete! cs char1 @dots{} |
2045 |
Delete all character arguments from the first argument, which |
Delete all character arguments from the first argument, which |
2046 |
must be a character set. |
must be a character set. |
2047 |
@end deffn |
@end deffn |
2048 |
|
|
2049 |
@deffn primitive char-set-complement cs |
@deffn {Scheme Procedure} char-set-complement cs |
2050 |
@deffnx primitive char-set-complement! cs |
@deffnx {Scheme Procedure} char-set-complement! cs |
2051 |
Return the complement of the character set @var{cs}. |
Return the complement of the character set @var{cs}. |
2052 |
@end deffn |
@end deffn |
2053 |
|
|
2054 |
@deffn primitive char-set-union cs1 @dots{} |
@deffn {Scheme Procedure} char-set-union cs1 @dots{} |
2055 |
@deffnx primitive char-set-union! cs1 @dots{} |
@deffnx {Scheme Procedure} char-set-union! cs1 @dots{} |
2056 |
Return the union of all argument character sets. |
Return the union of all argument character sets. |
2057 |
@end deffn |
@end deffn |
2058 |
|
|
2059 |
@deffn primitive char-set-intersection cs1 @dots{} |
@deffn {Scheme Procedure} char-set-intersection cs1 @dots{} |
2060 |
@deffnx primitive char-set-intersection! cs1 @dots{} |
@deffnx {Scheme Procedure} char-set-intersection! cs1 @dots{} |
2061 |
Return the intersection of all argument character sets. |
Return the intersection of all argument character sets. |
2062 |
@end deffn |
@end deffn |
2063 |
|
|
2064 |
@deffn primitive char-set-difference cs1 @dots{} |
@deffn {Scheme Procedure} char-set-difference cs1 @dots{} |
2065 |
@deffnx primitive char-set-difference! cs1 @dots{} |
@deffnx {Scheme Procedure} char-set-difference! cs1 @dots{} |
2066 |
Return the difference of all argument character sets. |
Return the difference of all argument character sets. |
2067 |
@end deffn |
@end deffn |
2068 |
|
|
2069 |
@deffn primitive char-set-xor cs1 @dots{} |
@deffn {Scheme Procedure} char-set-xor cs1 @dots{} |
2070 |
@deffnx primitive char-set-xor! cs1 @dots{} |
@deffnx {Scheme Procedure} char-set-xor! cs1 @dots{} |
2071 |
Return the exclusive-or of all argument character sets. |
Return the exclusive-or of all argument character sets. |
2072 |
@end deffn |
@end deffn |
2073 |
|
|
2074 |
@deffn primitive char-set-diff+intersection cs1 @dots{} |
@deffn {Scheme Procedure} char-set-diff+intersection cs1 @dots{} |
2075 |
@deffnx primitive char-set-diff+intersection! cs1 @dots{} |
@deffnx {Scheme Procedure} char-set-diff+intersection! cs1 @dots{} |
2076 |
Return the difference and the intersection of all argument |
Return the difference and the intersection of all argument |
2077 |
character sets. |
character sets. |
2078 |
@end deffn |
@end deffn |