These procedures are like
respectively, except that the returned lists are circular.
circular-list could have been defined like this:
(define (circular-list . objects) (append! objects objects))
circular-list is compatible with SRFI 1, but extended
so that it can be called with no arguments.
Returns a newly allocated list consisting of the top-level elements of list in reverse order.
(reverse '(a b c)) ⇒ (c b a) (reverse '(a (b c) d (e (f)))) ⇒ ((e (f)) d (b c) a)
Returns a list consisting of the top-level elements of list in
reverse! is like
reverse, except that it
destructively modifies list. Because the result may not be
eqv? to list, it is desirable to do something like
(set! x (reverse! x)).
Sequence must be either a list or a vector. Procedure must be a procedure of two arguments that defines a total ordering on the elements of sequence. In other words, if x and y are two distinct elements of sequence, then it must be the case that
(and (procedure x y) (procedure y x)) ⇒ #f
If sequence is a list (vector),
sort returns a newly
allocated list (vector) whose elements are those of sequence,
except that they are rearranged to be sorted in the order defined by
procedure. So, for example, if the elements of sequence are
numbers, and procedure is
<, then the resulting elements
are sorted in monotonically nondecreasing order. Likewise, if
>, the resulting elements are sorted in
monotonically nonincreasing order. To be precise, if x and
y are any two adjacent elements in the result, where x
precedes y, it is the case that
(procedure y x) ⇒ #f
Two sorting algorithms are implemented:
quick-sort. The procedure
sort is an alias for
See also the definition of