diff options
Diffstat (limited to 'srfi-1.txi')
-rw-r--r-- | srfi-1.txi | 262 |
1 files changed, 223 insertions, 39 deletions
@@ -11,22 +11,28 @@ at @url{http://srfi.schemers.org/srfi-1/srfi-1.html} @defun xcons d a -@code{(define (xcons d a) (cons a d))}. + + @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}. + + 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 @@ -36,10 +42,12 @@ Returns a list of length @var{len}. Element @var{i} is @code{(@var{proc} 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 @@ -47,25 +55,31 @@ Returns a circular list of @var{obj1}, @var{obj2}, @dots{}. @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 @@ -73,89 +87,99 @@ Returns a circular list of @var{obj1}, @var{obj2}, @dots{}. @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 +@defunx sixth pair +@defunx seventh pair +@defunx eighth pair +@defunx ninth pair +@defunx tenth pair @end defun + @defun car+cdr pair @end defun + @defun drop lst k @defunx take 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 +@defunx split-at! lst k @end defun -@deffn {Procedure} split-at! lst k -@end deffn - -@defun last lst +@defun last lst k @dots{} -(car (last-pair lst)) @end defun + @subheading Miscellaneous -@defun length+ obj +@defun length+ clist @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 @@ -164,77 +188,145 @@ Returns a circular list of @var{obj1}, @var{obj2}, @dots{}. @end defun + @defun count pred list1 list2 @dots{} @end defun + @subheading Fold and Unfold -@deffn {Procedure} map! f list1 clist2 @dots{} +@defun fold kons knil clist1 clist2 @dots{} + +@end defun + + +@defun fold-right kons knil clist1 clist2 @dots{} + +@end defun + + +@defun pair-fold kons knil clist1 clist2 @dots{} + +@end defun + + +@defun pair-fold-right kons knil clist1 clist2 @dots{} + +@end defun + + +@defun reduce f ridentity list +@defunx reduce-right f ridentity list + +@end defun + + +@deffn {Procedure} map! f clist1 clist2 @dots{} @end deffn + @defun pair-for-each f clist1 clist2 @dots{} @end defun + @subheading Filtering and Partitioning -@defun filter pred lis +@defun filter pred list @end defun -@deffn {Procedure} filter! pred l + +@deffn {Procedure} filter! pred list @end deffn + @defun partition pred list @end defun + + +@defun remove pred list + +@end defun + + +@deffn {Procedure} partition! pred list + +@end deffn + + +@deffn {Procedure} remove! pred list + +@end deffn + @subheading Searching -@defun find pred list +@defun find pred clist @end defun -@defun find-tail pred list + +@defun find-tail pred clist @end defun -@defun remove pred l + +@defun span pred list @end defun -@deffn {Procedure} remove! pred l + +@deffn {Procedure} span! pred list @end deffn + +@defun break pred list + +@end defun + + +@deffn {Procedure} break! pred list + +@end deffn + + @defun any pred clist1 clist2 @dots{} @end defun + @defun list-index pred clist1 clist2 @dots{} @end defun -@defun span pred list +@defun member obj list = + + +@defunx member obj list @end defun -@defun member obj list pred +@subheading Deleting -@defunx member obj list +@defun delete-duplicates x 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. + +@defunx delete-duplicates x list @end defun -@subheading Deleting + + +@deffn {Procedure} delete-duplicates! x list = + + +@deffnx {Procedure} delete-duplicates! x list +@end deffn @subheading Association lists @@ -243,12 +335,104 @@ used. @defunx assoc obj alist +@end defun + + +@defun alist-cons key datum 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 + + +@defun alist-copy alist + +@end defun + + +@defun alist-delete key alist = + + +@defunx alist-delete key alist +@end defun + + +@deffn {Procedure} alist-delete! key alist = + + +@deffnx {Procedure} alist-delete! key alist +@end deffn + @subheading Set operations + +@defun lset<= = list1 @dots{} + +Determine if a transitive subset relation exists between the lists @var{list1} +@dots{}, using @var{=} to determine equality of list members. +@end defun + + +@defun lset= = list1 list2 @dots{} + +@end defun + + +@defun lset-adjoin list elt1 @dots{} + +@end defun + + +@defun lset-union = list1 @dots{} + +@end defun + + +@defun lset-intersection = list1 list2 @dots{} + +@end defun + + +@defun lset-difference = list1 list2 @dots{} + +@end defun + + +@defun lset-xor = list1 @dots{} + +@end defun + + +@defun lset-diff+intersection = list1 list2 @dots{} + +@end defun + +@noindent +These are linear-update variants. They are allowed, but not +required, to use the cons cells in their first list parameter to +construct their answer. @code{lset-union!} is permitted to recycle +cons cells from any of its list arguments. + + +@deffn {Procedure} lset-intersection! = list1 list2 @dots{} + +@end deffn + + +@deffn {Procedure} lset-difference! = list1 list2 @dots{} + +@end deffn + + +@deffn {Procedure} lset-union! = list1 @dots{} + +@end deffn + + +@deffn {Procedure} lset-xor! = list1 @dots{} + +@end deffn + + +@deffn {Procedure} lset-diff+intersection! = list1 list2 @dots{} + +@end deffn + |