I have made what I hope are final changes to the SRFI-1 list library.
There are three sets of changes:
- I've added CONCATENATE and CONCATENATE!.
(concatenate lists) = (apply append lists)
The problem with the APPLY/APPEND idiom is that you can blow out
many Scheme implementations if you apply an n-ary function to too many
arguments. This has been a problem in Scheme 48, for example. CONCATENATE
doesn't have this problem.
- I've made UNFOLD be the name of the function that generates list elements
left-to-right, and UNFOLD-RIGHT be the name of the function that generates
list elements right-to-left. This is in keeping with the general use of
the FOO and FOO-RIGHT convention.
I originally had these backwards. Note that left fold & right unfold are
inverses, as are right fold and left unfold (which is what led me astray).
It's important to get this straight now, to establish a convention for
other unfolders on other composite data structures (e.g., strings & vectors).
- I've added some functions from the Haskell list library:
split-at lis i -> [list, list]
split-at! lis i -> [list, list]
take-while pred lis -> list
take-while! pred lis -> list
drop-while pred lis -> list
span pred lis -> [list list]
span! pred lis -> [list list]
break pred lis -> [list list]
break! pred lis -> [list list]
I apologise for making more additions and changes to the library; it is
way past time to put this thing to bed.
These changes have been incorporated into the draft spec & source found at
ftp://ftp.ai.mit.edu/people/shivers/srfi/srfi-1/srfi-1.html
ftp://ftp.ai.mit.edu/people/shivers/srfi/srfi-1/srfi-1.txt
ftp://ftp.ai.mit.edu/people/shivers/srfi/srfi-1/srfi-1-reference.scm
I have polished these documents to a ready-to-go-final state. Note that
the html spec has an "active" procedure index, with internal links to
all the procedure definitions, so you can easily jump to the definitions
of the new procedures if you wish to check them out.
Today is Sunday. If I hear no complaints by Friday, SRFI-1 will be moved
to "final."
-Olin