This commit is contained in:
Justin Ethier 2016-12-01 22:43:02 +00:00
parent 5d96bb387f
commit a4261af4d6

View file

@ -6,9 +6,9 @@ See the [SRFI document](http://srfi.schemers.org/srfi-1/srfi-1.html) for more in
## Constructors
[`xcons`](#xcons)
[`cons*`](#cons)
[`make-list`](#make-list)
[`list-tabulate`](#list-tabulate)
[`cons*`](#cons)
[`list-copy`](#list-copy)
[`circular-list`](#circular-list-1)
[`iota`](#iota)
@ -126,16 +126,77 @@ See the [SRFI document](http://srfi.schemers.org/srfi-1/srfi-1.html) for more in
# xcons
# tree-copy
(xcons d a)
# make-list
Equivalent to:
# list-tabulate
(lambda (d a) (cons a d))
Of utility only as a value to be conveniently passed to higher-order procedures.
(xcons '(b c) 'a) => (a b c)
The name stands for "eXchanged CONS."
# cons*
(cons* elt1 elt2 ...)
Like list, but the last argument provides the tail of the constructed list, returning
(cons elt1 (cons elt2 (cons ... eltn)))
This function is called `list*` in Common Lisp and about half of the Schemes that provide it, and `cons*` in the other half.
(cons* 1 2 3 4) => (1 2 3 . 4)
(cons* 1) => 1
# make-list
(make-list n)
(make-list n fill)
Returns an n-element list, whose elements are all the value `fill`. If the fill argument is not given, the elements of the list may be arbitrary values.
(make-list 4 'c) => (c c c c)
# list-tabulate
(list-tabulate n init-proc)
Returns an n-element list. Element `i` of the list, where `0 <= i < n`, is produced by `(init-proc i)`. No guarantee is made about the dynamic order in which init-proc is applied to these indices.
(list-tabulate 4 values) => (0 1 2 3)
# list-copy
(list-copy flist)
Copies the spine of the argument.
# circular-list
(circular-list elt1 elt2 ...)
Constructs a circular list of the elements.
(circular-list 'z 'q) => (z q z q z q ...)
# iota
(iota count)
(iota count start)
(iota count start step)
Returns a list containing the elements
(start start+step ... start+(count-1)*step)
The `start` and `step` parameters default to 0 and 1, respectively. This procedure takes its name from the APL primitive.
(iota 5) => (0 1 2 3 4)
(iota 5 0 -0.1) => (0 -0.1 -0.2 -0.3 -0.4)
# proper-list?
# circular-list?
@ -148,12 +209,8 @@ See the [SRFI document](http://srfi.schemers.org/srfi-1/srfi-1.html) for more in
# list=
# circular-list
# length+
# iota
# first
# second