Scheme Index (Static)

Hello! This is a project borne from the frustration of using index.scheme.org: the site is extremely slow due to being written in Angular. This site here is an attempt to reproduce (most of) the functionality of index.scheme org. But with static pre-rendered pages and zero JavaScript required. (index.scheme.org requires JavaScript to work, locking the users of older / weaker / JS-less browsers out.) Some of the features present on index.scheme.org are not present here. For reasons:

Other than that, it’s quite similar: choose the libraries you need, and search / skim / read their docs.

This site is sourced from scheme-index repository.

library (scheme base)

(scheme base) procedure (* (z number?) ... ) ⟹ number?

This procedure returns the product of its arguments.

(scheme base) procedure (+ (z number?) ... ) ⟹ number?

This procedure returns the sum of its arguments.

(scheme base) procedure (- (z number?) ... ) ⟹ number?

With two or more arguments, this procedure returns the difference of its arguments, associating to the left. With one argument, however, it returns the additive inverse of its argument.

(scheme base) procedure (/ (z1 number?) (z2 number?) ... ) ⟹ number?

With two or more arguments, this procedure returns the quotient of its arguments, associating to the left. With one argument, however, it returns multiplicative inverse of its argument. It is an error if any argument of / other than the first is an exact zero. If the first argument is an exact zero, an implementation may return an exact zero unless one of the other arguments is a NaN.

(scheme base) procedure (< (x1 real?) (x2 real?) (x3 real?) ... ) ⟹ boolean?

This procedure returns #t if its arguments are monotonically increasing, and #f otherwise. If any of the arguments are +nan.0, predicate returns #f. It does not distinguish between inexact zero and inexact negative zero. The predicate is transitive. Note: While it is not an error to compare inexact numbers using this predicate, the results are unreliable because a small inaccuracy can affect the result. When in doubt, consult a numerical analyst.

(scheme base) procedure (<= (x1 real?) (x2 real?) (x3 real?) ... ) ⟹ boolean?

This procedure returns #t if its arguments are monotonically non-decreasing, and #f otherwise. If any of the arguments are +nan.0, predicate returns #f. It does not distinguish between inexact zero and inexact negative zero. The predicate is transitive. Note: While it is not an error to compare inexact numbers using this predicate, the results are unreliable because a small inaccuracy can affect the result. When in doubt, consult a numerical analyst.

(scheme base) procedure (= (z1 number?) (z2 number?) (z3 number?) ... ) ⟹ boolean?

This procedure returns #t if its arguments are equal, and #f otherwise. If any of the arguments are +nan.0, the predicate return #f. It does not distinguish between inexact zero and inexact negative zero. This predicate is transitive. Note: While it is not an error to compare inexact numbers using this predicate, the results are unreliable because a small inaccuracy can affect the result; this is especially true of =. When in doubt, consult a numerical analyst.

(scheme base) procedure (> (x1 real?) (x2 real?) (x3 real?) ... ) ⟹ boolean?

This procedure returns #t if its arguments are monotonically decreasing, and #f otherwise. If any of the arguments are +nan.0, predicate returns #f. It does not distinguish between inexact zero and inexact negative zero. The predicate is transitive. Note: While it is not an error to compare inexact numbers using this predicate, the results are unreliable because a small inaccuracy can affect the result. When in doubt, consult a numerical analyst.

(scheme base) procedure (>= (x1 real?) (x2 real?) (x3 real?) ... ) ⟹ boolean?

This procedure returns #t if its arguments are monotonically non-increasing, and #f otherwise. If any of the arguments are +nan.0, predicate returns #f. It does not distinguish between inexact zero and inexact negative zero. The predicate is transitive. Note: While it is not an error to compare inexact numbers using this predicate, the results are unreliable because a small inaccuracy can affect the result. When in doubt, consult a numerical analyst.

(scheme base) procedure (abs (x real?) ) ⟹ number?

The abs procedure returns the absolute value of its argument.

(scheme base) syntax (and () ((_ test1 ...)) )

Semantics: The test expressions are evaluated from left to right, and if any expression evaluates to #f (see section 6.3), then #f is returned. Any remaining expressions are not evaluated. If all the expressions evaluate to true values, the values of the last expression are returned. If there are no expressions, then #t is returned.

(scheme base) procedure (append (list list?) ... ) ⟹ list?

(scheme base) procedure (append (list list?) ... obj ) ⟹ *

Returns a list consisting of the elements of the first list followed by the elements of the other list s. If there are no arguments, the empty list is returned. If there is exactly one argument, it is returned. Otherwise the resulting list is always newly allocated, except that it shares structure with the last argument. An improper list results if the last argument is not a proper list.

(scheme base) procedure (apply (proc procedure?) arg1 ... (args list?) ) ⟹ *

The apply procedure calls proc with the elements of the list

(scheme base) procedure (assoc obj (alist list?) ) ⟹ pair? / #f /

(scheme base) procedure (assoc obj (alist list?) (= procedure?) ) ⟹ pair? / #f /

(= a b ) ⟹ *

It is an error if alist (for "association list") is not a list of pairs. This procedure finds the first pair in alist whose car field is obj, and returns that pair. If no pair in alist has obj as its car, then #f (not the empty list) is returned. The assoc procedure uses compare if given and equal? otherwise. Rationale: Although they are often used as predicates, memq, memv, member, assq, assv, and assoc do not have question marks in their names because they return potentially useful values rather than just #t or #f.

(scheme base) procedure (assq obj (alist list?) ) ⟹ pair? / #f /

It is an error if alist (for "association list") is not a list of pairs. This procedure finds the first pair in alist whose car field is obj, and returns that pair. If no pair in alist has obj as its car, then #f (not the empty list) is returned. The assq procedure uses eq? to compare obj with the car fields of the pairs in alist. Rationale: Although they are often used as predicates, memq, memv, member, assq, assv, and assoc do not have question marks in their names because they return potentially useful values rather than just #t or #f.

(scheme base) procedure (assv obj (alist list?) ) ⟹ pair? / #f /

It is an error if alist (for "association list") is not a list of pairs. This procedure finds the first pair in alist whose car field is obj, and returns that pair. If no pair in alist has obj as its car, then #f (not the empty list) is returned. The assv procedure uses eqv? to compare obj with the car fields of the pairs in alist. Rationale: Although they are often used as predicates, memq, memv, member, assq, assv, and assoc do not have question marks in their names because they return potentially useful values rather than just #t or #f.

(scheme base) syntax (begin () ((_ expression-or-definition ...)) )

This form of begin can be used as an ordinary expression. The expressions are evaluated sequentially from left to right, and the values of the last expression are returned. This expression type is used to sequence side effects such as assignments or input and output. Note that there is another form of begin used as a library declaration: see section 5.6.1.

(scheme base) procedure (boolean=? (boolean1 boolean?) (boolean2 boolean?) (boolean3 boolean?) ... ) ⟹ boolean?

Returns #t if all the arguments are booleans and all are #t or all are #f.

(scheme base) procedure (boolean? obj ) ⟹ boolean?

The boolean? predicate returns #t if obj is either #t or #f and returns #f otherwise.

(scheme base) procedure (bytevector (byte integer?) ... ) ⟹ bytevector?

Returns a newly allocated bytevector containing its arguments.

(scheme base) procedure (bytevector-append (bytevector bytevector?) ... ) ⟹ bytevector?

Returns a newly allocated bytevector whose elements are the concatenation of the elements in the given bytevectors.

(scheme base) procedure (bytevector-copy (bytevector bytevector?) ) ⟹ bytevector?

(scheme base) procedure (bytevector-copy (bytevector bytevector?) (start integer?) ) ⟹ bytevector?

(scheme base) procedure (bytevector-copy (bytevector bytevector?) (start integer?) (end integer?) ) ⟹ bytevector?

Returns a newly allocated bytevector containing the bytes in bytevector between start and end.

(scheme base) procedure (bytevector-copy! (to bytevector?) (at integer?) (from bytevector?) ) ⟹ undefined

(scheme base) procedure (bytevector-copy! (to bytevector?) (at integer?) (from bytevector?) (start integer?) ) ⟹ undefined

(scheme base) procedure (bytevector-copy! (to bytevector?) (at integer?) (from bytevector?) (start integer?) (end integer?) ) ⟹ undefined

Copies the bytes of bytevector from between start and end to bytevector to, starting at at. The order in which bytes are copied is unspecified, except that if the source and destination overlap, copying takes place as if the source is first copied into a temporary bytevector and then into the destination. This can be achieved without allocating storage by making sure to copy in the correct direction in such circumstances. Note: This procedure appears in R6RS, but places the source before the destination, contrary to other such procedures in Scheme.

(scheme base) procedure (bytevector-length (bytevector bytevector?) ) ⟹ integer?

Returns the length of bytevector in bytes as an exact integer.

(scheme base) procedure (bytevector-u8-ref (bytevector bytevector?) (k integer?) ) ⟹ integer?

It is an error if k is not a valid index of bytevector. Returns the kth byte of bytevector.

(scheme base) procedure (bytevector-u8-set! (bytevector bytevector?) (k integer?) (byte integer?) ) ⟹ undefined

It is an error if k is not a valid index of bytevector. Stores byte as the kth byte of bytevector.

(scheme base) procedure (bytevector? obj ) ⟹ boolean?

Returns #t if obj is a bytevector. Otherwise, #f is returned.

(scheme base) procedure (caar (pair pair?) ) ⟹ *

This procedure is composition of car and car

(scheme base) procedure (cadr (pair pair?) ) ⟹ *

This procedure is composition of car and cdr

(scheme base) procedure (call-with-current-continuation (proc procedure?) ) ⟹ *

(proc (k procedure?) ) ⟹ *

It is an error if proc does not accept one argument. The procedure call-with-current-continuation (or its equivalent abbreviation call/cc) packages the current continuation (see the rationale below) as an "escape procedure" and passes it as an argument to proc. The escape procedure is a Scheme procedure that, if it is later called, will abandon whatever continuation is in ect at that later time and will instead use the continuation that was in effect when the escape procedure was created. Calling the escape procedure will cause the invocation of before and after thunks installed using dynamic-wind. The escape procedure accepts the same number of arguments as the continuation to the original call to call-with-current-continuation. Most continuations take only one value. Continuations created by the call-with-values procedure (including the initialization expressions of define-values, let-values, and let*-values expressions), take the number of values that the consumer expects. The continuations of all non-final expressions within a sequence of expressions, such as in lambda, case-lambda, begin, let, let*, letrec, letrec*, let-values, let*-values, let-syntax, letrec-syntax, parameterize, guard, case, cond, when, and unless expressions, take an arbitrary number of values because they discard the values passed to them in any event. The ect of passing no values or more than one value to continuations that were not created in one of these ways is unspecified. The escape procedure that is passed to proc has unlimited extent just like any other procedure in Scheme. It can be stored in variables or data structures and can be called as many times as desired. However, like the raise and error procedures, it never returns to its caller. Rationale: A common use of call-with-current-continuation is for structured, non-local exits from loops or procedure bodies, but in fact call-with-current-continuation is useful for implementing a wide variety of advanced control structures. In fact, raise and guard provide a more structured mechanism for nonlocal exits. Whenever a Scheme expression is evaluated there is a continuation wanting the result of the expression. The continuation represents an entire (default) future for the computation. If the expression is evaluated at the REPL, for example, then the continuation might take the result, print it on the screen, prompt for the next input, evaluate it, and so on forever. Most of the time the continuation includes actions specified by user code, as in a continuation that will take the result, multiply it by the value stored in a local variable, add seven, and give the answer to the REPL's continuation to be printed. Normally these ubiquitous continuations are hidden behind the scenes and programmers do not think much about them. On rare occasions, however, a programmer needs to deal with continuations explicitly. The call-with-current-continuation procedure allows Scheme programmers to do that by creating a procedure that acts just like the current continuation.

(scheme base) procedure (call-with-port (port port?) (proc procedure?) ) ⟹ *

(proc (port port?) ) ⟹ *

It is an error if proc does not accept one argument. The call-with-port procedure calls proc with port as an argument. If proc returns, then the port is closed automatically and the values yielded by the proc are returned. If proc does not return, then the port must not be closed automatically unless it is possible to prove that the port will never again be used for a read or write operation. Rationale: Because Scheme’s escape procedures have unlimited extent, it is possible to escape from the current continuation but later to resume it. If implementations were permitted to close the port on any escape from the current continuation, then it would be impossible to write portable code using both call-with-current-continuation and call-with-port.

(scheme base) procedure (call-with-values (producer procedure?) (consumer procedure?) ) ⟹ *

(producer ) ⟹ *

(consumer obj ... ) ⟹ *

Calls its producer argument with no arguments and a continuation that, when passed some values, calls the consumer procedure with those values as arguments. The continuation for the call to consumer is the continuation of the call to call-with-values.

(scheme base) procedure (call/cc (proc procedure?) ) ⟹ *

(proc (k procedure?) ) ⟹ *

It is an error if proc does not accept one argument. The procedure call-with-current-continuation (or its equivalent abbreviation call/cc) packages the current continuation (see the rationale below) as an "escape procedure" and passes it as an argument to proc. The escape procedure is a Scheme procedure that, if it is later called, will abandon whatever continuation is in ect at that later time and will instead use the continuation that was in effect when the escape procedure was created. Calling the escape procedure will cause the invocation of before and after thunks installed using dynamic-wind. The escape procedure accepts the same number of arguments as the continuation to the original call to call-with-current-continuation. Most continuations take only one value. Continuations created by the call-with-values procedure (including the initialization expressions of define-values, let-values, and let*-values expressions), take the number of values that the consumer expects. The continuations of all non-final expressions within a sequence of expressions, such as in lambda, case-lambda, begin, let, let*, letrec, letrec*, let-values, let*-values, let-syntax, letrec-syntax, parameterize, guard, case, cond, when, and unless expressions, take an arbitrary number of values because they discard the values passed to them in any event. The ect of passing no values or more than one value to continuations that were not created in one of these ways is unspecified. The escape procedure that is passed to proc has unlimited extent just like any other procedure in Scheme. It can be stored in variables or data structures and can be called as many times as desired. However, like the raise and error procedures, it never returns to its caller. Rationale: A common use of call-with-current-continuation is for structured, non-local exits from loops or procedure bodies, but in fact call-with-current-continuation is useful for implementing a wide variety of advanced control structures. In fact, raise and guard provide a more structured mechanism for nonlocal exits. Whenever a Scheme expression is evaluated there is a continuation wanting the result of the expression. The continuation represents an entire (default) future for the computation. If the expression is evaluated at the REPL, for example, then the continuation might take the result, print it on the screen, prompt for the next input, evaluate it, and so on forever. Most of the time the continuation includes actions specified by user code, as in a continuation that will take the result, multiply it by the value stored in a local variable, add seven, and give the answer to the REPL's continuation to be printed. Normally these ubiquitous continuations are hidden behind the scenes and programmers do not think much about them. On rare occasions, however, a programmer needs to deal with continuations explicitly. The call-with-current-continuation procedure allows Scheme programmers to do that by creating a procedure that acts just like the current continuation.

(scheme base) procedure (car (pair pair?) ) ⟹ *

Returns the contents of the car field of pair . Note that it is an error to take the car of the empty list.

(scheme base) syntax (case (=> else ) ((_ key clause1 clause2 ...)) )

((datum1 ...) expression1 expression2 ...) ((datum1 ...) => expression) (else expression1 expression2 ...) (else => expression)

A case expression is evaluated as follows. Key is evaluated and its result is compared against each datum. If the result of evaluating key is the same (in the sense of eqv?; see section 6.1) to a datum, then the expressions in the corresponding clause are evaluated in order and the results of the last expression in the clause are returned as the results of the case expression. If the result of evaluating key is different from every datum, then if there is an else clause, its expressions are evaluated and the results of the last are the results of the case expression; otherwise the result of the case expression is unspecified. If the selected clause or else clause uses the => alternate form, then the expression is evaluated. It is an error if its value is not a procedure accepting one argument. This procedure is then called on the value of the key and the values returned by this procedure are returned by the case expression.

(scheme base) procedure (cdar (pair pair?) ) ⟹ *

This procedure is composition of cdr and car

(scheme base) procedure (cddr (pair pair?) ) ⟹ *

This procedure is composition of cdr and cdr

(scheme base) procedure (cdr (pair pair?) ) ⟹ *

Returns the contents of the cdr field of pair . Note that it is an error to take the cdr of the empty list.

(scheme base) procedure (ceiling (x real?) ) ⟹ real?

The ceiling procedure returns the smallest integer not smaller than x. Note: If the argument is inexact, then the result will also be inexact. If an exact value is needed, the result can be passed to the exact procedure. If the argument is infinite or a NaN, then it is returned.

(scheme base) procedure (char->integer (char char?) ) ⟹ integer?

Given a Unicode character, char->integer returns an exact integer between 0 and #xD7FF or between #xE000 and #x10FFFF which is equal to the Unicode scalar value of that character. Given a non-Unicode character, it returns an exact integer greater than #x10FFFF. This is true independent of whether the implementation uses the Unicode representation internally. Given an exact integer that is the value returned by a character when char->integer is applied to it, integer->char returns that character.

(scheme base) procedure (char-ready? ) ⟹ boolean?

(scheme base) procedure (char-ready? (port input-port?) ) ⟹ boolean?

Returns #t if a character is ready on the textual input port and returns #f otherwise. If char-ready returns #t then the next read-char operation on the given port is guaranteed not to hang. If the port is at end of file then char-ready? returns #t. Rationale: The char-ready? procedure exists to make it possible for a program to accept characters from interactive ports without getting stuck waiting for input. Any input editors associated with such ports must ensure that characters whose existence has been asserted by char-ready? cannot be removed from the input. If char-ready? were to return #f at end of file, a port at end of file would be indistinguishable from an interactive port that has no ready characters.

(scheme base) procedure (char<=? (char1 char?) (char2 char?) (char3 char?) ... ) ⟹ boolean?

This procedure returns #t if the results of passing their arguments to char->integer are monotonically non-decreasing. This predicate is required to be transitive.

(scheme base) procedure (char<? (char1 char?) (char2 char?) (char3 char?) ... ) ⟹ boolean?

This procedure returns #t if the results of passing their arguments to char->integer are monotonically increasing. This predicate is required to be transitive.

(scheme base) procedure (char=? (char1 char?) (char2 char?) (char3 char?) ... ) ⟹ boolean?

This procedure returns #t if the results of passing their arguments to char->integer are equal. This predicate is required to be transitive.

(scheme base) procedure (char>=? (char1 char?) (char2 char?) (char3 char?) ... ) ⟹ boolean?

This procedure returns #t if the results of passing their arguments to char->integer are monotonically non-increasing. This predicate is required to be transitive.

(scheme base) procedure (char>? (char1 char?) (char2 char?) (char3 char?) ... ) ⟹ boolean?

This procedure returns #t if the results of passing their arguments to char->integer are monotonically decreasing. This predicate is required to be transitive.

(scheme base) procedure (char? obj ) ⟹ boolean?

Returns #t if obj is a character, otherwise returns #f.

(scheme base) procedure (close-input-port (port input-port?) ) ⟹ undefined

Closes the resource associated with port, rendering the port incapable of delivering data. It is an error to apply the procedure to a port which is not an input port. Scheme implementations may provide ports which are simultaneously input and output ports, such as sockets; the close-input-port and close-output-port procedures can then be used to close the input and output sides of the port independently. The routine has no effect if the port has already been closed.

(scheme base) procedure (close-output-port (port output-port?) ) ⟹ undefined

Closes the resource associated with port, rendering the port incapable of accepting data. It is an error to apply the procedure to a port which is not an output port. Scheme implementations may provide ports which are simultaneously input and output ports, such as sockets; the close-input-port and close-output-port procedures can then be used to close the input and output sides of the port independently. The routine has no effect if the port has already been closed.

(scheme base) procedure (close-port (port port?) ) ⟹ undefined

Closes the resource associated with port, rendering the port incapable of delivering or accepting data. This routine has no effect if the port has already been closed.

(scheme base) syntax (cond (else => ) ((_ clause1 clause2 ...)) )

(test expression1 ...) (test => receiver) (else expression1 expression2 ...)

receiver ⟹ procedure?

A cond expression is evaluated by evaluating the test expressions of successive clauses in order until one of them evaluates to a true value (see section 6.3). When a test evaluates to a true value, the remaining expressions in its clause are evaluated in order, and the results of the last expression in the clause are returned as the results of the entire cond expression. If the selected clause contains only the test and no expressions, then the value of the test is returned as the result. If the selected clause uses the => alternate form, then the expression is evaluated. It is an error if its value is not a procedure that accepts one argument. This procedure is then called on the value of the test and the values returned by this procedure are returned by the cond expression. If all tests evaluate to #f, and there is no else clause, then the result of the conditional expression is unspecified; if there is an else clause, then its expressions are evaluated in order, and the values of the last one are returned.

(scheme base) procedure (cons obj1 obj2 ) ⟹ pair?

Returns a newly allocated pair whose car is obj1 and whose cdr is obj2. The pair is guaranteed to be different(sense of eqv?) from every existing object.

(scheme base) syntax (define () ((_ variable expression)) ((_ (variable parameter1 ...) body)) ((_ (variable parameter1 ... . parameter) body)) )

At the outermost level of a program, a definition (define variable expression) has essentially the same effect as the assignment expression (set! variable expression) if variable is bound to a non-syntax value. However, if variable is not bound, or is a syntactic keyword, then the definition will bind variable to a new location before performing the assignment, whereas it would be an error to perform a set! on an unbound variable. Definitions can occur at the beginning of a body (that is, the body of a lambda, let, let*, letrec, letrec*, let-values, let*-values, let-syntax, letrec-syntax, parameterize, guard, or case-lambda). Note that such a body might not be apparent until after expansion of other syntax. Such definitions are known as internal definitions as opposed to the global definitions described above. The variables defined by internal definitions are local to the body That is, variable is bound rather than assigned, and the region of the binding is the entire body. An expanded body containing internal definitions can always be converted into a completely equivalent letrec* expression. Just as for the equivalent letrec* expression, it is an error if it is not possible to evaluate each expression of every internal definition in a body without assigning or referring to the value of the corresponding variable or the variable of any of the definitions that follow it in body. It is an error to define the same identifier more than once in the same body. Wherever an internal definition can occur, (begin definition1 ...) is equivalent to the sequence of definitions that form the body of the begin.

(scheme base) syntax (define-syntax () ((_ keyword transformer-spec)) )

transformer-spec ⟹ transformer-spec

If the define-syntax occurs at the outermost level, then the global syntactic environment is extended by binding the keyword to the specified transformer, but previous expansions of any global binding for keyword remain unchanged. Otherwise, it is an internal syntax definition, and is local to the body in which it is defined. Any use of a syntax keyword before its corresponding definition is an error. In particular, a use that precedes an inner definition will not apply an outer definition. Macros can expand into definitions in any context that permits them. However, it is an error for a definition to define an identifier whose binding has to be known in order to determine the meaning of the definition itself, or of any preceding definition that belongs to the same group of internal definitions. Similarly, it is an error for an internal definition to define an identifier whose binding has to be known in order to determine the boundary between the internal definitions and the expressions of the body it belongs to.

(scheme base) syntax (define-values () ((_ formals expression)) )

(variable1 ...) variable (variable1 ... variable_n . variable_n+1)

Another kind of definition is provided by define-values, which creates multiple definitions from a single expression returning multiple values. It is allowed wherever define is allowed. It is an error if a variable appears more than once in the set of formals. Semantics: Expression is evaluated, and the formals are bound to the return values in the same way that the formals in a lambda expression are matched to the arguments in a procedure call.

(scheme base) procedure (denominator (q rational?) ) ⟹ integer?

This procedure returns the denominator of its argument; the result is computed as if the argument was represented as a fraction in lowest terms. The denominator is always positive. The denominator of 0 is defined to be 1.

(scheme base) syntax (do () ((_ (variable-decl1 ...) (test expression ...) command ...)) )

(variable init step) (variable init)

A do expression is an iteration construct. It specifies a set of variables to be bound, how they are to be initialized at the start, and how they are to be updated on each iteration. When a termination condition is met, the loop exits after evaluating the expressions. A do expression is evaluated as follows: The init expressions are evaluated (in some unspecified order), the variables are bound to fresh locations, the results of the init expressions are stored in the bindings of the variables, and then the iteration phase begins. Each iteration begins by evaluating test; if the result is false (see section 6.3), then the command expressions are evaluated in order for effect, the step expressions are evaluated in some unspecified order, the variables are bound to fresh locations, the results of the steps are stored in the bindings of the variables, and the next iteration begins. If test evaluates to a true value, then the expressions are evaluated from left to right and the values of the last expression are returned. If no expressions are present, then the value of the do expression is unspecified. The region of the binding of a variable consists of the entire do expression except for the inits. It is an error for a variable to appear more than once in the list of do variables. A step can be omitted, in which case the effect is the same as if (variable init variable) had been written instead of (variable init).

(scheme base) procedure (dynamic-wind (before procedure?) (thunk procedure?) (after procedure?) ) ⟹ *

(before ) ⟹ undefined

(thunk ) ⟹ *

(after ) ⟹ undefined

Calls thunk without arguments, returning the result(s) of this call. Before and after are called, also without arguments, as required by the following rules. Note that, in the absence of calls to continuations captured using call-with-current-continuation, the three arguments are called once each, in order. Before is called whenever execution enters the dynamic extent of the call to thunk and after is called whenever it exits that dynamic extent. The dynamic extent of a procedure call is the period between when the call is initiated and when it returns. The before and after thunks are called in the same dynamic environment as the call to dynamic-wind. In Scheme, because of call-with-current-continuation, the dynamic extent of a call is not always a single, connected time period. It is defined as follows: 1) The dynamic extent is entered when execution of the body of the called procedure begins; 2) The dynamic extent is also entered when execution is not within the dynamic extent and a continuation is invoked that was captured (using call-with-current-continuation) during the dynamic extent; 3) It is exited when the called procedure returns; 4) It is also exited when execution is within the dynamic extent and a continuation is invoked that was captured while not within the dynamic extent. If a second call to dynamic-wind occurs within the dynamic extent of the call to thunk and then a continuation is invoked in such a way that the after s from these two invocations of dynamic-wind are both to be called, then the after associated with the second (inner) call to dynamic-wind is called first. If a second call to dynamic-wind occurs within the dynamic extent of the call to thunk and then a continuation is invoked in such a way that the befores from these two invocations of dynamic-wind are both to be called, then the before associated with the first (outer) call to dynamic-wind is called first. If invoking a continuation requires calling the before from one call to dynamic-wind and the after from another, then the after is called first. The ect of using a captured continuation to enter or exit the dynamic extent of a call to before or after is unspecified.

(scheme base) procedure (eof-object ) ⟹ eof-object?

Returns an end-of-file object, not necessarily unique.

(scheme base) procedure (eof-object? obj ) ⟹ boolean?

Returns #t if obj is an end-of-file object, otherwise returns #f. The precise set of end-of-file objects will vary among implementations, but in any case no end-of-file object will ever be an object that can be read in using read.

(scheme base) procedure (eq? obj1 obj2 ) ⟹ boolean?

The eq? procedure is similar to eqv? except that in some cases it is capable of discerning distinctions finer than those detectable by eqv?. It must always return #f when eqv? also would, but may return #f in some cases where eqv? would return #t. On symbols, booleans, the empty list, pairs, and records, and also on non-empty strings, vectors, and bytevectors, eq? and eqv? are guaranteed to have the same behavior. On procedures, eq? must return true if the arguments' location tags are equal. On numbers and characters, eq?'s behavior is implementation-dependent, but it will always return either true or false. On empty strings, empty vectors, and empty bytevectors, eq? may also behave differently from eqv?.

(scheme base) procedure (equal? obj1 obj2 ) ⟹ boolean?

The equal? procedure, when applied to pairs, vectors, strings and bytevectors, recursively compares them, returning #t when the unfoldings of its arguments into (possibly infinite) trees are equal (in the sense of equal? ) as ordered trees, and #f otherwise. It returns the same as eqv? when applied to booleans, symbols, numbers, characters, ports, procedures, and the empty list. If two objects are eqv? , they must be equal? as well. In all other cases, equal? may return either #t or #f. Note: A rule of thumb is that objects are generally equal? if they print the same.

(scheme base) procedure (eqv? obj1 obj2 ) ⟹ boolean?

The eqv? procedure defines a useful equivalence relation on objects. Briefly, it returns #t if obj1 and obj2 are normally regarded as the same object. This relation is left slightly open to interpretation, but the following partial specification of eqv? holds for all implementations of Scheme. The eqv? procedure returns #t if: obj1 and obj2 are both #t or both #f; obj1 and obj2 are both symbols and are the same symbol according to the symbol=? procedure (section 6.5); obj1 and obj2 are both exact numbers and are numerically equal (in the sense of =); obj1 and obj2 are both inexact numbers such that they are numerically equal (in the sense of =) and they yield the same results (in the sense of eqv?) when passed as arguments to any other procedure that can be defined as a finite composition of Scheme's standard arithmetic procedures, provided it does not result in a NaN value; obj1 and obj2 are both characters and are the same character according to the char=? procedure (section 6.6); obj1 and obj2 are both the empty list; obj1 and obj2 are pairs, vectors, bytevectors, records, or strings that denote the same location in the store (section 3.4); obj1 and obj2 are procedures whose location tags are equal (section 4.1.4). The eqv? procedure returns #f if: obj1 and obj2 are of different types (section 3.2); one of obj1 and obj2 is #t but the other is #f; obj1 and obj2 are symbols but are not the same symbol according to the symbol=? procedure (section 6.5); one of obj1 and obj2 is an exact number but the other is an inexact number; obj1 and obj2 are both exact numbers and are numerically unequal (in the sense of =); obj1 and obj2 are both inexact numbers such that either they are numerically unequal (in the sense of =), or they do not yield the same results (in the sense of eqv?) when passed as arguments to any other procedure that can be defined as a finite composition of Scheme's standard arithmetic procedures, provided it does not result in a NaN value. As an exception, the behavior of eqv? is unspecified when both obj1 and obj2 are NaN; obj1 and obj2 are characters for which the char=? procedure returns #f; one of obj1 and obj2 is the empty list but the other is not; obj1 and obj2 are pairs, vectors, bytevectors, records, or strings that denote distinct locations; obj1 and obj2 are procedures that would behave differently (return different values or have different side effects) for some arguments.

(scheme base) procedure (error-object-irritants (error-object error-object?) ) ⟹ list?

Returns a list of the irritants encapsulated by error-object.

(scheme base) procedure (error-object-message (error-object error-object?) ) ⟹ string?

Returns the message encapsulated by error-object.

(scheme base) procedure (error-object? obj ) ⟹ boolean?

Returns #t if obj is an object created by error or one of an implementation-defined set of objects. Otherwise, it returns #f. The objects used to signal errors, including those which satisfy the predicates file-error? and read-error?, may or may not satisfy error-object?.

(scheme base) procedure (exact (z number?) ) ⟹ exact?

The procedure exact returns an exact representation of z. The value returned is the exact number that is numerically closest to the argument. For exact arguments, the result is the same as the argument. For inexact nonintegral real arguments, the implementation may return a rational approximation, or may report an implementation violation. For inexact complex arguments, the result is a complex number whose real and imaginary parts are the result of applying exact to the real and imaginary parts of the argument, respectively. If an inexact argument has no reasonably close exact equivalent, (in the sense of =), then a violation of an implementation restriction may be reported.

(scheme base) procedure (exact-integer-sqrt (k integer?) ) ⟹ (values integer?integer?)

Returns two non-negative exact integers s and r where k = s^2 + r and k < (s + 1)^2.

(scheme base) procedure (exact-integer? (z number?) ) ⟹ boolean?

Returns #t if z is both exact and an integer; otherwise returns #f.

(scheme base) procedure (exact? (z number?) ) ⟹ boolean?

This numerical predicate provides tests for the exactness of a quantity. For any Scheme number, precisely one of exact? or inexact? predicates is true.

(scheme base) procedure (expt (z1 number?) (z2 number?) ) ⟹ number?

Returns z1 raised to the power z2.

(scheme base) procedure (features ) ⟹ list?

Returns a list of the feature identifiers which cond-expand treats as true. It is an error to modify this list.

(scheme base) procedure (file-error? obj ) ⟹ boolean?

Error type predicate. Returns #t if obj is an object raised by the inability to open an input or output port on a file. Otherwise, it returns #f.

(scheme base) procedure (floor (x real?) ) ⟹ integer?

The floor procedure returns the largest integer not larger than x. Note: If the argument is inexact, then the result will also be inexact. If an exact value is needed, the result can be passed to the exact procedure. If the argument is infinite or a NaN, then it is returned.

(scheme base) procedure (floor-quotient (n1 integer?) (n2 integer?) ) ⟹ integer?

This procedure implements number-theoretic (integer) division. It is an error if n2 is zero. The procedure computes a quotient nq and remainder nr such that n1 = n2 * nq + nr.

(scheme base) procedure (floor-remainder (n1 integer?) (n2 integer?) ) ⟹ integer?

This procedure implements number-theoretic (integer) division. It is an error if n2 is zero. The procedure computes a quotient nq and remainder nr such that n1 = n2 * nq + nr.

(scheme base) procedure (floor/ (n1 integer?) (n2 integer?) ) ⟹ (values integer?integer?)

This procedure implements number-theoretic (integer) division. It is an error if n2 is zero. The procedure computes a quotient nq and remainder nr such that n1 = n2 * nq + nr.

(scheme base) procedure (flush-output-port ) ⟹ undefined

(scheme base) procedure (flush-output-port (port output-port?) ) ⟹ undefined

Flushes any buffered output from the buffer of output-port to the underlying file or device and returns an unspecified value.

(scheme base) procedure (for-each (proc procedure?) (list1 list?) (list2 list?) ... ) ⟹ undefined

(proc obj1 obj2 ... ) ⟹ undefined

It is an error if proc does not accept as many arguments as there are lists. The arguments to for-each are like the arguments to map, but for-each calls proc for its side ects rather than for its values. Unlike map, for-each is guaranteed to call proc on the elements of the lists in order from the first element( s) to the last, and the value returned by for-each is unspecified. If more than one list is given and not all lists have the same length, for-each terminates when the shortest list runs out. It is an error for proc to mutate any of the lists.

(scheme base) procedure (gcd (n integer?) ... ) ⟹ integer?

This procedure returns the greatest common divisor of its arguments. The result is always non-negative.

(scheme base) procedure (get-output-bytevector (port output-port?) ) ⟹ bytevector?

It is an error if port was not created with open-output-bytevector. Returns a bytevector consisting of the bytes that have been output to the port so far in the order they were output.

(scheme base) syntax (if () ((_ test consequent)) ((_ test consequent alternate)) )

An if expression is evaluated as follows: first, test is evaluated. If it yields a true value (see section 6.3), then consequent is evaluated and its values are returned. Otherwise alternate is evaluated and its values are returned. If test yields a false value and no alternate is specified, then the result of the expression is unspecified.

(scheme base) syntax (include () ((_ string1 string2 ...)) )

Include takes one or more filenames expressed as string literals, applies an implementation-specific algorithm to find corresponding files, reads the contents of the files in the specified order as if by repeated applications of read, and effectively replaces the include expression with a begin expression containing what was read from the files. Note: Implementations are encouraged to search for files in the directory which contains the including file, and to provide a way for users to specify other directories to search.

(scheme base) syntax (include-ci () ((_ string1 string2 ...)) )

Include-ci takes one or more filenames expressed as string literals, applies an implementation-specific algorithm to find corresponding files, reads the contents of the files in the specified order as if by repeated applications of read, and effectively replaces the include-ci expression with a begin expression containing what was read from the files. Include-ci reads each file as if it began with the #!fold-case directive. Note: Implementations are encouraged to search for files in the directory which contains the including file, and to provide a way for users to specify other directories to search.

(scheme base) procedure (inexact (z number?) ) ⟹ inexact?

The procedure inexact returns an inexact representation of z. The value returned is the inexact number that is numerically closest to the argument. For inexact arguments, the result is the same as the argument. For exact complex numbers, the result is a complex number whose real and imaginary parts are the result of applying inexact to the real and imaginary parts of the argument, respectively. If an exact argument has no reasonably close inexact equivalent (in the sense of =), then a violation of an implementation restriction may be reported.

(scheme base) procedure (inexact? (z number?) ) ⟹ boolean?

This numerical predicate provides tests for the exactness of a quantity. For any Scheme number, precisely one of exact? and inexact? predicates is true.

(scheme base) procedure (input-port-open? (port input-port?) ) ⟹ boolean?

Returns #t if port is still open and capable of performing input, and #f otherwise.

(scheme base) procedure (integer->char (n integer?) ) ⟹ char?

Given an exact integer that is the value returned by a character when char->integer is applied to it, integer->char returns that character.

(scheme base) syntax (lambda () ((_ formals body) procedure?) )

(variable1 ...) variable (variable1 ... variable_n . variable_n+1)

A lambda expression evaluates to a procedure. The environment in effect when the lambda expression was evaluated is remembered as part of the procedure. When the procedure is later called with some actual arguments, the environment in which the lambda expression was evaluated will be extended by binding the variables in the formal argument list to fresh locations, and the corresponding actual argument values will be stored in those locations. (A fresh location is one that is distinct from every previously existing location.) Next, the expressions in the body of the lambda expression (which, if it contains definitions, represents a letrec* form -- see section 4.2.2) will be evaluated sequentially in the extended environment. The results of the last expression in the body will be returned as the results of the procedure call. Each procedure created as the result of evaluating a lambda expression is (conceptually) tagged with a storage location, in order to make eqv? and eq? work on procedures (see section 6.1).

(scheme base) procedure (lcm (n integer?) ... ) ⟹ integer?

This procedure returns the least common multiple of its arguments. The result is always non-negative.

(scheme base) procedure (length (list list?) ) ⟹ integer?

Returns the length of list.

(scheme base) syntax (let () ((_ ((var1 init1) ...) body)) ((_ name ((var1 init1) ...) body)) )

The inits are evaluated in the current environment (in some unspecified order), the variables are bound to fresh locations holding the results, the body is evaluated in the extended environment, and the values of the last expression of body are returned. Each binding of a variable has body as its region. "Named let" is a variant on the syntax of let which provides a more general looping construct than do and can also be used to express recursion. It has the same syntax and semantics as ordinary let except that variable is bound within body to a procedure whose formal arguments are the bound variables and whose body is body. Thus the execution of body can be repeated by invoking the procedure named by variable.

(scheme base) syntax (let* () ((_ bindings body)) )

((variable1 init1) ...)

The let* binding construct is similar to let, but the bindings are performed sequentially from left to right, and the region of a binding indicated by (variable init) is that part of the let* expression to the right of the binding. Thus the second binding is done in an environment in which the first binding is visible, and so on. The variables need not be distinct.

(scheme base) syntax (let-syntax () ((_ bindings body)) )

((keyword transformer-spec) ...)

transformer-spec ⟹ transformer-spec

The body is expanded in the syntactic environment obtained by extending the syntactic environment of the let-syntax expression with macros whose keywords are the keywords, bound to the specified transformers. Each binding of a keyword has body as its region.

(scheme base) syntax (letrec () ((_ bindings body)) )

((variable1 init1) ...)

The variables are bound to fresh locations holding unspecified values, the inits are evaluated in the resulting environment (in some unspecified order), each variable is assigned to the result of the corresponding init, the body is evaluated in the resulting environment, and the values of the last expression in body are returned. Each binding of a variable has the entire letrec expression as its region, making it possible to define mutually recursive procedures.

(scheme base) syntax (letrec* () ((_ bindings body)) )

((variable1 init1) ...)

The variables are bound to fresh locations, each variable is assigned in left-to-right order to the result of evaluating the corresponding init, the body is evaluated in the resulting environment, and the values of the last expression in body are returned. Despite the left-to-right evaluation and assignment order, each binding of a variable has the entire letrec* expression as its region, making it possible to define mutually recursive procedures. If it is not possible to evaluate each init without assigning or referring to the value of the corresponding variable or the variable of any of the bindings that follow it in bindings, it is an error. Another restriction is that it is an error to invoke the continuation of an init more than once.

(scheme base) syntax (letrec-syntax () ((_ bindings body)) )

((keyword transformer-spec) ...)

The body is expanded in the syntactic environment obtained by extending the syntactic environment of the letrec-syntax expression with macros whose keywords are the keywords, bound to the specified transformers. Each binding of a keyword has the transformer specs as well as the body within its region, so the transformers can transcribe expressions into uses of the macros introduced by the letrec-syntax expression.

(scheme base) procedure (list obj ... ) ⟹ list?

Returns a newly allocated list of its arguments.

(scheme base) procedure (list->string (list list?) ) ⟹ string?

list ⟹ (list (c char?))

list->string returns a newly allocated string formed from the elements in the list list. The order is preserved. string->list and list->string are inverses so far as equal? is concerned.

(scheme base) procedure (list->vector (list list?) ) ⟹ vector?

The list->vector procedure returns a newly created vector initialized to the elements of the list list. The order is preserved.

(scheme base) procedure (list-copy obj ) ⟹ *

Returns a newly allocated copy of the given obj if it is a list. Only the pairs themselves are copied; the cars of the result are the same (in the sense of eqv?) as the cars of list . If obj is an improper list, so is the result, and the final cdrs are the same in the sense of eqv?. An obj which is not a list is returned unchanged. It is an error if obj is a circular list.

(scheme base) procedure (list-ref (list list?) (k integer?) ) ⟹ *

It is an error if list has fewer than k elements. Returns the kth element of list. (This is the same as the car of (list-tail list k).)

(scheme base) procedure (list-set! (list list?) (k integer?) obj ) ⟹ undefined

It is an error if k is not a valid index of list. The list-set! procedure stores obj in element k of list.

(scheme base) procedure (list-tail (list list?) (k integer?) ) ⟹ list?

It is an error if list has fewer than k elements. Returns the sublist of list obtained by omitting the first k elements.

(scheme base) procedure (list? obj ) ⟹ boolean?

Returns #t if obj is a list. Otherwise, it returns #f. By definition, all lists have finite length and are terminated by the empty list.

(scheme base) procedure (make-bytevector (k integer?) ) ⟹ bytevector?

(scheme base) procedure (make-bytevector (k integer?) (byte integer?) ) ⟹ bytevector?

The make-bytevector procedure returns a newly allocated bytevector of length k. If byte is given, then all elements of the bytevector are initialized to byte, otherwise the contents of each element are unspecified.

(scheme base) procedure (make-list (k integer?) ) ⟹ list?

(scheme base) procedure (make-list (k integer?) obj ) ⟹ list?

Returns a newly allocated list of k elements. If a second argument is given, then each element is initialized to fill. Otherwise the initial contents of each element is unspecified.

(scheme base) procedure (make-string (k integer?) ) ⟹ string?

(scheme base) procedure (make-string (k integer?) (char char?) ) ⟹ string?

The make-string procedure returns a newly allocated string of length k. If char is given, then all the characters of the string are initialized to char, otherwise the contents of the string are unspecified.

(scheme base) procedure (make-vector (k integer?) ) ⟹ vector?

(scheme base) procedure (make-vector (k integer?) fill ) ⟹ vector?

Returns a newly allocated vector of k elements. If a second argument is given, then each element is initialized to fill . Otherwise the initial contents of each element is unspeci- fied.

(scheme base) procedure (map (proc procedure?) (list1 list?) (list2 list?) ... ) ⟹ list?

(proc obj1 obj2 ... ) ⟹ *

It is an error if proc does not accept as many arguments as there are lists and return a single value. The map procedure applies proc element-wise to the elements of the lists and returns a list of the results, in order. If more than one list is given and not all lists have the same length, map terminates when the shortest list runs out. It is an error for proc to mutate any of the lists. The dynamic order in which proc is applied to the elements of the lists is unspecified. If multiple returns occur from map, the values returned by earlier returns are not mutated.

(scheme base) procedure (max (x1 real?) (x2 real?) ... ) ⟹ real?

This procedure returns the maximum of its arguments. Note: If any argument is inexact, then the result will also be inexact (unless the procedure can prove that the inaccuracy is not large enough to affect the result, which is possible only in unusual implementations). If min or max is used to compare numbers of mixed exactness, and the numerical value of the result cannot be represented as an inexact number without loss of accuracy, then the procedure may report a violation of an implementation restriction.

(scheme base) procedure (member obj (list list?) ) ⟹ #f / list? /

(scheme base) procedure (member obj (list list?) (compare procedure?) ) ⟹ #f / list? /

(compare obj1 obj2 ) ⟹ *

This procedure returns the first sublist of list whose car is obj , where the sublists of list are the non-empty lists returned by (list-tail list k) for k less than the length of list . If obj does not occur in list , then #f (not the empty list) is returned. The member procedure uses compare, if given, and equal? otherwise to compare obj with the elements of list.

(scheme base) procedure (memq obj (list list?) ) ⟹ #f / list? /

This procedure returns the first sublist of list whose car is obj , where the sublists of list are the non-empty lists returned by (list-tail list k) for k less than the length of list . If obj does not occur in list , then #f (not the empty list) is returned. The memq procedure uses eq? to compare obj with the elements of list.

(scheme base) procedure (memv obj (list list?) ) ⟹ #f / list? /

This procedure returns the first sublist of list whose car is obj , where the sublists of list are the non-empty lists returned by (list-tail list k) for k less than the length of list . If obj does not occur in list , then #f (not the empty list) is returned. The memv procedure uses eqv? to compare obj with the elements of list.

(scheme base) procedure (min (x1 real?) (x2 real?) ... ) ⟹ real?

This procedure returns the minimum of its arguments. Note: If any argument is inexact, then the result will also be inexact (unless the procedure can prove that the inaccuracy is not large enough to affect the result, which is possible only in unusual implementations). If min or max is used to compare numbers of mixed exactness, and the numerical value of the result cannot be represented as an inexact number without loss of accuracy, then the procedure may report a violation of an implementation restriction.

(scheme base) procedure (modulo (n1 integer?) (n2 integer?) ) ⟹ integer?

The modulo is equivalent to floor-remainder.

(scheme base) procedure (newline ) ⟹ undefined

(scheme base) procedure (newline (port output-port?) ) ⟹ undefined

Writes an end of line to textual output port. Returns an unspecified value.

(scheme base) procedure (not obj ) ⟹ boolean?

The not procedure returns #t if obj is false, and returns #f otherwise.

(scheme base) procedure (null? obj ) ⟹ boolean?

Returns #t if obj is the empty list, otherwise returns #f.

(scheme base) procedure (number->string (z number?) ) ⟹ string?

(scheme base) procedure (number->string (z number?) (radix integer?) ) ⟹ string?

It is an error if radix is not one of 2, 8, 10, or 16. The procedure number->string takes a number and a radix and returns as a string an external representation of the given number in the given radix. It is an error if no possible result makes this expression true. If omitted, radix defaults to 10. If z is inexact, the radix is 10, and the above expression can be satisfied by a result that contains a decimal point, then the result contains a decimal point and is expressed using the minimum number of digits (exclusive of exponent and trailing zeroes) needed to make the above expression true [4, 5]; otherwise the format of the result is unspecified. The result returned by number->string never contains an explicit radix prefix. Note: The error case can occur only when z is not a complex number or is a complex number with a non-rational real or imaginary part. Rationale: If z is an inexact number and the radix is 10, then the above expression is normally satisfied by a result containing a decimal point. The unspecified case allows for infinities, NaNs, and unusual representations.

(scheme base) procedure (numerator (q rational?) ) ⟹ integer?

This procedure returns the numerator of its argument; the result is computed as if the argument was represented as a fraction in lowest terms.

(scheme base) procedure (open-input-bytevector (bytevector bytevector?) ) ⟹ input-port?

Takes a bytevector and returns a binary input port that delivers bytes from the bytevector.

(scheme base) procedure (open-output-bytevector ) ⟹ output-port?

Returns a binary output port that will accumulate bytes for retrieval by get-output-bytevector.

(scheme base) syntax (or () ((_ test1 ...)) )

The test expressions are evaluated from left to right, and the value of the first expression that evaluates to a true value (see section 6.3) is returned. Any remaining expressions are not evaluated. If all expressions evaluate to #f or if there are no expressions, then #f is returned.

(scheme base) procedure (output-port-open? (port output-port?) ) ⟹ boolean?

Returns #t if port is still open and capable of performing output, and #f otherwise.

(scheme base) procedure (pair? obj ) ⟹ boolean?

The pair? predicate returns #t if obj is a pair, and otherwise returns #f.

(scheme base) procedure (peek-char ) ⟹ eof-object? / char? /

(scheme base) procedure (peek-char (port input-port?) ) ⟹ eof-object? / char? /

Returns the next character available from the textual input port, but without updating the port to point to the following character. If no more characters are available, an end-of-file object is returned. Note: The value returned by a call to peek-char is the same as the value that would have been returned by a call to read-char with the same port. The only diㄦence is that the very next call to read-char or peek-char on that port will return the value returned by the preceding call to peek-char. In particular, a call to peek-char on an interactive port will hang waiting for input whenever a call to read-char would have hung. (read-line) procedure

(scheme base) procedure (peek-u8 ) ⟹ eof-object? / integer? /

(scheme base) procedure (peek-u8 (port input-port?) ) ⟹ eof-object? / integer? /

Returns the next byte available from the binary input port, but without updating the port to point to the following byte. If no more bytes are available, an end-of-file object is returned.

(scheme base) procedure (procedure? obj ) ⟹ boolean?

Returns #t if obj is a procedure, otherwise returns #f.

(scheme base) syntax (quasiquote () ((_ qq-template)) )

"Quasiquote" expressions are useful for constructing a list or vector structure when some but not all of the desired structure is known in advance. If no commas appear within the qq template, the result of evaluating qq template is equivalent to the result of evaluating 'qq template. If a comma appears within the qq template, however, the expression following the comma is evaluated ("unquoted") and its result is inserted into the structure instead of the comma and the expression. If a comma appears followed without intervening whitespace by a commercial at-sign (@), then it is an error if the following expression does not evaluate to a list; the opening and closing parentheses of the list are then "stripped away" and the elements of the list are inserted in place of the comma at-sign expression sequence. A comma at-sign normally appears only within a list or vector qq template. Note: In order to unquote an identifier beginning with @, it is necessary to use either an explicit unquote or to put whitespace after the comma, to avoid colliding with the comma at-sign sequence. Quasiquote expressions can be nested. Substitutions are made only for unquoted components appearing at the same nesting level as the outermost quasiquote. The nesting level increases by one inside each successive quasiquotation, and decreases by one inside each unquotation. A quasiquote expression may return either newly allocated, mutable objects or literal structure for any structure that is constructed at run time during the evaluation of the expression. Portions that do not need to be rebuilt are always literal.

(scheme base) syntax (quote () ((_ datum)) )

(quote datum) evaluates to datum. Datum can be any external representation of a Scheme object (see section 3.3). This notation is used to include literal constants in Scheme code. (quote datum) can be abbreviated as 'datum. The two notations are equivalent in all respects. Numerical constants, string constants, character constants, vector constants, bytevector constants, and boolean constants evaluate to themselves; they need not be quoted. As noted in section 3.4, it is an error to attempt to alter a constant (i.e. the value of a literal expression) using a mutation procedure like set-car! or string-set!.

(scheme base) procedure (quotient (n1 integer?) (n2 integer?) ) ⟹ integer?

The quotient procedure is equivalent to truncate-quotient.

(scheme base) procedure (raise-continuable obj ) ⟹ undefined

Raises an exception by invoking the current exception handler on obj. The handler is called with the same dynamic environment as the call to raise-continuable, except that: (1) the current exception handler is the one that was in place when the handler being called was installed, and (2) if the handler being called returns, then it will again become the current exception handler. If the handler returns, the values it returns become the values returned by the call to raise-continuable.

(scheme base) procedure (rationalize (x real?) (y real?) ) ⟹ rational?

The rationalize procedure returns the simplest rational number differing from x by no more than y.

(scheme base) procedure (read-bytevector (k integer?) ) ⟹ bytevector?

(scheme base) procedure (read-bytevector (k integer?) (port input-port?) ) ⟹ bytevector?

Reads the next k bytes, or as many as are available before the end of file, from the binary input port into a newly allocated bytevector in left-to-right order and returns the bytevector. If no bytes are available before the end of file, an end-of-file object is returned.

(scheme base) procedure (read-bytevector! (bytevector bytevector?) ) ⟹ eof-object? / integer? /

(scheme base) procedure (read-bytevector! (bytevector bytevector?) (port input-port?) ) ⟹ eof-object? / integer? /

(scheme base) procedure (read-bytevector! (bytevector bytevector?) (port input-port?) (start integer?) ) ⟹ eof-object? / integer? /

(scheme base) procedure (read-bytevector! (bytevector bytevector?) (port input-port?) (start integer?) (end integer?) ) ⟹ eof-object? / integer? /

Reads the next end − start bytes, or as many as are available before the end of file, from the binary input port into bytevector in left-to-right order beginning at the start position. If end is not supplied, reads until the end of bytevector has been reached. If start is not supplied, reads beginning at position 0. Returns the number of bytes read. If no bytes are available, an end-of-file object is returned.

(scheme base) procedure (read-char ) ⟹ eof-object? / char? /

(scheme base) procedure (read-char (port input-port?) ) ⟹ eof-object? / char? /

Returns the next character available from the textual input port, updating the port to point to the following character. If no more characters are available, an end-of-file object is returned.

(scheme base) procedure (read-error? obj ) ⟹ boolean?

read-error?, file-error? Error type predicates. Returns #t if obj is an object raised by the read procedure or by the inability to open an input or output port on a file, respectively. Otherwise, it returns #f.

(scheme base) procedure (read-line ) ⟹ eof-object? / string? /

(scheme base) procedure (read-line (port input-port?) ) ⟹ eof-object? / string? /

Returns the next line of text available from the textual input port, updating the port to point to the following character. If an end of line is read, a string containing all of the text up to (but not including) the end of line is returned, and the port is updated to point just past the end of line. If an end of file is encountered before any end of line is read, but some characters have been read, a string containing those characters is returned. If an end of file is encountered before any characters are read, an end-of-file object is returned. For the purpose of this procedure, an end of line consists of either a linefeed character, a carriage return character, or a sequence of a carriage return character followed by a linefeed character. Implementations may also recognize other end of line characters or sequences.

(scheme base) procedure (read-string (k integer?) ) ⟹ eof-object? / string? /

(scheme base) procedure (read-string (k integer?) (port input-port?) ) ⟹ eof-object? / string? /

Reads the next k characters, or as many as are available before the end of file, from the textual input port into a newly allocated string in left-to-right order and returns the string. If no characters are available before the end of file, an end-of-file object is returned.

(scheme base) procedure (read-u8 ) ⟹ eof-object? / integer? /

(scheme base) procedure (read-u8 (port input-port?) ) ⟹ eof-object? / integer? /

Returns the next byte available from the binary input port, updating the port to point to the following byte. If no more bytes are available, an end-of-file object is returned.

(scheme base) procedure (remainder (n1 integer?) (n2 integer?) ) ⟹ integer?

The remainder procedure is equivalent to truncate-remainder.

(scheme base) procedure (reverse (list list?) ) ⟹ list?

Returns a newly allocated list consisting of the elements of list in reverse order.

(scheme base) procedure (round (x real?) ) ⟹ integer?

The round returns the closest integer to x, rounding to even when x is halfway between two integers. Rationale: The round procedure rounds to even for consistency with the default rounding mode specified by the IEEE 754 IEEE floating-point standard. Note: If the argument to one of these procedures is inexact, then the result will also be inexact. If an exact value is needed, the result can be passed to the exact procedure. If the argument is infinite or a NaN, then it is returned.

(scheme base) syntax (set! () ((_ variable expression)) )

Expression is evaluated, and the resulting value is stored in the location to which variable is bound. It is an error if variable is not bound either in some region enclosing the set! expression or else globally. The result of the set! expression is unspecified.

(scheme base) procedure (set-car! (pair pair?) obj ) ⟹ undefined

Stores obj in the car field of pair.

(scheme base) procedure (set-cdr! (pair pair?) obj ) ⟹ undefined

Stores obj in the cdr field of pair.

(scheme base) procedure (square (z number?) ) ⟹ number?

Returns the square of z. This is equivalent to (* z z).

(scheme base) procedure (string (char char?) ... ) ⟹ string?

Returns a newly allocated string composed of the arguments. It is analogous to list.

(scheme base) procedure (string->list (string string?) ) ⟹ list?

(scheme base) procedure (string->list (string string?) (start integer?) ) ⟹ list?

(scheme base) procedure (string->list (string string?) (start integer?) (end integer?) ) ⟹ list?

return ⟹ (list (c char?))

The string->list procedure returns a newly allocated list of the characters of string between start and end. The order is preserved. string->list and list->string are inverses so far as equal? is concerned.

(scheme base) procedure (string->number (string string?) ) ⟹ number?

(scheme base) procedure (string->number (string string?) (radix integer?) ) ⟹ number?

Returns a number of the maximally precise representation expressed by the given string. It is an error if radix is not 2, 8, 10, or 16. If supplied, radix is a default radix that will be overridden if an explicit radix prefix is present in string (e.g. "#o177"). If radix is not supplied, then the default radix is 10. If string is not a syntactically valid notation for a number, or would result in a number that the implementation cannot represent, then string->number returns #f. An error is never signaled due to the content of string. Note: The domain of string->number may be restricted by implementations in the following ways. If all numbers supported by an implementation are real, then string->number is permitted to return #f whenever string uses the polar or rectangular notations for complex numbers. If all numbers are integers, then string->number may return #f whenever the fractional notation is used. If all numbers are exact, then string->number may return #f whenever an exponent marker or explicit exactness prefix is used. If all inexact numbers are integers, then string->number may return #f whenever a decimal point is used. The rules used by a particular implementation for string->number must also be applied to read and to the routine that reads programs, in order to maintain consistency between internal numeric processing, I/O, and the processing of programs. As a consequence, the R5RS permission to return #f when string has an explicit radix prefix has been withdrawn.

(scheme base) procedure (string->symbol (string string?) ) ⟹ symbol?

Returns the symbol whose name is string. This procedure can create symbols with names containing special characters that would require escaping when written, but does not interpret escapes in its input.

(scheme base) procedure (string->utf8 (string string?) ) ⟹ bytevector?

(scheme base) procedure (string->utf8 (string string?) (start integer?) ) ⟹ bytevector?

(scheme base) procedure (string->utf8 (string string?) (start integer?) (end integer?) ) ⟹ bytevector?

This procedure translates between strings and bytevectors that encode those strings using the UTF-8 encoding. The string->utf8 procedure encodes the characters of a string between start and end and returns the corresponding bytevector.

(scheme base) procedure (string->vector (string string?) ) ⟹ vector?

(scheme base) procedure (string->vector (string string?) (start integer?) ) ⟹ vector?

(scheme base) procedure (string->vector (string string?) (start integer?) (end integer?) ) ⟹ vector?

return ⟹ (vector (char char?))

It is an error if any element of vector between start and end is not a character. The string->vector procedure returns a newly created vector initialized to the elements of the string string between start and end. The order is preserved.

(scheme base) procedure (string-append (string string?) ... ) ⟹ string?

Returns a newly allocated string whose characters are the concatenation of the characters in the given strings.

(scheme base) procedure (string-copy (string string?) ) ⟹ string?

(scheme base) procedure (string-copy (string string?) (start integer?) ) ⟹ string?

(scheme base) procedure (string-copy (string string?) (start integer?) (end integer?) ) ⟹ string?

Returns a newly allocated copy of the part of the given string between start and end.

(scheme base) procedure (string-copy! (to string?) (at integer?) (from string?) ) ⟹ undefined

(scheme base) procedure (string-copy! (to string?) (at integer?) (from string?) (start integer?) ) ⟹ undefined

(scheme base) procedure (string-copy! (to string?) (at integer?) (from string?) (start integer?) (end integer?) ) ⟹ undefined

It is an error if at is less than zero or greater than the length of to. It is also an error if (- (string-length to) at) is less than (- end start).

Copies the characters of string from between start and end to string to, starting at at. The order in which characters are copied is unspecified, except that if the source and destination overlap, copying takes place as if the source is first copied into a temporary string and then into the destination. This can be achieved without allocating storage by making sure to copy in the correct direction in such circumstances.

(scheme base) procedure (string-fill! (string string?) (fill char?) ) ⟹ undefined

(scheme base) procedure (string-fill! (string string?) (fill char?) (start integer?) ) ⟹ undefined

(scheme base) procedure (string-fill! (string string?) (fill char?) (start integer?) (end integer?) ) ⟹ undefined

It is an error if fill is not a character. The string-fill! procedure stores fill in the elements of string between start and end.

(scheme base) procedure (string-for-each (proc procedure?) (string1 string?) (string2 string?) ... ) ⟹ undefined

(proc (string string?) ... ) ⟹ undefined

It is an error if proc does not accept as many arguments as there are strings. The arguments to string-for-each are like the arguments to string-map, but string-for-each calls proc for its side effects rather than for its values. Unlike string-map, string-for-each is guaranteed to call proc on the elements of the lists in order from the first element(s) to the last, and the value returned by string-for-each is unspecified. If more than one string is given and not all strings have the same length, string-for-each terminates when the shortest string runs out. It is an error for proc to mutate any of the strings.

(scheme base) procedure (string-length (string string?) ) ⟹ integer?

Returns the number of characters in the given string.

(scheme base) procedure (string-map (proc procedure?) (string1 string?) (string2 string?) ... ) ⟹ string?

(proc (c1 char?) ... ) ⟹ char?

It is an error if proc does not accept as many arguments as there are strings and return a single character. The string-map procedure applies proc element-wise to the elements of the strings and returns a string of the results, in order. If more than one string is given and not all strings have the same length, string-map terminates when the shortest string runs out. The dynamic order in which proc is applied to the elements of the strings is unspecified. If multiple returns occur from string-map, the values returned by earlier returns are not mutated.

(scheme base) procedure (string-ref (string string?) (k integer?) ) ⟹ char?

It is an error if k is not a valid index of string. The string-ref procedure returns character k of string using zero-origin indexing. There is no requirement for this procedure to execute in constant time.

(scheme base) procedure (string-set! (string string?) (k integer?) (char char?) ) ⟹ undefined

It is an error if k is not a valid index of string. The string-set! procedure stores char in element k of string. There is no requirement for this procedure to execute in constant time.

(scheme base) procedure (string<=? (string1 string?) (string2 string?) (string3 string?) ... ) ⟹ boolean?

This procedure returns #t if its arguments are monotonically non-decreasing. This predicate is required to be transitive. The procedure compares strings in an implementation defined way. One approach is to make them the lexicographic extensions to strings of the corresponding orderings on characters. In that case, string<? would be the lexicographic ordering on strings induced by the ordering char<? on characters, and if the two strings differ in length but are the same up to the length of the shorter string, the shorter string would be considered to be lexicographically less than the longer string. However, it is also permitted to use the natural ordering imposed by the implementation’s internal representation of strings, or a more complex locale-specific ordering. In all cases, a pair of strings must satisfy exactly one of string<?, string=?, and string>?, and must satisfy string<=? if and only if they do not satisfy string>? and string>=? if and only if they do not satisfy string<?.

(scheme base) procedure (string<? (string1 string?) (string2 string?) (string3 string?) ... ) ⟹ boolean?

This procedure returns #t if its arguments are monotonically increasing. This predicate is required to be transitive. The procedure compares strings in an implementation defined way. One approach is to make them the lexicographic extensions to strings of the corresponding orderings on characters. In that case, string<? would be the lexicographic ordering on strings induced by the ordering char<? on characters, and if the two strings differ in length but are the same up to the length of the shorter string, the shorter string would be considered to be lexicographically less than the longer string. However, it is also permitted to use the natural ordering imposed by the implementation’s internal representation of strings, or a more complex locale-specific ordering. In all cases, a pair of strings must satisfy exactly one of string<?, string=?, and string>?, and must satisfy string<=? if and only if they do not satisfy string>? and string>=? if and only if they do not satisfy string<?.

(scheme base) procedure (string=? (string1 string?) (string2 string?) (string3 string?) ... ) ⟹ boolean?

Returns #t if all the strings are the same length and contain exactly the same characters in the same positions, otherwise returns #f.

(scheme base) procedure (string>=? (string1 string?) (string2 string?) (string3 string?) ... ) ⟹ boolean?

This procedure returns #t if its arguments are monotonically non-increasing. This predicate is required to be transitive. The procedure compares strings in an implementation defined way. One approach is to make them the lexicographic extensions to strings of the corresponding orderings on characters. In that case, string<? would be the lexicographic ordering on strings induced by the ordering char<? on characters, and if the two strings differ in length but are the same up to the length of the shorter string, the shorter string would be considered to be lexicographically less than the longer string. However, it is also permitted to use the natural ordering imposed by the implementation’s internal representation of strings, or a more complex locale-specific ordering. In all cases, a pair of strings must satisfy exactly one of string<?, string=?, and string>?, and must satisfy string<=? if and only if they do not satisfy string>? and string>=? if and only if they do not satisfy string<?.

(scheme base) procedure (string>? (string1 string?) (string2 string?) (string3 string?) ... ) ⟹ boolean?

This procedure returns #t if its arguments are monotonically decreasing. This predicate is required to be transitive. The procedure compares strings in an implementation defined way. One approach is to make them the lexicographic extensions to strings of the corresponding orderings on characters. In that case, string<? would be the lexicographic ordering on strings induced by the ordering char<? on characters, and if the two strings differ in length but are the same up to the length of the shorter string, the shorter string would be considered to be lexicographically less than the longer string. However, it is also permitted to use the natural ordering imposed by the implementation’s internal representation of strings, or a more complex locale-specific ordering. In all cases, a pair of strings must satisfy exactly one of string<?, string=?, and string>?, and must satisfy string<=? if and only if they do not satisfy string>? and string>=? if and only if they do not satisfy string<?.

(scheme base) procedure (string? obj ) ⟹ boolean?

Returns #t if obj is a string, otherwise returns #f.

(scheme base) procedure (substring (string string?) (start integer?) (end integer?) ) ⟹ string?

The substring procedure returns a newly allocated string formed from the characters of string beginning with index start and ending with index end. This is equivalent to calling string-copy with the same arguments, but is provided for backward compatibility and stylistic flexibility.

(scheme base) procedure (symbol->string (symbol symbol?) ) ⟹ string?

Returns the name of symbol as a string, but without adding escapes. It is an error to apply mutation procedures like string-set! to strings returned by this procedure.

(scheme base) procedure (symbol=? (symbol1 symbol?) (symbol2 symbol?) (symbol3 symbol?) ... ) ⟹ boolean?

Returns #t if all the arguments are symbols and all have the same names in the sense of string=?. Note: The definition above assumes that none of the arguments are uninterned symbols.

(scheme base) procedure (symbol? obj ) ⟹ boolean?

Returns #t if obj is a symbol, otherwise returns #f.

(scheme base) syntax (syntax-error () ((_ message args ...)) )

syntax-error behaves similarly to error (6.11) except that implementations with an expansion pass separate from evaluation should signal an error as soon as syntax-error is expanded. This can be used as a syntax-rules template for a pattern that is an invalid use of the macro, which can provide more descriptive error messages. message is a string literal, and args arbitrary expressions providing additional information. Applications cannot count on being able to catch syntax errors with exception handlers or guards.

(scheme base) syntax (syntax-rules (_ ) ((_ (literal ...) syntax-rule ...) transformer-spec) ((_ ellipsis (literal ...) syntax-rule ...) transformer-spec) )

(pattern template)

_ identifier constant (pattern ...) (pattern pattern ... . pattern) (pattern ... pattern ellipsis pattern ...) (pattern ... pattern ellipsis pattern ... . pattern) #(pattern ...) #(pattern ... pattern ellipsis pattern ...)

identifier constant (element ...) (element element ... . template) (ellipsis template) #(element ...)

template template ellipsis

An instance of syntax-rules produces a new macro transformer by specifying a sequence of hygienic rewrite rules. A use of a macro whose keyword is associated with a transformer specified by syntax-rules is matched against the patterns contained in the syntax rulei, beginning with the leftmost syntax rule. When a match is found, the macro use is transcribed hygienically according to the template. An identifier appearing within a pattern can be an underscore (_), a literal identifier listed in the list of literali, or the ellipsis. All other identifiers appearing within a pattern are pattern variables. The keyword at the beginning of the pattern in a syntax rule is not involved in the matching and is considered neither a pattern variable nor a literal identifier. Pattern variables match arbitrary input elements and are used to refer to elements of the input in the template. It is an error for the same pattern variable to appear more than once in a pattern. Underscores also match arbitrary input elements but are not pattern variables and so cannot be used to refer to those elements. If an underscore appears in the literal list, then that takes precedence and underscores in the pattern match as literals. Multiple underscores can appear in a pattern. Identifiers that appear in (literal ...) are interpreted as literal identifiers to be matched against corresponding elements of the input. An element in the input matches a literal identifier if and only if it is an identifier and either both its occurrence in the macro expression and its occurrence in the macro definition have the same lexical binding, or the two identifiers are the same and both have no lexical binding. A subpattern followed by ellipsis can match zero or more elements of the input, unless ellipsis appears in the literals, in which case it is matched as a literal. It is an error to use a macro keyword, within the scope of its binding, in an expression that does not match any of the patterns. When a macro use is transcribed according to the template of the matching hsyntax rulei, pattern variables that occur in the template are replaced by the elements they match in the input. Pattern variables that occur in subpatterns followed by one or more instances of the identifier ellipsis are allowed only in subtemplates that are followed by as many instances of ellipsis. They are replaced in the output by all of the elements they match in the input, distributed as indicated. It is an error if the output cannot be built up as specified. Identifiers that appear in the template but are not pattern variables or the identifier ellipsis are inserted into the output as literal identifiers. If a literal identifier is inserted as a free identifier then it refers to the binding of that identifier within whose scope the instance of syntax-rules appears. If a literal identifier is inserted as a bound identifier then it is in effect renamed to prevent inadvertent captures of free identifiers. A template of the form (ellipsis template) is identical to template, except that ellipses within the template have no special meaning. That is, any ellipses contained within template are treated as ordinary identifiers. In particular, the template (ellipsis ellipsis) produces a single ellipsis. This allows syntactic abstractions to expand into code containing ellipses.

(scheme base) procedure (truncate (x real?) ) ⟹ integer?

The truncate procedure returns the integer closest to x whose absolute value is not larger than the absolute value of x. Note: If the argument to this procedure is inexact, then the result will also be inexact. If an exact value is needed, the result can be passed to the exact procedure. If the argument is infinite or a NaN, then it is returned.

(scheme base) procedure (truncate-quotient (n1 integer?) (n2 integer?) ) ⟹ integer?

This procedure implements number-theoretic (integer) division. It is an error if n2 is zero. The procedure computes a quotient nq and remainder nr such that n1 = n2 * nq + nr.

(scheme base) procedure (truncate-remainder (n1 integer?) (n2 integer?) ) ⟹ integer?

This procedure implements number-theoretic (integer) division. It is an error if n2 is zero. The procedure computes a quotient nq and remainder nr such that n1 = n2 * nq + nr.

(scheme base) procedure (truncate/ (n1 integer?) (n2 integer?) ) ⟹ (values integer?integer?)

This procedure implements number-theoretic (integer) division. It is an error if n2 is zero. The procedure computes a quotient nq and remainder nr such that n1 = n2 * nq + nr.

(scheme base) procedure (u8-ready? ) ⟹ boolean?

(scheme base) procedure (u8-ready? (port input-port?) ) ⟹ boolean?

Returns #t if a byte is ready on the binary input port and returns #f otherwise. If u8-ready? returns #t then the next read-u8 operation on the given port is guaranteed not to hang. If the port is at end of file then u8-ready? returns #t.

(scheme base) syntax (unless () ((_ test expression1 expression2 ...)) )

The test is evaluated, and if it evaluates to #f, the expressions are evaluated in order. The result of the unless expression is unspecified.

(scheme base) syntax (unquote () ((_ expression)) )

"Quasiquote" expressions are useful for constructing a list or vector structure when some but not all of the desired structure is known in advance. If no commas appear within the qq template, the result of evaluating qq template is equivalent to the result of evaluating 'qq template. If a comma appears within the qq template, however, the expression following the comma is evaluated ("unquoted") and its result is inserted into the structure instead of the comma and the expression. If a comma appears followed without intervening whitespace by a commercial at-sign (@), then it is an error if the following expression does not evaluate to a list; the opening and closing parentheses of the list are then "stripped away" and the elements of the list are inserted in place of the comma at-sign expression sequence. A comma at-sign normally appears only within a list or vector qq template. Note: In order to unquote an identifier beginning with @, it is necessary to use either an explicit unquote or to put whitespace after the comma, to avoid colliding with the comma at-sign sequence. Quasiquote expressions can be nested. Substitutions are made only for unquoted components appearing at the same nesting level as the outermost quasiquote. The nesting level increases by one inside each successive quasiquotation, and decreases by one inside each unquotation. A quasiquote expression may return either newly allocated, mutable objects or literal structure for any structure that is constructed at run time during the evaluation of the expression. Portions that do not need to be rebuilt are always literal.

(scheme base) syntax (unquote-splicing () ((_ expression)) )

"Quasiquote" expressions are useful for constructing a list or vector structure when some but not all of the desired structure is known in advance. If no commas appear within the qq template, the result of evaluating qq template is equivalent to the result of evaluating 'qq template. If a comma appears within the qq template, however, the expression following the comma is evaluated ("unquoted") and its result is inserted into the structure instead of the comma and the expression. If a comma appears followed without intervening whitespace by a commercial at-sign (@), then it is an error if the following expression does not evaluate to a list; the opening and closing parentheses of the list are then "stripped away" and the elements of the list are inserted in place of the comma at-sign expression sequence. A comma at-sign normally appears only within a list or vector qq template. Note: In order to unquote an identifier beginning with @, it is necessary to use either an explicit unquote or to put whitespace after the comma, to avoid colliding with the comma at-sign sequence. Quasiquote expressions can be nested. Substitutions are made only for unquoted components appearing at the same nesting level as the outermost quasiquote. The nesting level increases by one inside each successive quasiquotation, and decreases by one inside each unquotation. A quasiquote expression may return either newly allocated, mutable objects or literal structure for any structure that is constructed at run time during the evaluation of the expression. Portions that do not need to be rebuilt are always literal.

(scheme base) procedure (utf8->string (bytevector bytevector?) ) ⟹ string?

(scheme base) procedure (utf8->string (bytevector bytevector?) (start integer?) ) ⟹ string?

(scheme base) procedure (utf8->string (bytevector bytevector?) (start integer?) (end integer?) ) ⟹ string?

It is an error for bytevector to contain invalid UTF-8 byte sequences. This procedure translates between strings and bytevectors that encode those strings using the UTF-8 encoding. The utf8->string procedure decodes the bytes of a bytevector between start and end and returns the corresponding string.

(scheme base) procedure (values obj ... ) ⟹ (values *...)

Delivers all of its arguments to its continuation.

(scheme base) procedure (vector obj ... ) ⟹ vector?

Returns a newly allocated vector whose elements contain the given arguments. It is analogous to list.

(scheme base) procedure (vector->list (vector vector?) ) ⟹ list?

(scheme base) procedure (vector->list (vector vector?) (start integer?) ) ⟹ list?

(scheme base) procedure (vector->list (vector vector?) (start integer?) (end integer?) ) ⟹ list?

The vector->list procedure returns a newly allocated list of the objects contained in the elements of vector between start and end. The order is preserved.

(scheme base) procedure (vector->string (vector vector?) ) ⟹ string?

(scheme base) procedure (vector->string (vector vector?) (start integer?) ) ⟹ string?

(scheme base) procedure (vector->string (vector vector?) (start integer?) (end integer?) ) ⟹ string?

vector ⟹ (vector (char char?))

It is an error if any element of vector between start and end is not a character. The vector->string procedure returns a newly allocated string of the objects contained in the elements of vector between start and end. The order is preserved.

(scheme base) procedure (vector-append (vector vector?) ... ) ⟹ vector?

Returns a newly allocated vector whose elements are the concatenation of the elements of the given vectors.

(scheme base) procedure (vector-copy (vector vector?) ) ⟹ vector?

(scheme base) procedure (vector-copy (vector vector?) (start integer?) ) ⟹ vector?

(scheme base) procedure (vector-copy (vector vector?) (start integer?) (end integer?) ) ⟹ vector?

Returns a newly allocated copy of the elements of the given vector between start and end. The elements of the new vector are the same (in the sense of eqv?) as the elements of the old.

(scheme base) procedure (vector-copy! (to vector?) (at integer?) (from vector?) ) ⟹ undefined

(scheme base) procedure (vector-copy! (to vector?) (at integer?) (from vector?) (start integer?) ) ⟹ undefined

(scheme base) procedure (vector-copy! (to vector?) (at integer?) (from vector?) (start integer?) (end integer?) ) ⟹ undefined

It is an error if at is less than zero or greater than the length of to. It is also an error if (- (vector-length to) at) is less than (- end start). Copies the elements of vector from between start and end to vector to, starting at at. The order in which elements are copied is unspecified, except that if the source and destination overlap, copying takes place as if the source is first copied into a temporary vector and then into the destination. This can be achieved without allocating storage by making sure to copy in the correct direction in such circumstances

(scheme base) procedure (vector-fill! (vector vector?) fill ) ⟹ undefined

(scheme base) procedure (vector-fill! (vector vector?) fill (start integer?) ) ⟹ undefined

(scheme base) procedure (vector-fill! (vector vector?) fill (start integer?) (end integer?) ) ⟹ undefined

The vector-fill! procedure stores fill in the elements of vector between start and end.

(scheme base) procedure (vector-for-each (proc procedure?) (vector1 vector?) (vector2 vector?) ... ) ⟹ undefined

(proc obj ... ) ⟹ undefined

It is an error if proc does not accept as many arguments as there are vectors. The arguments to vector-for-each are like the arguments to vector-map, but vector-for-each calls proc for its side effects rather than for its values. Unlike vector-map, vector-for-each is guaranteed to call proc on the elements of the vector s in order from the first element(s) to the last, and the value returned by vector-for-each is unspecified. If more than one vector is given and not all vectors have the same length, vector-for-each terminates when the shortest vector runs out. It is an error for proc to mutate any of the vectors.

(scheme base) procedure (vector-length (vector vector?) ) ⟹ integer?

Returns the number of elements in vector as an exact integer.

(scheme base) procedure (vector-map (proc procedure?) (vector1 vector?) (vector2 vector?) ... ) ⟹ vector?

(proc obj ... ) ⟹ *

It is an error if proc does not accept as many arguments as there are vectors and return a single value. The vector-map procedure applies proc element-wise to the elements of the vector s and returns a vector of the results, in order. If more than one vector is given and not all vectors have the same length, vector-map terminates when the shortest vector runs out. The dynamic order in which proc is applied to the elements of the vector s is unspecified. If multiple returns occur from vector-map, the values returned by earlier returns are not mutated.

(scheme base) procedure (vector-ref (vector vector?) (k integer?) ) ⟹ *

It is an error if k is not a valid index of vector. The vector-ref procedure returns the contents of element k of vector.

(scheme base) procedure (vector-set! (vector vector?) (k integer?) obj ) ⟹ undefined

It is an error if k is not a valid index of vector. The vector-set! procedure stores obj in element k of vector.

(scheme base) procedure (vector? obj ) ⟹ boolean?

Returns #t if obj is a vector; otherwise returns #f.

(scheme base) syntax (when () ((_ test expression1 expression2 ...)) )

The test is evaluated, and if it evaluates to a true value, the expressions are evaluated in order. The result of the when expression is unspecified.

(scheme base) procedure (write-bytevector (bytevector bytevector?) ) ⟹ undefined

(scheme base) procedure (write-bytevector (bytevector bytevector?) (port output-port?) ) ⟹ undefined

(scheme base) procedure (write-bytevector (bytevector bytevector?) (port output-port?) (start integer?) ) ⟹ undefined

(scheme base) procedure (write-bytevector (bytevector bytevector?) (port output-port?) (start integer?) (end integer?) ) ⟹ undefined

Writes the bytes of bytevector from start to end in left-toright order to the binary output port.

(scheme base) procedure (write-char (char char?) ) ⟹ undefined

(scheme base) procedure (write-char (char char?) (port output-port?) ) ⟹ undefined

Writes the character char (not an external representation of the character) to the given textual output port and returns an unspecified value.

(scheme base) procedure (write-string (string string?) ) ⟹ undefined

(scheme base) procedure (write-string (string string?) (port output-port?) ) ⟹ undefined

(scheme base) procedure (write-string (string string?) (port output-port?) (start integer?) ) ⟹ undefined

(scheme base) procedure (write-string (string string?) (port output-port?) (start integer?) (end integer?) ) ⟹ undefined

Writes the characters of string from start to end in left-toright order to the textual output port.

(scheme base) procedure (write-u8 (byte integer?) ) ⟹ undefined

(scheme base) procedure (write-u8 (byte integer?) (port output-port?) ) ⟹ undefined

Writes the byte to the given binary output port and returns an unspecified value.

(scheme base) procedure (current-error-port ) ⟹ output-port?

(scheme base) procedure (current-input-port ) ⟹ input-port?

(scheme base) procedure (current-output-port ) ⟹ output-port?

Returns the current default input port, output port, or error port (an output port), respectively. These procedures are parameter objects, which can be overridden with parameterize (see section 4.2.6). The initial bindings for these are implementation-defined textual ports.

(scheme base) procedure (number? obj ) ⟹ boolean?

(scheme base) procedure (complex? obj ) ⟹ boolean?

(scheme base) procedure (real? obj ) ⟹ boolean?

(scheme base) procedure (rational? obj ) ⟹ boolean?

(scheme base) procedure (integer? obj ) ⟹ boolean?

These numerical type predicates can be applied to any kind of argument, including non-numbers. They return #t if the object is of the named type, and otherwise they return #f. In general, if a type predicate is true of a number then all higher type predicates are also true of that number. Consequently, if a type predicate is false of a number, then all lower type predicates are also false of that number. If z is a complex number, then (real? z) is true if and only if (zero? (imag-part z)) is true. If x is an inexact real number, then (integer? x) is true if and only if (= x (round x)). The numbers +inf.0, -inf.0, and +nan.0 are real but not rational.

(scheme base) procedure (zero? (z number?) ) ⟹ boolean?

(scheme base) procedure (positive? (x real?) ) ⟹ boolean?

(scheme base) procedure (negative? (x real?) ) ⟹ boolean?

(scheme base) procedure (odd? (n integer?) ) ⟹ boolean?

(scheme base) procedure (even? (n integer?) ) ⟹ boolean?

These numerical predicates test a number for a particular property, returning #t or #f.

(scheme base) procedure (input-port? obj ) ⟹ boolean?

(scheme base) procedure (output-port? obj ) ⟹ boolean?

(scheme base) procedure (textual-port? obj ) ⟹ boolean?

(scheme base) procedure (binary-port? obj ) ⟹ boolean?

(scheme base) procedure (port? obj ) ⟹ boolean?

These procedures return #t if obj is an input port, output port, textual port, binary port, or any kind of port, respectively. Otherwise they return #f.

library (scheme base)

(scheme base) syntax (cond-expand (library and or not else ) ((_ ce-clause1 ce-clause2 ...)) )

(feature-requirement expression ...) (else expression)

feature-identifier (library library-name) (and feature-requirement ...) (or feature-requirement ...) (not feature-requirement)

The cond-expand form tests for the existence of features at macro-expansion time. It either expands into the body of one of its clauses or signals an error during syntactic processing. cond-expand expands into the body of the first clause whose feature requirement is currently satisfied (the else clause, if present, is selected if none of the previous clauses is selected). A feature requirement has an obvious interpretation as a logical formula, where the <feature identifier> variables have meaning TRUE if the feature corresponding to the feature identifier, as specified in the SRFI registry, is in effect at the location of the cond-expand form, and FALSE otherwise. A feature requirement is satisfied if its formula is true under this interpretation.

library (scheme base)

(scheme base) procedure (open-input-string (string string?) ) ⟹ input-port?

Takes a string and returns a textual input port that delivers characters from the string. If the string is modified, the effect is unspecified.

(scheme base) procedure (open-output-string ) ⟹ output-port?

Returns a textual output port that will accumulate characters for retrieval by get-output-string.

(scheme base) procedure (get-output-string (port output-port?) ) ⟹ string?

It is an error if port was not created with open-output-string. Returns a string consisting of the characters that have been output to the port so far in the order they were output. If the result string is modified, the effect is unspecified.

library (scheme base)

(scheme base) syntax (define-record-type () ((_ name constructor pred field ...)) )

(constructor-name field-name ...)

(field-name accessor-name) (field-name accessor-name modifier-name)

It is an error for the same identifier to occur more than once as a field name. It is also an error for the same identifier to occur more than once as an accessor or mutator name. The define-record-type construct is generative: each use creates a new record type that is distinct from all existing types, including Scheme’s predefined types and other record types — even record types of the same name or structure. An instance of define-record-type is equivalent to the following definitions. <name> is bound to a representation of the record type itself. This may be a run-time object or a purely syntactic representation. The representation is not utilized in this report, but it serves as a means to identify the record type for use by further language extensions. <constructor name> is bound to a procedure that takes as many arguments as there are <field name>s in the (<constructor name> ...) subexpression and returns a new record of type <name>. Fields whose names are listed with <constructor name> have the corresponding argument as their initial value. The initial values of all other fields are unspecified. It is an error for a field name to appear in <constructor> but not as a <field name>. <pred> is bound to a predicate that returns #t when given a value returned by the procedure bound to <constructor name> and #f for everything else. Each <accessor name> is bound to a procedure that takes a record of type <name> and returns the current value of the corresponding field. It is an error to pass an accessor a value which is not a record of the appropriate type. Each <modifier name> is bound to a procedure that takes a record of type <name> and a value which becomes the new value of the corresponding field; an unspecified value is returned. It is an error to pass a modifier a first argument which is not a record of the appropriate type.

library (scheme base)

(scheme base) syntax (let*-values () ((_ mv-binding-spec body)) )

((formals1 init1) ...)

(variable1 ...) variable (variable1 ... variable_n . variable_n+1)

The let*-values construct is similar to let-values, but the <init>s are evaluated and bindings created sequentially from left to right, with the region of the bindings of each <formals> including the <init>s to its right as well as <body>. Thus the second <init> is evaluated in an environment in which the first set of bindings is visible and initialized, and so on.

(scheme base) syntax (let-values () ((_ mv-binding-spec body)) )

((formals1 init1) ...)

(variable1 ...) variable (variable1 ... variable_n . variable_n+1)

The <init>s are evaluated in the current environment (in some unspecified order) as if by invoking call-with-values, and the variables occurring in the <formals> are bound to fresh locations holding the values returned by the <init>s, where the <formals> are matched to the return values in the same way that the <formals> in a lambda expression are matched to the arguments in a procedure call. Then, the <body> is evaluated in the extended environment, and the values of the last expression of <body> are returned. Each binding of a <variable> has <body> as its region. It is an error if the <formals> do not match the number of values returned by the corresponding <init>.

library (scheme base)

(scheme base) procedure (error (message string?) obj ... ) ⟹ undefined

Message should be a string. Raises an exception as if by calling raise on a newly allocated implementation-defined object which encapsulates the information provided by message, as well as any objs, known as the irritants. The procedure error-object? must return #t on such objects.

library (scheme base)

(scheme base) procedure (raise obj ) ⟹ undefined

Raises an exception by invoking the current exception handler on obj. The handler is called with the same dynamic environment as that of the call to raise, except that the current exception handler is the one that was in place when the handler being called was installed. If the handler returns, a secondary exception is raised in the same dynamic environment as the handler. The relationship between obj and the object raised by the secondary exception is unspecified.

(scheme base) syntax (guard (=> else ) ((_ (variable cond-clause1 cond-clause2 ...) body)) )

(test expression1 ...) (test => expression) (else expression1 expression2 ...)

The <body> is evaluated with an exception handler that binds the raised object (see raise in section 6.11) to <variable> and, within the scope of that binding, evaluates the clauses as if they were the clauses of a cond expression. That implicit cond expression is evaluated with the continuation and dynamic environment of the guard expression. If every <cond clause>’s <test> evaluates to #f and there is no else clause, then raise-continuable is invoked on the raised object within the dynamic environment of the original call to raise or raise-continuable, except that the current exception handler is that of the guard expression. See section 6.11 for a more complete discussion of exceptions.

(scheme base) procedure (with-exception-handler (handler procedure?) (thunk procedure?) ) ⟹ *

(handler obj ) ⟹ *

(thunk ) ⟹ *

It is an error if handler does not accept one argument. It is also an error if thunk does not accept zero arguments. The with-exception-handler procedure returns the results of invoking thunk. Handler is installed as the current exception handler in the dynamic environment used for the invocation of thunk.

library (scheme base)

(scheme base) procedure (make-parameter obj ) ⟹ procedure?

(scheme base) procedure (make-parameter obj (converter procedure?) ) ⟹ procedure?

(converter obj ) ⟹ *

Returns a newly allocated parameter object, which is a procedure that accepts zero arguments and returns the value associated with the parameter object. Initially, this value is the value of (converter init), or of init if the conversion procedure converter is not specified. The associated value can be temporarily changed using parameterize, which is described below. The effect of passing arguments to a parameter object is implementation-dependent.

(scheme base) syntax (parameterize () ((_ ((param1 value1) ...) body)) )

A parameterize expression is used to change the values returned by specified parameter objects during the evaluation of the body. The <param> and <value> expressions are evaluated in an unspecified order. The <body> is evaluated in a dynamic environment in which calls to the parameters return the results of passing the corresponding values to the conversion procedure specified when the parameters were created. Then the previous values of the parameters are restored without passing them to the conversion procedure. The results of the last expression in the <body> are returned as the results of the entire parameterize expression. Note: If the conversion procedure is not idempotent, the results of (parameterize ((x (x))) ...), which appears to bind the parameter x to its current value, might not be what the user expects. If an implementation supports multiple threads of execution, then parameterize must not change the associated values of any parameters in any thread other than the current thread and threads created inside <body>. Parameter objects can be used to specify configurable settings for a computation without the need to pass the value to every procedure in the call chain explicitly.

library (scheme case-lambda)

(scheme case-lambda) syntax (case-lambda () ((_ clause ...) procedure?) )

(formals body)

(variable1 ...) variable (variable1 ... variable_n . variable_n+1)

A CASE-LAMBDA expression evaluates to a procedure that accepts a variable number of arguments and is lexically scoped in the same manner as procedures resulting from LAMBDA expressions. When the procedure is called with some arguments V1 .. Vk, then the first <clause> for which the arguments agree with <formals> is selected, where agreement is specified as for the <formals> of a LAMBDA expression. The variables of <formals> are bound to fresh locations, the values V1 .. Vk are stored in those locations, the <body> is evaluated in the extended environment, and the results of <body> are returned as the results of the procedure call. It is an error for the arguments not to agree with the <formals> of any <clause>.

library (scheme complex)

(scheme complex) procedure (angle (z complex?) ) ⟹ real?

(scheme complex) procedure (imag-part (z complex?) ) ⟹ real?

(scheme complex) procedure (magnitude (z complex?) ) ⟹ real?

(scheme complex) procedure (make-polar (x3 real?) (x4 real?) ) ⟹ complex?

(scheme complex) procedure (make-rectangular (x1 real?) (x2 real?) ) ⟹ complex?

(scheme complex) procedure (real-part (z complex?) ) ⟹ real?

Let x1, x2, x3, and x4 be real numbers and z be a complex number such that

z = x1 + x2i = x3 * e^(i*x4)

Then all of

(make-rectangular x1 x2) => z

(make-polar x3 x4) => z

(real-part z) => x1

(imag-part z) => x2

(magnitude z) => |x3|

(angle z) =⇒ x_angle

are true, where -pi <= x_angle <= pi with x_angle = x4 + 2*pi*n for some integer n.

The make-polar procedure may return an inexact complex number even if its arguments are exact. The real-part and imag-part procedures may return exact real numbers when applied to an inexact complex number if the corresponding argument passed to make-rectangular was exact.

library (scheme char)

(scheme char) procedure (char-alphabetic? (char char?) ) ⟹ boolean?

char-alpabetic?, char-numeric?, char-whitespace? char-upper-case?, char-lower-case? These procedures return #t if their arguments are alphabetic, numeric, whitespace, upper case, or lower case characters, respectively, otherwise they return #f. Specifically, they must return #t when applied to characters with the Unicode properties Alphabetic, Numeric Digit, White Space, Uppercase, and Lowercase respectively, and #f when applied to any other Unicode characters. Note that many Unicode characters are alphabetic but neither upper nor lower case.

(scheme char) procedure (char-ci<=? (char1 char?) (char2 char?) (char3 char?) ... ) ⟹ boolean?

char-ci=?, char-ci<?, char-ci>?, char-ci<=?, char-ci>=? These procedures are similar to char=? et cetera, but they treat upper case and lower case letters as the same. For example, (char-ci=? #\A #\a) returns #t. Specifically, these procedures behave as if char-foldcase were applied to their arguments before they were compared.

(scheme char) procedure (char-ci<? (char1 char?) (char2 char?) (char3 char?) ... ) ⟹ boolean?

char-ci=?, char-ci<?, char-ci>?, char-ci<=?, char-ci>=? These procedures are similar to char=? et cetera, but they treat upper case and lower case letters as the same. For example, (char-ci=? #\A #\a) returns #t. Specifically, these procedures behave as if char-foldcase were applied to their arguments before they were compared.

(scheme char) procedure (char-ci=? (char1 char?) (char2 char?) (char3 char?) ... ) ⟹ boolean?

char-ci=?, char-ci<?, char-ci>?, char-ci<=?, char-ci>=? These procedures are similar to char=? et cetera, but they treat upper case and lower case letters as the same. For example, (char-ci=? #\A #\a) returns #t. Specifically, these procedures behave as if char-foldcase were applied to their arguments before they were compared.

(scheme char) procedure (char-ci>=? (char1 char?) (char2 char?) (char3 char?) ... ) ⟹ boolean?

char-ci=?, char-ci<?, char-ci>?, char-ci<=?, char-ci>=? These procedures are similar to char=? et cetera, but they treat upper case and lower case letters as the same. For example, (char-ci=? #\A #\a) returns #t. Specifically, these procedures behave as if char-foldcase were applied to their arguments before they were compared.

(scheme char) procedure (char-ci>? (char1 char?) (char2 char?) (char3 char?) ... ) ⟹ boolean?

char-ci=?, char-ci<?, char-ci>?, char-ci<=?, char-ci>=? These procedures are similar to char=? et cetera, but they treat upper case and lower case letters as the same. For example, (char-ci=? #\A #\a) returns #t. Specifically, these procedures behave as if char-foldcase were applied to their arguments before they were compared.

(scheme char) procedure (char-downcase (char char?) ) ⟹ char?

The char-downcase procedure, given an argument that is the uppercase part of a Unicode casing pair, returns the lowercase member of the pair, provided that both characters are supported by the Scheme implementation. Note that language-sensitive casing pairs are not used. If the argument is not the uppercase member of such a pair, it is returned.

(scheme char) procedure (char-foldcase (char char?) ) ⟹ char?

The char-foldcase procedure applies the Unicode simple case-folding algorithm to its argument and returns the result. Note that language-sensitive folding is not used. If the argument is an uppercase letter, the result will be either a lowercase letter or the same as the argument if the lowercase letter does not exist or is not supported by the implementation. See UAX #29 [11] (part of the Unicode Standard) for details.

(scheme char) procedure (char-lower-case? (char char?) ) ⟹ boolean?

char-alpabetic?, char-numeric?, char-whitespace? char-upper-case?, char-lower-case? These procedures return #t if their arguments are alphabetic, numeric, whitespace, upper case, or lower case characters, respectively, otherwise they return #f. Specifically, they must return #t when applied to characters with the Unicode properties Alphabetic, Numeric Digit, White Space, Uppercase, and Lowercase respectively, and #f when applied to any other Unicode characters. Note that many Unicode characters are alphabetic but neither upper nor lower case.

(scheme char) procedure (char-numeric? (char char?) ) ⟹ boolean?

char-alpabetic?, char-numeric?, char-whitespace? char-upper-case?, char-lower-case? These procedures return #t if their arguments are alphabetic, numeric, whitespace, upper case, or lower case characters, respectively, otherwise they return #f. Specifically, they must return #t when applied to characters with the Unicode properties Alphabetic, Numeric Digit, White Space, Uppercase, and Lowercase respectively, and #f when applied to any other Unicode characters. Note that many Unicode characters are alphabetic but neither upper nor lower case.

(scheme char) procedure (char-upcase (char char?) ) ⟹ char?

The char-upcase procedure, given an argument that is the lowercase part of a Unicode casing pair, returns the uppercase member of the pair, provided that both characters are supported by the Scheme implementation. Note that language-sensitive casing pairs are not used. If the argument is not the lowercase member of such a pair, it is returned.

(scheme char) procedure (char-upper-case? (char char?) ) ⟹ boolean?

char-alpabetic?, char-numeric?, char-whitespace? char-upper-case?, char-lower-case? These procedures return #t if their arguments are alphabetic, numeric, whitespace, upper case, or lower case characters, respectively, otherwise they return #f. Specifically, they must return #t when applied to characters with the Unicode properties Alphabetic, Numeric Digit, White Space, Uppercase, and Lowercase respectively, and #f when applied to any other Unicode characters. Note that many Unicode characters are alphabetic but neither upper nor lower case.

(scheme char) procedure (char-whitespace? (char char?) ) ⟹ boolean?

char-alpabetic?, char-numeric?, char-whitespace? char-upper-case?, char-lower-case? These procedures return #t if their arguments are alphabetic, numeric, whitespace, upper case, or lower case characters, respectively, otherwise they return #f. Specifically, they must return #t when applied to characters with the Unicode properties Alphabetic, Numeric Digit, White Space, Uppercase, and Lowercase respectively, and #f when applied to any other Unicode characters. Note that many Unicode characters are alphabetic but neither upper nor lower case.

(scheme char) procedure (digit-value (char char?) ) ⟹ #f / integer? /

This procedure returns the numeric value (0 to 9) of its argument if it is a numeric digit (that is, if char-numeric? returns #t), or #f on any other character.

(scheme char) procedure (string-ci<=? (string1 string?) (string2 string?) (string3 string?) ... ) ⟹ boolean?

string<?, string-ci<?, string>?, string-ci>?, string<=?, string-ci<=?, string=>?, string-ci=>? These procedures return #t if their arguments are (respectively): monotonically increasing, monotonically decreasing, monotonically non-decreasing, or monotonically nonincreasing. These predicates are required to be transitive. These procedures compare strings in an implementationdefined way. One approach is to make them the lexicographic extensions to strings of the corresponding orderings on characters. In that case, string<? would be the lexicographic ordering on strings induced by the ordering char<? on characters, and if the two strings differ in length but are the same up to the length of the shorter string, the shorter string would be considered to be lexicographically less than the longer string. However, it is also permitted to use the natural ordering imposed by the implementation’s internal representation of strings, or a more complex locale-specific ordering. In all cases, a pair of strings must satisfy exactly one of string<?, string=?, and string>?, and must satisfy string<=? if and only if they do not satisfy string>? and string>=? if and only if they do not satisfy string<?. The "-ci" procedures behave as if they applied string-foldcase to their arguments before invoking the corresponding procedures without "-ci".

(scheme char) procedure (string-ci<? (string1 string?) (string2 string?) (string3 string?) ... ) ⟹ boolean?

string<?, string-ci<?, string>?, string-ci>?, string<=?, string-ci<=?, string=>?, string-ci=>? These procedures return #t if their arguments are (respectively): monotonically increasing, monotonically decreasing, monotonically non-decreasing, or monotonically nonincreasing. These predicates are required to be transitive. These procedures compare strings in an implementationdefined way. One approach is to make them the lexicographic extensions to strings of the corresponding orderings on characters. In that case, string<? would be the lexicographic ordering on strings induced by the ordering char<? on characters, and if the two strings differ in length but are the same up to the length of the shorter string, the shorter string would be considered to be lexicographically less than the longer string. However, it is also permitted to use the natural ordering imposed by the implementation’s internal representation of strings, or a more complex locale-specific ordering. In all cases, a pair of strings must satisfy exactly one of string<?, string=?, and string>?, and must satisfy string<=? if and only if they do not satisfy string>? and string>=? if and only if they do not satisfy string<?. The "-ci" procedures behave as if they applied string-foldcase to their arguments before invoking the corresponding procedures without "-ci".

(scheme char) procedure (string-ci=? (string1 string?) (string2 string?) (string3 string?) ... ) ⟹ boolean?

Returns #t if, after case-folding, all the strings are the same length and contain the same characters in the same positions, otherwise returns #f. Specifically, these procedures behave as if string-foldcase were applied to their arguments before comparing them.

(scheme char) procedure (string-ci>=? (string1 string?) (string2 string?) (string3 string?) ... ) ⟹ boolean?

string<?, string-ci<?, string>?, string-ci>?, string<=?, string-ci<=?, string=>?, string-ci=>? These procedures return #t if their arguments are (respectively): monotonically increasing, monotonically decreasing, monotonically non-decreasing, or monotonically nonincreasing. These predicates are required to be transitive. These procedures compare strings in an implementationdefined way. One approach is to make them the lexicographic extensions to strings of the corresponding orderings on characters. In that case, string<? would be the lexicographic ordering on strings induced by the ordering char<? on characters, and if the two strings differ in length but are the same up to the length of the shorter string, the shorter string would be considered to be lexicographically less than the longer string. However, it is also permitted to use the natural ordering imposed by the implementation’s internal representation of strings, or a more complex locale-specific ordering. In all cases, a pair of strings must satisfy exactly one of string<?, string=?, and string>?, and must satisfy string<=? if and only if they do not satisfy string>? and string>=? if and only if they do not satisfy string<?. The "-ci" procedures behave as if they applied string-foldcase to their arguments before invoking the corresponding procedures without "-ci".

(scheme char) procedure (string-ci>? (string1 string?) (string2 string?) (string3 string?) ... ) ⟹ boolean?

string<?, string-ci<?, string>?, string-ci>?, string<=?, string-ci<=?, string=>?, string-ci=>? These procedures return #t if their arguments are (respectively): monotonically increasing, monotonically decreasing, monotonically non-decreasing, or monotonically nonincreasing. These predicates are required to be transitive. These procedures compare strings in an implementationdefined way. One approach is to make them the lexicographic extensions to strings of the corresponding orderings on characters. In that case, string<? would be the lexicographic ordering on strings induced by the ordering char<? on characters, and if the two strings differ in length but are the same up to the length of the shorter string, the shorter string would be considered to be lexicographically less than the longer string. However, it is also permitted to use the natural ordering imposed by the implementation’s internal representation of strings, or a more complex locale-specific ordering. In all cases, a pair of strings must satisfy exactly one of string<?, string=?, and string>?, and must satisfy string<=? if and only if they do not satisfy string>? and string>=? if and only if they do not satisfy string<?. The "-ci" procedures behave as if they applied string-foldcase to their arguments before invoking the corresponding procedures without "-ci".

(scheme char) procedure (string-downcase (string string?) ) ⟹ string?

string-upcase, string-downcase, string-foldcase These procedures apply the Unicode full string uppercasing, lowercasing, and case-folding algorithms to their arguments and return the result. In certain cases, the result differs in length from the argument. If the result is equal to the argument in the sense of string=?, the argument may be returned. Note that language-sensitive mappings and foldings are not used. The Unicode Standard prescribes special treatment of the Greek letter Σ, whose normal lower-case form is σ but which becomes ς at the end of a word. See UAX #29 [11] (part of the Unicode Standard) for details. However, implementations of string-downcase are not required to provide this behavior, and may choose to change Σ to σ in all cases.

(scheme char) procedure (string-foldcase (string string?) ) ⟹ string?

string-upcase, string-downcase, string-foldcase These procedures apply the Unicode full string uppercasing, lowercasing, and case-folding algorithms to their arguments and return the result. In certain cases, the result differs in length from the argument. If the result is equal to the argument in the sense of string=?, the argument may be returned. Note that language-sensitive mappings and foldings are not used. The Unicode Standard prescribes special treatment of the Greek letter Σ, whose normal lower-case form is σ but which becomes ς at the end of a word. See UAX #29 [11] (part of the Unicode Standard) for details. However, implementations of string-downcase are not required to provide this behavior, and may choose to change Σ to σ in all cases.

(scheme char) procedure (string-upcase (string string?) ) ⟹ string?

string-upcase, string-downcase, string-foldcase These procedures apply the Unicode full string uppercasing, lowercasing, and case-folding algorithms to their arguments and return the result. In certain cases, the result differs in length from the argument. If the result is equal to the argument in the sense of string=?, the argument may be returned. Note that language-sensitive mappings and foldings are not used. The Unicode Standard prescribes special treatment of the Greek letter Σ, whose normal lower-case form is σ but which becomes ς at the end of a word. See UAX #29 [11] (part of the Unicode Standard) for details. However, implementations of string-downcase are not required to provide this behavior, and may choose to change Σ to σ in all cases.

library (scheme cxr)

(scheme cxr) procedure (caaaar (pair pair?) ) ⟹ *

Composition of car, car, car, car.

(scheme cxr) procedure (caaadr (pair pair?) ) ⟹ *

Composition of car, car, car, cdr.

(scheme cxr) procedure (caaar (pair pair?) ) ⟹ *

Composition of car, car, car.

(scheme cxr) procedure (caadar (pair pair?) ) ⟹ *

Composition of car, car, cdr, car.

(scheme cxr) procedure (caaddr (pair pair?) ) ⟹ *

Composition of car, car, cdr, cdr.

(scheme cxr) procedure (caadr (pair pair?) ) ⟹ *

Composition of car, car, cdr.

(scheme cxr) procedure (cadaar (pair pair?) ) ⟹ *

Composition of car, cdr, car, car.

(scheme cxr) procedure (cadadr (pair pair?) ) ⟹ *

Composition of car, cdr, car, cdr.

(scheme cxr) procedure (cadar (pair pair?) ) ⟹ *

Composition of car, cdr, car.

(scheme cxr) procedure (caddar (pair pair?) ) ⟹ *

Composition of car, cdr, cdr, car.

(scheme cxr) procedure (cadddr (pair pair?) ) ⟹ *

Composition of car, cdr, cdr, cdr.

(scheme cxr) procedure (caddr (pair pair?) ) ⟹ *

Composition of car, cdr, cdr.

(scheme cxr) procedure (cdaaar (pair pair?) ) ⟹ *

Composition of cdr, car, car, car.

(scheme cxr) procedure (cdaadr (pair pair?) ) ⟹ *

Composition of cdr, car, car, cdr.

(scheme cxr) procedure (cdaar (pair pair?) ) ⟹ *

Composition of cdr, car, car.

(scheme cxr) procedure (cdadar (pair pair?) ) ⟹ *

Composition of cdr, car, cdr, car.

(scheme cxr) procedure (cdaddr (pair pair?) ) ⟹ *

Composition of cdr, car, cdr, cdr.

(scheme cxr) procedure (cdadr (pair pair?) ) ⟹ *

Composition of cdr, car, cdr.

(scheme cxr) procedure (cddaar (pair pair?) ) ⟹ *

Composition of cdr, cdr, car, car.

(scheme cxr) procedure (cddadr (pair pair?) ) ⟹ *

Composition of cdr, cdr, car, cdr.

(scheme cxr) procedure (cddar (pair pair?) ) ⟹ *

Composition of cdr, cdr, car.

(scheme cxr) procedure (cdddar (pair pair?) ) ⟹ *

Composition of cdr, cdr, cdr, car.

(scheme cxr) procedure (cddddr (pair pair?) ) ⟹ *

Composition of cdr, cdr, cdr, cdr.

(scheme cxr) procedure (cdddr (pair pair?) ) ⟹ *

Composition of cdr, cdr, cdr.

library (scheme eval)

(scheme eval) procedure (environment (list1 list?) ... ) ⟹ environment

This procedure returns a specifier for the environment that results by starting with an empty environment and then importing each list, considered as an import set, into it. (See section 5.6 for a description of import sets.) The bindings of the environment represented by the specifier are immutable, as is the environment itself.

(scheme eval) procedure (eval expr-or-def (environment-specifier environment) ) ⟹ *

If expr-or-def is an expression, it is evaluated in the specified environment and its values are returned. If it is a definition, the specified identifier(s) are defined in the specified environment, provided the environment is not immutable. Implementations may extend eval to allow other objects.

library (scheme file)

(scheme file) procedure (call-with-input-file (string string?) (proc procedure?) ) ⟹ *

(proc (port input-port?) ) ⟹ *

call-with-input-file, call-with-output-file It is an error if proc does not accept one argument. These procedures obtain a textual port obtained by opening the named file for input or output as if by open-input-file or open-output-file. The port and proc are then passed to a procedure equivalent to call-with-port.

(scheme file) procedure (call-with-output-file (string string?) (proc procedure?) ) ⟹ *

(proc (port output-port?) ) ⟹ *

call-with-input-file, call-with-output-file It is an error if proc does not accept one argument. These procedures obtain a textual port obtained by opening the named file for input or output as if by open-input-file or open-output-file. The port and proc are then passed to a procedure equivalent to call-with-port.

(scheme file) procedure (delete-file (filename string?) ) ⟹ undefined

It is an error if filename is not a string. The delete-file procedure deletes the named file if it exists and can be deleted, and returns an unspecified value. If the file does not exist or cannot be deleted, an error that satisfies file-error? is signaled.

(scheme file) procedure (file-exists? (filename string?) ) ⟹ boolean?

The file-exists? procedure returns #t if the named file exists at the time the procedure is called, and #f otherwise.

(scheme file) procedure (open-binary-input-file (string string?) ) ⟹ input-port?

open-input-file, open-binary-input-file Takes a string for an existing file and returns a textual input port or binary input port that is capable of delivering data from the file. If the file does not exist or cannot be opened, an error that satisfies file-error? is signaled.

(scheme file) procedure (open-binary-output-file (string string?) ) ⟹ output-port?

open-output-file, open-binary-output-file Takes a string naming an output file to be created and returns a textual output port or binary output port that is capable of writing data to a new file by that name. If a file with the given name already exists, the effect is unspecified. If the file cannot be opened, an error that satisfies file-error? is signaled.

(scheme file) procedure (open-input-file (string string?) ) ⟹ input-port?

open-input-file, open-binary-input-file Takes a string for an existing file and returns a textual input port or binary input port that is capable of delivering data from the file. If the file does not exist or cannot be opened, an error that satisfies file-error? is signaled.

(scheme file) procedure (open-output-file (string string?) ) ⟹ output-port?

open-output-file, open-binary-output-file Takes a string naming an output file to be created and returns a textual output port or binary output port that is capable of writing data to a new file by that name. If a file with the given name already exists, the effect is unspecified. If the file cannot be opened, an error that satisfies file-error? is signaled.

(scheme file) procedure (with-input-from-file (string string?) (thunk procedure?) ) ⟹ *

(thunk ) ⟹ *

with-input-from-file, with-output-to-file The file is opened for input or output as if by open-input-file or open-output-file, and the new port is made to be the value returned by current-input-port or current-output-port (as used by (read), (write obj ), and so forth). The thunk is then called with no arguments. When the thunk returns, the port is closed and the previous default is restored. It is an error if thunk does not accept zero arguments. Both procedures return the values yielded by thunk . If an escape procedure is used to escape from the continuation of these procedures, they behave exactly as if the current input or output port had been bound dynamically with parameterize.

(scheme file) procedure (with-output-to-file (string string?) (thunk procedure?) ) ⟹ *

(thunk ) ⟹ *

with-input-from-file, with-output-to-file The file is opened for input or output as if by open-input-file or open-output-file, and the new port is made to be the value returned by current-input-port or current-output-port (as used by (read), (write obj ), and so forth). The thunk is then called with no arguments. When the thunk returns, the port is closed and the previous default is restored. It is an error if thunk does not accept zero arguments. Both procedures return the values yielded by thunk . If an escape procedure is used to escape from the continuation of these procedures, they behave exactly as if the current input or output port had been bound dynamically with parameterize.

library (scheme inexact)

(scheme inexact) procedure (acos (z number?) ) ⟹ number?

(scheme inexact) procedure (asin (z number?) ) ⟹ number?

(scheme inexact) procedure (atan (z number?) ) ⟹ number?

(scheme inexact) procedure (atan (y real?) (x real?) ) ⟹ number?

(scheme inexact) procedure (cos (z number?) ) ⟹ number?

(scheme inexact) procedure (exp (z number?) ) ⟹ number?

(scheme inexact) procedure (log (z number?) ) ⟹ number?

(scheme inexact) procedure (log (z1 number?) (z2 number?) ) ⟹ number?

(scheme inexact) procedure (sin (z number?) ) ⟹ number?

(scheme inexact) procedure (tan (z number?) ) ⟹ number?

These procedures compute the usual transcendental functions. The log procedure computes the natural logarithm of z (not the base ten logarithm) if a single argument is given, or the base-z2 logarithm of z1 if two arguments are given. The asin, acos, and atan procedures compute arcsine (sin−1), arc-cosine (cos−1), and arctangent (tan−1), respectively. The two-argument variant of atan computes (angle (make-rectangular x y)) (see below), even in implementations that don’t support complex numbers.

In general, the mathematical functions log, arcsine, arccosine, and arctangent are multiply defined. The value of log z is defined to be the one whose imaginary part lies in the range from −π (inclusive if -0.0 is distinguished, exclusive otherwise) to π (inclusive). The value of log 0 is mathematically undefined. With log defined this way, the values of sin−1 z, cos−1 z, and tan−1 z are according to the following formulæ:

sin^-1 z = -i log(iz + (1 - z^2)^0.5)

cos^-1 z = pi/2 - sin^-1 z

tan^-1 z = (log(1 + iz) - log(1 - iz)) / (2i)

(scheme inexact) procedure (sqrt (z number?) ) ⟹ number?

Returns the principal square root of z. The result will have either a positive real part, or a zero real part and a non-negative imaginary part.

(scheme inexact) procedure (finite? (z number?) ) ⟹ boolean?

The finite? procedure returns #t on all real numbers except +inf.0, -inf.0, and +nan.0, and on complex numbers if their real and imaginary parts are both finite. Otherwise it returns #f.

(scheme inexact) procedure (infinite? (z number?) ) ⟹ boolean?

The infinite? procedure returns #t on the real numbers +inf.0 and -inf.0, and on complex numbers if their real or imaginary parts or both are infinite. Otherwise it returns #f.

(scheme inexact) procedure (nan? (z number?) ) ⟹ boolean?

The nan? procedure returns #t on +nan.0, and on complex numbers if their real or imaginary parts or both are +nan.0. Otherwise it returns #f.

library (scheme lazy)

(scheme lazy) syntax (delay () ((_ expression) promise?) )

Semantics: The delay construct is used together with the procedure force to implement lazy evaluation or call by need. (delay 〈expression〉) returns an object called a promise which at some point in the future can be asked (by the force procedure) to evaluate 〈expression〉, and deliver the resulting value. The effect of 〈expression〉 returning multiple values is unspecified.

(scheme lazy) syntax (delay-force () ((_ expression) promise?) )

Semantics: The expression (delay-force expression) is conceptually similar to (delay (force expression)), with the difference that forcing the result of delay-force will in effect result in a tail call to (force expression), while forcing the result of (delay (force expression)) might not. Thus iterative lazy algorithms that might result in a long series of chains of delay and force can be rewritten using delay-force to prevent consuming unbounded space during evaluation.

(scheme lazy) procedure (force (promise promise?) ) ⟹ *

The force procedure forces the value of a promise created by delay, delay-force, or make-promise. If no value has been computed for the promise, then a value is computed and returned. The value of the promise must be cached (or “memoized”) so that if it is forced a second time, the previously computed value is returned. Consequently, a delayed expression is evaluated using the parameter values and exception handler of the call to force which first requested its value. If promise is not a promise, it may be returned unchanged.

(scheme lazy) procedure (make-promise obj ) ⟹ promise?

The make-promise procedure returns a promise which,when forced, will return obj . It is similar to delay, but does not delay its argument: it is a procedure rather than syntax. If obj is already a promise, it is returned.

(scheme lazy) procedure (promise? obj ) ⟹ boolean?

The promise? procedure returns #t if its argument is a promise, and #f otherwise. Note that promises are not necessarily disjoint from other Scheme types such as procedures.

library (scheme load)

(scheme load) procedure (load (filename string?) ) ⟹ undefined

(scheme load) procedure (load (filename string?) environment-specifier ) ⟹ undefined

It is an error if filename is not a string. An implementation-dependent operation is used to transform filename into the name of an existing file containing Scheme source code. The load procedure reads expressions and definitions from the file and evaluates them sequentially in the environment specified by environment-specifier . If environment-specifier is omitted, (interaction-environment) is assumed. It is unspecified whether the results of the expressions are printed. The load procedure does not affect the values returned by current-input-port and current-output-port. It returns an unspecified value. Rationale: For portability, load must operate on source files. Its operation on other kinds of files necessarily varies among implementations

library (scheme process-context)

(scheme process-context) procedure (command-line ) ⟹ list?

Returns the command line passed to the process as a list of strings. The first string corresponds to the command name, and is implementation-dependent. It is an error to mutate any of these strings.

(scheme process-context) procedure (emergency-exit ) ⟹ undefined

(scheme process-context) procedure (emergency-exit obj ) ⟹ undefined

Terminates the program without running any outstanding dynamic-wind after procedures and communicates an exit value to the operating system in the same manner as exit. Note: The emergency-exit procedure corresponds to the exit procedure in Windows and Posix.

(scheme process-context) procedure (exit ) ⟹ undefined

(scheme process-context) procedure (exit obj ) ⟹ undefined

Runs all outstanding dynamic-wind after procedures, terminates the running program, and communicates an exit value to the operating system. If no argument is supplied, or if obj is #t, the exit procedure should communicate to the operating system that the program exited normally. If obj is #f, the exit procedure should communicate to the operating system that the program exited abnormally. Otherwise, exit should translate obj into an appropriate exit value for the operating system, if possible. The exit procedure must not signal an exception or return to its continuation. Note: Because of the requirement to run handlers, this procedure is not just the operating system’s exit procedure.

(scheme process-context) procedure (get-environment-variable (name string?) ) ⟹ string? / #f /

Many operating systems provide each running process with an environment consisting of environment variables. (This environment is not to be confused with the Scheme environments that can be passed to eval: see section 6.12.) Both the name and value of an environment variable are strings. The procedure get-environment-variable returns the value of the environment variable name, or #f if the named environment variable is not found. It may use locale information to encode the name and decode the value of the environment variable. It is an error if get-environment-variable can’t decode the value. It is also an error to mutate the resulting string.

(scheme process-context) procedure (get-environment-variables ) ⟹ list?

return ⟹ (alist (envname string?) : (value string?))

Returns the names and values of all the environment variables as an alist, where the car of each entry is the name of an environment variable and the cdr is its value, both as strings. The order of the list is unspecified. It is an error to mutate any of these strings or the alist itself.

library (scheme read)

(scheme read) procedure (read ) ⟹ *

(scheme read) procedure (read (port input-port?) ) ⟹ *

The read procedure converts external representations of Scheme objects into the objects themselves. That is, it is a parser for the non-terminal 〈datum〉 (see sections 7.1.2 and 6.4). It returns the next object parsable from the given textual input port, updating port to point to the first character past the end of the external representation of the object. Implementations may support extended syntax to represent record types or other types that do not have datum representations. If an end of file is encountered in the input before any characters are found that can begin an object, then an end-of-file object is returned. The port remains open, and further attempts to read will also return an end-of-file object. If an end of file is encountered after the beginning of an object’s external representation, but the external representation is incomplete and therefore not parsable, an error that satisfies read-error? is signaled.

library (scheme repl)

(scheme repl) procedure (interaction-environment ) ⟹ *

This procedure returns a specifier for a mutable environment that contains an implementation-defined set of bindings, typically a superset of those exported by (scheme base). The intent is that this procedure will return the environment in which the implementation would evaluate expressions entered by the user into a REPL.

library (scheme time)

(scheme time) procedure (current-jiffy ) ⟹ integer?

Returns the number of jiffies as an exact integer that have elapsed since an arbitrary, implementation-defined epoch. A jiffy is an implementation-defined fraction of a second which is defined by the return value of the jiffies-per-second procedure. The starting epoch is guaranteed to be constant during a run of the program, but may vary between runs. Rationale: Jiffies are allowed to be implementation-dependent so that current-jiffy can execute with minimum overhead. It should be very likely that a compactly represented integer will suffice as the returned value. Any particular jiffy size will be inappropriate for some implementations: a microsecond is too long for a very fast machine, while a much smaller unit would force many implementations to return integers which have to be allocated for most calls, rendering current-jiffy less useful for accurate timing measurements.

(scheme time) procedure (current-second ) ⟹ real?

Returns an inexact number representing the current time on the International Atomic Time (TAI) scale. The value 0.0 represents midnight on January 1, 1970 TAI (equivalent to ten seconds before midnight Universal Time) and the value 1.0 represents one TAI second later. Neither high accuracy nor high precision are required; in particular, returning Coordinated Universal Time plus a suitable constant might be the best an implementation can do.

(scheme time) procedure (jiffies-per-second ) ⟹ integer?

Returns an exact integer representing the number of jiffies per SI second. This value is an implementation-specified constant.

library (scheme write)

(scheme write) procedure (display obj ) ⟹ undefined

(scheme write) procedure (display obj (port output-port?) ) ⟹ undefined

Writes a representation of obj to the given textual output port. Strings that appear in the written representation are output as if by write-string instead of by write. Symbols are not escaped. Character objects appear in the representation as if written by write-char instead of by write. The display representation of other objects is unspecified. However, display must not loop forever on self-referencing pairs, vectors, or records. Thus if the normal write representation is used, datum labels are needed to represent cycles as in write. Implementations may support extended syntax to represent record types or other types that do not have datum representations. The display procedure returns an unspecified value. Rationale: The write procedure is intended for producing machine-readable output and display for producing human-readable output.

(scheme write) procedure (write obj ) ⟹ undefined

(scheme write) procedure (write obj (port output-port?) ) ⟹ undefined

Writes a representation of obj to the given textual output port. Strings that appear in the written representation are enclosed in quotation marks, and within those strings backslash and quotation mark characters are escaped by backslashes. Symbols that contain non-ASCII characters are escaped with vertical lines. Character objects are written using the #\ notation. If obj contains cycles which would cause an infinite loop using the normal written representation, then at least the objects that form part of the cycle must be represented using datum labels as described in section 2.4. Datum labels must not be used if there are no cycles. Implementations may support extended syntax to represent record types or other types that do not have datum representations.

(scheme write) procedure (write-shared obj ) ⟹ undefined

(scheme write) procedure (write-shared obj (port output-port?) ) ⟹ undefined

The write-shared procedure is the same as write, except that shared structure must be represented using datum labels for all pairs and vectors that appear more than once in the output.

(scheme write) procedure (write-simple obj ) ⟹ undefined

(scheme write) procedure (write-simple obj (port output-port?) ) ⟹ undefined

The write-simple procedure is the same as write, except that shared structure is never represented using datum labels. This can cause write-simple not to terminate if obj contains circular structure.

library (scheme r5rs)

(scheme r5rs) procedure (* (z number?) ... ) ⟹ number?

This procedure returns the product of its arguments.

(scheme r5rs) procedure (+ (z number?) ... ) ⟹ number?

This procedure returns the sum of its arguments.

(scheme r5rs) procedure (- (z number?) ... ) ⟹ number?

With two or more arguments, this procedure returns the difference of its arguments, associating to the left. With one argument, however, it returns the additive inverse of its argument.

(scheme r5rs) procedure (/ (z1 number?) (z2 number?) ... ) ⟹ number?

With two or more arguments, this procedure returns the quotient of its arguments, associating to the left. With one argument, however, it returns the multiplicative inverse of its argument.

(scheme r5rs) procedure (< (x1 real?) (x2 real?) (x3 real?) ... ) ⟹ boolean?

This procedure returns #t if its arguments are monotonically increasing.

(scheme r5rs) procedure (<= (x1 real?) (x2 real?) (x3 real?) ... ) ⟹ boolean?

This procedure returns #t if its arguments are monotonically non-decreasing.

(scheme r5rs) procedure (= (z1 number?) (z2 number?) (z3 number?) ... ) ⟹ boolean?

This procedure returns #t if its arguments are equal.

(scheme r5rs) procedure (> (x1 real?) (x2 real?) (x3 real?) ... ) ⟹ boolean?

This procedure returns #t if its arguments are monotonically decreasing.

(scheme r5rs) procedure (>= (x1 real?) (x2 real?) (x3 real?) ... ) ⟹ boolean?

This procedure returns #t if its arguments are monotonically non-increasing.

(scheme r5rs) procedure (abs (x real?) ) ⟹ number?

Abs returns the absolute value of its argument.

(scheme r5rs) syntax (and () ((_ test1 ...)) )

The 〈test〉 expressions are evaluated from left to right, and the value of the first expression that evaluates to a false value (see section 6.3.1) is returned. Any remaining ex- pressions are not evaluated. If all the expressions evaluate to true values, the value of the last expression is returned. If there are no expressions then #t is returned.

(scheme r5rs) procedure (append (list list?) ... ) ⟹ list?

(scheme r5rs) procedure (append (list list?) ... obj ) ⟹ *

eturns a list consisting of the elements of the first list followed by the elements of the other lists.

The resulting list is always newly allocated, except that it shares structure with the last list argument. The last argument may actually be any object; an improper list results if the last argument is not a proper list.

(scheme r5rs) procedure (apply (proc procedure?) arg1 ... (args list?) ) ⟹ *

Proc must be a procedure and args must be a list. Calls proc with the elements of the list (append (list arg1 . . . ) args) as the actual arguments.

(scheme r5rs) procedure (assoc obj (alist list?) ) ⟹ pair? / #f /

Alist (for "association list") must be a list of pairs. These procedures find the first pair in alist whose car field is obj, and returns that pair. If no pair in alist has obj as its car,then #f (not the empty list) is returned. Assoc uses equal? to compare obj with the car fields of the pairs in alist.

(scheme r5rs) procedure (assq obj (alist list?) ) ⟹ pair? / #f /

Alist (for "association list") must be a list of pairs. These procedures find the first pair in alist whose car field is obj, and returns that pair. If no pair in alist has obj as its car,then #f (not the empty list) is returned. Assq uses eq? to compare obj with the car fields of the pairs in alist.

(scheme r5rs) procedure (assv obj (alist list?) ) ⟹ pair? / #f /

Alist (for "association list") must be a list of pairs. These procedures find the first pair in alist whose car field is obj, and returns that pair. If no pair in alist has obj as its car,then #f (not the empty list) is returned. Assv uses eqv? to compare obj with the car fields of the pairs in alist.

(scheme r5rs) syntax (begin () ((_ expression-or-definition ...)) )

The 〈expression〉s are evaluated sequentially from left to right, and the value(s) of the last 〈expression〉 is(are) returned. This expression type is used to sequence side effects such as input and output.

(scheme r5rs) procedure (boolean? obj ) ⟹ boolean?

Boolean? returns #t if obj is either #t or #f and returns #f otherwise.

(scheme r5rs) procedure (caar (pair pair?) ) ⟹ *

Composition of car and car.

(scheme r5rs) procedure (cadr (pair pair?) ) ⟹ *

Composition of car and cdr.

(scheme r5rs) procedure (call-with-current-continuation (proc procedure?) ) ⟹ *

(proc (k procedure?) ) ⟹ *

The procedure call-with-current-continuation packages up the current continuation (see the rationale below) as an "escape procedure" and passes it as an argument to proc. The escape procedure is a Scheme procedure that, if it is later called, will abandon whatever continuation is in effect at that later time and will instead use the continuation that was in effect when the escape procedure was created. Calling the escape procedure may cause the invocation of before and after thunks installed using dynamic-wind.

The escape procedure accepts the same number of arguments as the continuation to the original call to call-with-current-continuation. Except for continuations created by the call-with-values procedure, all continuations take exactly one value. The effect of passing no value or more than one value to continuations that were not created by call-with-values is unspecified.

The escape procedure that is passed to proc has unlimited extent just like any other procedure in Scheme. It may be stored in variables or data structures and may be called as many times as desired.

Rationale: A common use of call-with-current-continuation is for structured, non-local exits from loops or procedure bodies, but in fact call-with-current-continuation is extremely useful for implementing a wide variety of advanced control structures.

Whenever a Scheme expression is evaluated there is a continuation wanting the result of the expression. The continuation represents an entire (default) future for the computation. If the expression is evaluated at top level, for example, then the continuation might take the result, print it on the screen, prompt for the next input, evaluate it, and so on forever. Most of the time the continuation includes actions specified by user code, as in a continuation that will take the result, multiply it by the value stored in a local variable, add seven, and give the answer to the top level continuation to be printed. Normally these ubiquitous continuations are hidden behind the scenes and programmers do not think much about them. On rare occasions, however, a programmer may need to deal with continuations explicitly. Call-with-current-continuation allows Scheme programmers to do that by creating a procedure that acts just like the current continuation.

Most programming languages incorporate one or more special purpose escape constructs with names like exit, return, or even goto. In 1965, however, Peter Landin [16] invented a general purpose escape operator called the J-operator. John Reynolds [24] described a simpler but equally powerful construct in 1972. The catch special form described by Sussman and Steele in the 1975 report on Scheme is exactly the same as Reynolds’s construct, though its name came from a less general construct in MacLisp. Several Scheme implementors noticed that the full power of the catch construct could be provided by a procedure instead of by a special syntactic construct, and the name call-with-current-continuation was coined in 1982. This name is descriptive, but opinions differ on the merits of such a long name, and some people use the name call/cc instead.

(scheme r5rs) procedure (call-with-values (producer procedure?) (consumer procedure?) ) ⟹ *

(producer ) ⟹ *

(consumer obj ... ) ⟹ *

Calls its producer argument with no values and a continuation that, when passed some values, calls the consumer procedure with those values as arguments. The continuation for the call to consumer is the continuation of the call to call-with-values.

(scheme r5rs) procedure (car (pair pair?) ) ⟹ *

Returns the contents of the car field of pair. Note that it is an error to take the car of the empty list.

(scheme r5rs) syntax (case (else ) ((_ key clause1 clause2 ...)) )

((datum1 ...) expression1 expression2 ...) (else expression1 expression2 ...)

A case expression is evaluated as follows. 〈Key〉 is evaluated and its result is compared against each 〈datum〉. If the result of evaluating 〈key〉 is equivalent (in the sense of eqv?; see section 6.1) to a 〈datum〉, then the expressions in the corresponding 〈clause〉 are evaluated from left to right and the result(s) of the last expression in the 〈clause〉 is(are) returned as the result(s) of the case expression. If the result of evaluating 〈key〉 is different from every 〈datum〉, then if there is an else clause its expressions are evaluated and the result(s) of the last is(are) the result(s) of the case expression; otherwise the result of the case expression is unspecified.

(scheme r5rs) procedure (cdar (pair pair?) ) ⟹ *

Composition of cdr and car

(scheme r5rs) procedure (cddr (pair pair?) ) ⟹ *

Composition of cdr and cdr

(scheme r5rs) procedure (cdr (pair pair?) ) ⟹ *

Returns the contents of the cdr field of pair . Note that it is an error to take the cdr of the empty list.

(scheme r5rs) procedure (ceiling (x real?) ) ⟹ real?

Ceiling returns the smallest integer not smaller than x. Note: If the argument to one of these procedures is inexact,then the result will also be inexact. If an exact value is needed, the result should be passed to the inexact->exact procedure.

(scheme r5rs) procedure (char->integer (char char?) ) ⟹ integer?

Given a character, char->integer returns an exact integer representation of the character. This procedure implements order-preserving isomorphisms between the set of characters under the char<=? ordering and some subset of the integers under the <= ordering

(scheme r5rs) procedure (char-ready? ) ⟹ boolean?

(scheme r5rs) procedure (char-ready? (port input-port?) ) ⟹ boolean?

Returns #t if a character is ready on the input port and returns #f otherwise. If char-ready returns #t then the next read-char operation on the given port is guaranteed not to hang. If the port is at end of file then char-ready? returns #t. Port may be omitted, in which case it defaults to the value returned by current-input-port.

Rationale: Char-ready? exists to make it possible for a program to accept characters from interactive ports without getting stuck waiting for input. Any input editors associated with such ports must ensure that characters whose existence has been asserted by char-ready? cannot be rubbed out. If char-ready? were to return #f at end of file, a port at end of file would be indistinguishable from an interactive port that has no ready characters.

(scheme r5rs) procedure (char<=? (char1 char?) (char2 char?) ) ⟹ boolean?

This procedure imposes a total ordering on the set of characters. It is guaranteed that under this ordering:

  • The upper case characters are in order.
  • The lower case characters are in order.
  • The digits are in order.
  • Either all the digits precede all the upper case letters,
  • or vice versa.

  • Either all the digits precede all the lower case letters,
  • or vice versa.

    Some implementations may generalize the procedure to take more than two arguments, as with the corresponding numerical predicate.

    (scheme r5rs) procedure (char<? (char1 char?) (char2 char?) ) ⟹ boolean?

    This procedure imposes a total ordering on the set of characters. It is guaranteed that under this ordering:

  • The upper case characters are in order.
  • The lower case characters are in order.
  • The digits are in order.
  • Either all the digits precede all the upper case letters,
  • or vice versa.

  • Either all the digits precede all the lower case letters,
  • or vice versa.

    Some implementations may generalize the procedure to take more than two arguments, as with the corresponding numerical predicate.

    (scheme r5rs) procedure (char=? (char1 char?) (char2 char?) ) ⟹ boolean?

    This procedure imposes a total ordering on the set of characters. It is guaranteed that under this ordering:

  • The upper case characters are in order.
  • The lower case characters are in order.
  • The digits are in order.
  • Either all the digits precede all the upper case letters,
  • or vice versa.

  • Either all the digits precede all the lower case letters,
  • or vice versa.

    Some implementations may generalize the procedure to take more than two arguments, as with the corresponding numerical predicate.

    (scheme r5rs) procedure (char>=? (char1 char?) (char2 char?) ) ⟹ boolean?

    This procedure imposes a total ordering on the set of characters. It is guaranteed that under this ordering:

  • The upper case characters are in order.
  • The lower case characters are in order.
  • The digits are in order.
  • Either all the digits precede all the upper case letters,
  • or vice versa.

  • Either all the digits precede all the lower case letters,
  • or vice versa.

    Some implementations may generalize the procedure to take more than two arguments, as with the corresponding numerical predicate.

    (scheme r5rs) procedure (char>? (char1 char?) (char2 char?) ) ⟹ boolean?

    This procedure imposes a total ordering on the set of characters. It is guaranteed that under this ordering:

  • The upper case characters are in order.
  • The lower case characters are in order.
  • The digits are in order.
  • Either all the digits precede all the upper case letters,
  • or vice versa.

  • Either all the digits precede all the lower case letters,
  • or vice versa.

    Some implementations may generalize the procedure to take more than two arguments, as with the corresponding numerical predicate.

    (scheme r5rs) procedure (char? obj ) ⟹ boolean?

    Returns #t if obj is a character, otherwise returns #f.

    (scheme r5rs) procedure (close-input-port (port input-port?) ) ⟹ undefined

    Closes the file associated with port, rendering the port incapable of delivering characters. These routine has no effect if the file has already been closed.

    (scheme r5rs) procedure (close-output-port (port output-port?) ) ⟹ undefined

    Closes the file associated with port, rendering the port incapable of accepting characters. These routine has no effect if the file has already been closed.

    (scheme r5rs) syntax (cond (else => ) ((_ clause1 clause2 ...)) )

    (test expression1 ...) (test => receiver) (else expression1 expression2 ...)

    receiver ⟹ procedure?

    A cond expression is evaluated by evaluating the 〈test〉 expressions of successive 〈clause〉s in order until one of them evaluates to a true value (see section 6.3.1). When a 〈test〉 evaluates to a true value, then the remaining 〈expression〉s in its 〈clause〉 are evaluated in order,and the result(s) of the last 〈expression〉 in the 〈clause〉 is(are) returned as the result(s) of the entire cond expression. If the selected 〈clause〉 contains only the 〈test〉 and no 〈expression〉s, then the value of the 〈test〉 is returned as the result. If the selected 〈clause〉 uses the => alternate form, then the 〈expression〉 is evaluated. Its value must be a procedure that accepts one argument; this procedure is then called on the value of the 〈test〉 and the value(s) returned by this procedure is(are) returned by the cond expression. If all 〈test〉s evaluate to false values, and there is no else clause, then the result of the conditional expression is unspecified; if there is an else clause, then its 〈expression〉s are evaluated, and the value(s) of the last one is(are) returned.

    (scheme r5rs) procedure (cons obj1 obj2 ) ⟹ pair?

    Returns a newly allocated pair whose car is obj1 and whose cdr is obj2. The pair is guaranteed to be different (in the sense of eqv?) from every existing object.

    (scheme r5rs) procedure (current-input-port ) ⟹ input-port?

    Returns the current default input port.

    (scheme r5rs) procedure (current-output-port ) ⟹ output-port?

    Returns the current default output port.

    (scheme r5rs) syntax (define () ((_ variable expression)) ((_ (variable parameter1 ...) body)) ((_ (variable parameter1 ... . parameter) body)) )

    At the top level of a program, a definition (define 〈variable〉 〈expression〉) has essentially the same effect as the assignment expression (set! 〈variable〉 〈expression〉) if 〈variable〉 is bound. If 〈variable〉 is not bound, however, then the definition will bind 〈variable〉 to a new location before performing the assignment, whereas it would be an error to perform a set! on an unbound variable.

    Some implementations of Scheme use an initial environment in which all possible variables are bound to locations, most of which contain undefined values. Top level definitions in such an implementation are truly equivalent to assignments.

    (scheme r5rs) syntax (define-syntax () ((_ keyword transformer-spec)) )

    transformer-spec ⟹ transformer-spec

    Syntax definitions are valid only at the top level of a 〈program〉. 〈Keyword〉 is an identifier, and the 〈transformer spec〉 should be an instance of syntax-rules. The top-level syntactic environment is extended by binding the 〈keyword〉 to the specified transformer. There is no define-syntax analogue of internal definitions. Although macros may expand into definitions and syntax definitions in any context that permits them, it is an error for a definition or syntax definition to shadow a syntactic keyword whose meaning is needed to determine whether some form in the group of forms that contains the shadowing definition is in fact a definition, or, for internal definitions, is needed to determine the boundary between the group and the expressions that follow the group.

    (scheme r5rs) procedure (denominator (q rational?) ) ⟹ integer?

    This procedure returns the denominator of its argument; the result is computed as if the argument was represented as a fraction in lowest terms. The denominator is always positive. The denominator of 0 is defined to be 1.

    (scheme r5rs) syntax (do () ((_ (variable-decl1 ...) (test expression ...) command ...)) )

    (variable init step) (variable init)

    Do is an iteration construct. It specifies a set of variables to be bound, how they are to be initialized at the start, and how they are to be updated on each iteration. When a termination condition is met, the loop exits after evaluating the 〈expression〉s.

    Do expressions are evaluated as follows: The 〈init〉 expressions are evaluated (in some unspecified order), the 〈variable〉s are bound to fresh locations, the results of the 〈init〉 expressions are stored in the bindings of the 〈variable〉s, and then the iteration phase begins.

    Each iteration begins by evaluating 〈test〉; if the result is false (see section 6.3.1), then the 〈command〉 expressions are evaluated in order for effect, the 〈step〉 expressions are evaluated in some unspecified order, the 〈variable〉s are bound to fresh locations, the results of the 〈step〉s are stored in the bindings of the 〈variable〉s, and the next iteration begins.

    If 〈test〉 evaluates to a true value, then the 〈expression〉s are evaluated from left to right and the value(s) of the last 〈expression〉 is(are) returned. If no 〈expression〉s are present, then the value of the do expression is unspecified.

    The region of the binding of a 〈variable〉 consists of the entire do expression except for the 〈init〉s. It is an error for a 〈variable〉 to appear more than once in the list of do variables.

    A 〈step〉 may be omitted, in which case the effect is the same as if (〈variable〉 〈init〉 〈variable〉) had been written instead of (〈variable〉 〈init〉).

    (scheme r5rs) procedure (dynamic-wind (before procedure?) (thunk procedure?) (after procedure?) ) ⟹ *

    (before ) ⟹ undefined

    (thunk ) ⟹ *

    (after ) ⟹ undefined

    Calls thunk without arguments, returning the result(s) of this call. Before and after are called, also without arguments, as required by the following rules (note that in the absence of calls to continuations captured using call-with-current-continuation the three arguments are called once each, in order). Before is called whenever execution enters the dynamic extent of the call to thunk and after is called whenever it exits that dynamic extent. The dynamic extent of a procedure call is the period between when the call is initiated and when it returns. In Scheme, because of call-with-current-continuation,the dynamic extent of a call may not be a single, connected time period. It is defined as follows:

  • The dynamic extent is entered when execution of the body of the called procedure begins.
  • The dynamic extent is also entered when execution is not within the dynamic extent and a continuation is invoked that was captured (using call-with-current-continuation) during the dynamic extent.
  • It is exited when the called procedure returns.
  • It is also exited when execution is within the dynamic extent and a continuation is invoked that was captured while not within the dynamic extent.
  • If a second call to dynamic-wind occurs within the dynamic extent of the call to thunk and then a continuation is invoked in such a way that the after s from these two invocations of dynamic-wind are both to be called, then the after associated with the second (inner) call to dynamic-wind is called first.

    If a second call to dynamic-wind occurs within the dynamic extent of the call to thunk and then a continuation is invoked in such a way that the befores from these two invocations of dynamic-wind are both to be called, then the before associated with the first (outer) call to dynamic-wind is called first.

    If invoking a continuation requires calling the before from one call to dynamic-wind and the after from another, then the after is called first.

    The effect of using a captured continuation to enter or exit the dynamic extent of a call to before or after is undefined.

    (scheme r5rs) procedure (eof-object? obj ) ⟹ boolean?

    Returns #t if obj is an end of file object, otherwise returns #f. The precise set of end of file objects will vary among implementations, but in any case no end of file object will ever be an object that can be read in using read.

    (scheme r5rs) procedure (eq? obj1 obj2 ) ⟹ boolean?

    Eq? is similar to eqv? except that in some cases it is capable of discerning distinctions finer than those detectable by eqv?.

    Eq? and eqv? are guaranteed to have the same behavior on symbols, booleans, the empty list, pairs, procedures, and non-empty strings and vectors. Eq?’s behavior on numbers and characters is implementation-dependent, but it will always return either true or false, and will return true only when eqv? would also return true. Eq? may also behave differently from eqv? on empty vectors and empty strings.

    Rationale: It will usually be possible to implement eq? much more efficiently than eqv?, for example, as a simple pointer comparison instead of as some more complicated operation. One reason is that it may not be possible to compute eqv? of two numbers in constant time, whereas eq? implemented as pointer comparison will always finish in constant time. Eq? may be used like eqv? in applications using procedures to implement objects with state since it obeys the same constraints as eqv?.

    (scheme r5rs) procedure (equal? obj1 obj2 ) ⟹ boolean?

    Equal? recursively compares the contents of pairs, vectors, and strings, applying eqv? on other objects such as numbers and symbols. A rule of thumb is that objects are generally equal? if they print the same. Equal? may fail to terminate if its arguments are circular data structures.

    (scheme r5rs) procedure (eqv? obj1 obj2 ) ⟹ boolean?

    The eqv? procedure defines a useful equivalence relation on objects. Briefly, it returns #t if obj1 and obj2 should normally be regarded as the same object. This relation is left slightly open to interpretation, but the following partial specification of eqv? holds for all implementations of Scheme. The eqv? procedure returns #t if:

  • obj1 and obj2 are both #t or both #f.
  • obj1 and obj2 are both symbols and (string=? (symbol->string obj1) (symbol->string obj2)) => #t. Note: This assumes that neither obj1 nor obj2 is an "uninterned symbol" as alluded to in section 6.3.3. This report does not presume to specify the behavior of eqv? on implementation-dependent extensions.
  • obj1 and obj2 are both numbers, are numerically equal (see =, section 6.2), and are either both exact or both inexact.
  • obj1 and obj2 are both characters and are the same character according to the char=? procedure (section 6.3.4).
  • both obj1 and obj2 are the empty list.
  • obj1 and obj2 are pairs, vectors, or strings that denote the same locations in the store (section 3.4).
  • obj1 and obj2 are procedures whose location tags are equal (section 4.1.4).
  • The eqv? procedure returns #f if:

  • obj1 and obj2 are of different types (section 3.2).
  • one of obj1 and obj2 is #t but the other is #f.
  • obj1 and obj2 are symbols but (string=? (symbol->string obj1) (symbol->string obj2)) => #f
  • one of obj1 and obj2 is an exact number but the other is an inexact number.
  • obj1 and obj2 are numbers for which the = procedure returns #f.
  • obj1 and obj2 are characters for which the char=? procedure returns #f.
  • one of obj1 and obj2 is the empty list but the other is not.
  • obj1 and obj2 are pairs, vectors, or strings that denote distinct locations.
  • obj1 and obj2 are procedures that would behave differently (return different value(s) or have different side effects) for some arguments.
  • (scheme r5rs) procedure (inexact->exact (z number?) ) ⟹ exact?

    Inexact->exact returns an exact representation of z. The value returned is the exact number that is numerically closest to the argument. If an inexact argument has no reasonably close exact equivalent, then a violation of an implementation restriction may be reported.

    The procedure implements the natural one-to-one correspondence between exact and inexact integers throughout an implementation-dependent range. See section 6.2.3.

    (scheme r5rs) procedure (exact? (z number?) ) ⟹ boolean?

    This numerical predicate provides test for the exactness of a quantity. For any Scheme number, precisely one of exact?, inexact? predicates is true.

    (scheme r5rs) procedure (expt (z1 number?) (z2 number?) ) ⟹ number?

    Returns z1 raised to the power z2. 0^z is 1 if z = 0 and 0 otherwise.

    (scheme r5rs) procedure (floor (x real?) ) ⟹ integer?

    Floor returns the largest integer not larger than x. Note: If the argument to the procedure is inexact, then the result will also be inexact. If an exact value is needed, the result should be passed to the inexact->exact procedure.

    (scheme r5rs) procedure (for-each (proc procedure?) (list1 list?) (list2 list?) ... ) ⟹ undefined

    (proc obj1 obj2 ... ) ⟹ undefined

    The arguments to for-each are like the arguments to map, but for-each calls proc for its side effects rather than for its values. Unlike map, for-each is guaranteed to call proc on the elements of the lists in order from the first element(s) to the last, and the value returned by for-each is unspecified.

    (scheme r5rs) procedure (gcd (n integer?) ... ) ⟹ integer?

    The procedure returns the greatest common divisor of its arguments. The result is always non-negative.

    (scheme r5rs) syntax (if () ((_ test consequent)) ((_ test consequent alternate)) )

    An if expression is evaluated as follows: first,〈test〉 is evaluated. If it yields a true value (see section 6.3.1), then 〈consequent〉 is evaluated and its value(s) is(are) returned. Otherwise 〈alternate〉 is evaluated and its value(s) is(are) returned. If 〈test〉 yields a false value and no 〈alternate〉 is specified, then the result of the expression is unspecified.

    (scheme r5rs) procedure (exact->inexact (z number?) ) ⟹ inexact?

    Exact->inexact returns an inexact representation of z. The value returned is the inexact number that is numerically closest to the argument. If an exact argument has no reasonably close inexact equivalent, then a violation of an implementation restriction may be reported.

    (scheme r5rs) procedure (inexact? (z number?) ) ⟹ boolean?

    This numerical predicate provides test for the exactness of a quantity. For any Scheme number, precisely one of exact?, inexact? predicates is true.

    (scheme r5rs) procedure (input-port? obj ) ⟹ boolean?

    Returns #t if obj is an input port, otherwise returns #f

    (scheme r5rs) procedure (integer->char (n integer?) ) ⟹ char?

    Given an exact integer that is the image of a character under char->integer,integer->char returns that character. The procedure implements order-preserving isomorphisms between the set of characters under the char<=? ordering and some subset of the integers under the <= ordering

    (scheme r5rs) syntax (lambda () ((_ formals body) procedure?) )

    (variable1 ...) variable (variable1 ... variable_n . variable_n+1)

    A lambda expression evaluates to a procedure. The environment in effect when the lambda expression was evaluated is remembered as part of the procedure. When the procedure is later called with some actual arguments, the environment in which the lambda expression was evaluated will be extended by binding the variables in the formal argument list to fresh locations, the corresponding actual argument values will be stored in those locations, and the expressions in the body of the lambda expression will be evaluated sequentially in the extended environment. The result(s) of the last expression in the body will be returned as the result(s) of the procedure call.

    〈Formals〉 should have one of the following forms:

  • (〈variable1〉 . . . ): The procedure takes a fixed number of arguments; when the procedure is called, the arguments will be stored in the bindings of the corresponding variables.
  • 〈variable〉: The procedure takes any number of arguments; when the procedure is called, the sequence of actual arguments is converted into a newly allocated list, and the list is stored in the binding of the 〈variable〉.
  • (〈variable1〉 . . . 〈variablen〉 . 〈variablen+1〉): If a space-delimited period precedes the last variable, then the procedure takes n or more arguments, where n is the number of formal arguments before the period (there must be at least one). The value stored in the binding of the last variable will be a newly allocated list of the actual arguments left over after all the other actual arguments have been matched up against the other formal arguments.
  • It is an error for a 〈variable〉 to appear more than once in 〈formals〉. Each procedure created as the result of evaluating a lambda expression is (conceptually) tagged with a storage location, in order to make eqv? and eq? work on procedures (see section 6.1).

    (scheme r5rs) procedure (lcm (n integer?) ... ) ⟹ integer?

    This procedure returns the least common multiple of its arguments. The result is always non-negative.

    (scheme r5rs) procedure (length (list list?) ) ⟹ integer?

    Returns the length of list.

    (scheme r5rs) syntax (let () ((_ bindings body)) ((_ variable bindings body)) )

    ((variable1 init1) ...)

    The 〈init〉s are evaluated in the current environment (in some unspecified order), the 〈variable〉s are bound to fresh locations holding the results, the 〈body〉 is evaluated in the extended environment, and the value(s) of the last expression of 〈body〉 is(are) returned. Each bind ing of a 〈variable〉 has 〈body〉 as its region.

    "Named let" is a variant on the syntax of let which provides a more general looping construct than do and may also be used to express recursions. It has the same syntax and semantics as ordinary let except that 〈variable〉 is bound within 〈body〉 to a procedure whose formal arguments are the bound variables and whose body is 〈body〉. Thus the execution of 〈body〉 may be repeated by invoking the procedure named by 〈variable〉.

    (scheme r5rs) syntax (let* () ((_ bindings body)) )

    ((variable1 init1) ...)

    Let* is similar to let, but the bindings are performed sequentially from left to right, and the region of a binding indicated by (〈variable〉 〈init〉) is that part of the let* expression to the right of the binding. Thus the second binding is done in an environment in which the first binding is visible, and so on.

    (scheme r5rs) syntax (let-syntax () ((_ bindings body)) )

    ((keyword transformer-spec) ...)

    transformer-spec ⟹ transformer-spec

    Each 〈keyword〉 is an identifier, each 〈transformer spec〉 is an instance of syntax-rules, and 〈body〉 should be a sequence of one or more expressions. It is an error for a 〈keyword〉 to appear more than once in the list of keywords being bound.

    Semantics: The 〈body〉 is expanded in the syntactic environment obtained by extending the syntactic environment of the let-syntax expression with macros whose keywords are the 〈keyword〉s, bound to the specified transformers. Each binding of a 〈keyword〉 has 〈body〉 as its region.

    (scheme r5rs) syntax (letrec () ((_ bindings body)) )

    ((variable1 init1) ...)

    The 〈variable〉s are bound to fresh locations holding undefined values, the 〈init〉s are evaluated in the resulting environment (in some unspecified order), each 〈variable〉 is assigned to the result of the corresponding 〈init〉, the 〈body〉 is evaluated in the resulting environment, and the value(s) of the last expression in 〈body〉 is(are) returned. Each binding of a 〈variable〉 has the entire letrec expression as its region, making it possible to define mutually recursive procedures.

    One restriction on letrec is very important: it must be possible to evaluate each 〈init〉 without assigning or referring to the value of any 〈variable〉. If this restriction is violated, then it is an error. The restriction is necessary because Scheme passes arguments by value rather than by name. In the most common uses of letrec, all the 〈init〉s are lambda expressions and the restriction is satisfied automatically.

    (scheme r5rs) syntax (letrec-syntax () ((_ bindings body)) )

    ((keyword transformer-spec) ...)

    The 〈body〉 is expanded in the syntactic environment obtained by extending the syntactic environment of the letrec-syntax expression with macros whose key- words are the 〈keyword〉s, bound to the specified transformers. Each binding of a 〈keyword〉 has the 〈bindings〉 as well as the 〈body〉 within its region, so the transformers can transcribe expressions into uses of the macros introduced by the letrec-syntax expression.

    (scheme r5rs) procedure (list obj ... ) ⟹ list?

    Returns a newly allocated list of its arguments.

    (scheme r5rs) procedure (list->string (list list?) ) ⟹ string?

    List->string returns a newly allocated string formed from the characters in the list list, which must be a list of characters. String->list and list->string are inverses so far as equal? is concerned.

    (scheme r5rs) procedure (list->vector (list list?) ) ⟹ vector?

    List->vector returns a newly created vector initialized to the elements of the list list.

    (scheme r5rs) procedure (list-ref (list list?) (k integer?) ) ⟹ *

    Returns the kth element of list. (This is the same as the car of (list-tail list k).) It is an error if list has fewer than k elements.

    (scheme r5rs) procedure (list-tail (list list?) (k integer?) ) ⟹ list?

    Returns the sublist of list obtained by omitting the first k elements. It is an error if list has fewer than k elements.

    (scheme r5rs) procedure (list? obj ) ⟹ boolean?

    Returns #t if obj is a list, otherwise returns #f. By definition, all lists have finite length and are terminated by the empty list.

    (scheme r5rs) procedure (make-string (k integer?) ) ⟹ string?

    (scheme r5rs) procedure (make-string (k integer?) (char char?) ) ⟹ string?

    Make-string returns a newly allocated string of length k. If char is given, then all elements of the string are initialized to char, otherwise the contents of the string are unspecified

    (scheme r5rs) procedure (make-vector (k integer?) ) ⟹ vector?

    (scheme r5rs) procedure (make-vector (k integer?) fill ) ⟹ vector?

    Returns a newly allocated vector of k elements. If a second argument is given, then each element is initialized to fill. Otherwise the initial contents of each element is unspecified.

    (scheme r5rs) procedure (map (proc procedure?) (list1 list?) (list2 list?) ... ) ⟹ list?

    (proc obj1 obj2 ... ) ⟹ *

    The lists must be lists, and proc must be a procedure taking as many arguments as there are lists and returning a single value. If more than one list is given, then they must all be the same length. Map applies proc element-wise to the elements of the lists and returns a list of the results, in order. The dynamic order in which proc is applied to the elements of the lists is unspecified.

    (scheme r5rs) procedure (max (x1 real?) (x2 real?) ... ) ⟹ real?

    This procedure returns the maximum of its arguments. Note: If any argument is inexact, then the result will also be inexact (unless the procedure can prove that the inaccuracy is not large enough to affect the result, which is possible only in unusual implementations). If min or max is used to compare numbers of mixed exactness, and the numerical value of the result cannot be represented as an inexact number without loss of accuracy, then the procedure may report a violation of an implementation restriction.

    (scheme r5rs) procedure (member obj (list list?) ) ⟹ #f / list? /

    This procedure returns the first sublist of list whose car is obj , where the sublists of list are the non-empty lists returned by (list-tail list k ) for k less than the length of list. If obj does not occur in list, then #f (not the empty list) is returned. Member uses equal? to compare obj with the elements of list.

    (scheme r5rs) procedure (memq obj (list list?) ) ⟹ #f / list? /

    This procedure returns the first sublist of list whose car is obj , where the sublists of list are the non-empty lists returned by (list-tail list k ) for k less than the length of list. If obj does not occur in list, then #f (not the empty list) is returned. Memq uses eq? to compare obj with the elements of list.

    (scheme r5rs) procedure (memv obj (list list?) ) ⟹ #f / list? /

    This procedure returns the first sublist of list whose car is obj , where the sublists of list are the non-empty lists returned by (list-tail list k ) for k less than the length of list. If obj does not occur in list, then #f (not the empty list) is returned. Memv uses eqv? to compare obj with the elements of list.

    (scheme r5rs) procedure (min (x1 real?) (x2 real?) ... ) ⟹ real?

    This procedure returns the minimum of its arguments. Note: If any argument is inexact, then the result will also be inexact (unless the procedure can prove that the inaccuracy is not large enough to affect the result, which is possible only in unusual implementations). If min or max is used to compare numbers of mixed exactness, and the numerical value of the result cannot be represented as an inexact number without loss of accuracy, then the procedure may report a violation of an implementation restriction.

    (scheme r5rs) procedure (modulo (n1 integer?) (n2 integer?) ) ⟹ integer?

    Number-theoretic (integer) division. n2 should be non-zero.

    (scheme r5rs) procedure (newline ) ⟹ undefined

    (scheme r5rs) procedure (newline (port output-port?) ) ⟹ undefined

    Writes an end of line to port. Exactly how this is done differs from one operating system to another. Returns an unspecified value. The port argument may be omitted, in which case it defaults to the value returned by current-output-port.

    (scheme r5rs) procedure (not obj ) ⟹ boolean?

    Not returns #t if obj is false, and returns #f otherwise.

    (scheme r5rs) procedure (null? obj ) ⟹ boolean?

    Returns #t if obj is the empty list, otherwise returns #f

    (scheme r5rs) procedure (number->string (z number?) ) ⟹ string?

    (scheme r5rs) procedure (number->string (z number?) (radix integer?) ) ⟹ string?

    Radix must be an exact integer, either 2, 8, 10, or 16. If omitted, radix defaults to 10. The procedure number-> string takes a number and a radix and returns as a string an external representation of the given number in the given radix such that

    (let ((number number) (radix radix)) (eqv? number (string->number (number->string number radix) radix)))

    is true. It is an error if no possible result makes this expression true.

    If z is inexact, the radix is 10, and the above expression can be satisfied by a result that contains a decimal point, then the result contains a decimal point and is expressed using the minimum number of digits (exclusive of exponent and trailing zeroes) needed to make the above expression true [3, 5]; otherwise the format of the result is unspecified. The result returned by number->string never contains an explicit radix prefix.

    Note: The error case can occur only when z is not a complex number or is a complex number with a non-rational real or imaginary part.

    Rationale: If z is an inexact number represented using flonums,and the radix is 10, then the above expression is normally satisfied by a result containing a decimal point. The unspecified case allows for infinities, NaNs, and non-flonum representations.

    (scheme r5rs) procedure (numerator (q rational?) ) ⟹ integer?

    This procedure returns the numerator of its argument; the result is computed as if the argument was represented as a fraction in lowest terms.

    (scheme r5rs) syntax (or () ((_ test1 ...)) )

    The 〈test〉 expressions are evaluated from left to right, and the value of the first expression that evaluates to a true value (see section 6.3.1) is returned. Any remaining expressions are not evaluated. If all expressions evaluate to false values, the value of the last expression is returned. If there are no expressions then #f is returned.

    (scheme r5rs) procedure (output-port? obj ) ⟹ boolean?

    Returns #t if obj is an output port, otherwise returns #f.

    (scheme r5rs) procedure (pair? obj ) ⟹ boolean?

    Pair? returns #t if obj is a pair, and otherwise returns #f.

    (scheme r5rs) procedure (peek-char ) ⟹ eof-object? / char? /

    (scheme r5rs) procedure (peek-char (port input-port?) ) ⟹ eof-object? / char? /

    Returns the next character available from the input port, without updating the port to point to the following character. If no more characters are available, an end of file object is returned. Port may be omitted, in which case it defaults to the value returned by current-input-port.

    Note: The value returned by a call to peek-char is the same as the value that would have been returned by a call to read-char with the same port. The only difference is that the very next call to read-char or peek-char on that port will return the value returned by the preceding call to peek-char. In particular, a call to peek-char on an interactive port will hang waiting for input whenever a call to read-char would have hung.

    (scheme r5rs) procedure (procedure? obj ) ⟹ boolean?

    Returns #t if obj is a procedure, otherwise returns #f.

    (scheme r5rs) syntax (quasiquote () ((_ qq-template)) )

    "Backquote" or "quasiquote" expressions are useful for constructing a list or vector structure when most but not all of the desired structure is known in advance. If no commas appear within the 〈qq template〉, the result of evaluating `〈qq template〉 is equivalent to the result of evaluating ’〈qq template〉. If a comma appears within the 〈qq template〉, however, the expression following the comma is evaluated ("unquoted") and its result is inserted into the structure instead of the comma and the expression. If a comma appears followed immediately by an at-sign (@), then the following expression must evaluate to a list; the opening and closing parentheses of the list are then “stripped away” and the elements of the list are inserted in place of the comma at-sign expression sequence. A comma at-sign should only appear within a list or vector 〈qq template〉.

    Quasiquote forms may be nested. Substitutions are made only for unquoted components appearing at the same nesting level as the outermost backquote. The nesting level increases by one inside each successive quasiquotation, and decreases by one inside each unquotation.

    The two notations `〈qq template〉 and (quasiquote 〈qq template〉) are identical in all respects. ,〈expression〉 is identical to (unquote 〈expression〉), and ,@〈expression〉 is identical to (unquote-splicing 〈expression〉). The external syntax generated by write for two-element lists whose car is one of these symbols may vary between implementations.

    Unpredictable behavior can result if any of the symbols quasiquote, unquote, or unquote-splicing appear in positions within a 〈qq template〉 otherwise than as described above.

    (scheme r5rs) syntax (quote () ((_ datum)) )

    (quote 〈datum〉) evaluates to 〈datum〉. 〈Datum〉 may be any external representation of a Scheme object (see section 3.3). This notation is used to include literal constants in Scheme code.

    (quote 〈datum〉) may be abbreviated as ’〈datum〉. The two notations are equivalent in all respects.

    Numerical constants, string constants, character constants,and boolean constants evaluate "to themselves"; they need not be quoted.

    As noted in section 3.4, it is an error to alter a constant (i.e. the value of a literal expression) using a mutation procedure like set-car! or string-set!.

    (scheme r5rs) procedure (quotient (n1 integer?) (n2 integer?) ) ⟹ integer?

    Implements number-theoretic (integer) division. n2 should be non-zero

    (scheme r5rs) procedure (rationalize (x real?) (y real?) ) ⟹ rational?

    Rationalize returns the simplest rational number differing from x by no more than y.

    (scheme r5rs) procedure (read-char ) ⟹ eof-object? / char? /

    (scheme r5rs) procedure (read-char (port input-port?) ) ⟹ eof-object? / char? /

    Returns the next character available from the input port, updating the port to point to the following character. If no more characters are available, an end of file object is returned. Port may be omitted, in which case it defaults to the value returned by current-input-port.

    (scheme r5rs) procedure (remainder (n1 integer?) (n2 integer?) ) ⟹ integer?

    Implements number-theoretic (integer) division. n2 should be non-zero

    (scheme r5rs) procedure (reverse (list list?) ) ⟹ list?

    Returns a newly allocated list consisting of the elements of list in reverse order.

    (scheme r5rs) procedure (round (x real?) ) ⟹ integer?

    Round returns the closest integer to x, rounding to even when x is halfway between two integers.

    Rationale: Round rounds to even for consistency with the default rounding mode specified by the IEEE floating point standard.

    Note: If the argument to the procedure is inexact, then the result will also be inexact. If an exact value is needed, the result should be passed to the inexact->exact procedure.

    (scheme r5rs) syntax (set! () ((_ variable expression)) )

    〈Expression〉 is evaluated, and the resulting value is stored in the location to which 〈variable〉 is bound. 〈Variable〉 must be bound either in some region enclosing the set! expression or at top level. The result of the set! expression is unspecified.

    (scheme r5rs) procedure (set-car! (pair pair?) obj ) ⟹ undefined

    Stores obj in the car field of pair.

    (scheme r5rs) procedure (set-cdr! (pair pair?) obj ) ⟹ undefined

    Stores obj in the cdr field of pair.

    (scheme r5rs) procedure (string (char char?) ... ) ⟹ string?

    Returns a newly allocated string composed of the arguments.

    (scheme r5rs) procedure (string->list (string string?) ) ⟹ list?

    String->list returns a newly allocated list of the characters that make up the given string. String->list and list->string are inverses so far as equal? is concerned.

    (scheme r5rs) procedure (string->number (string string?) ) ⟹ number? / #f /

    (scheme r5rs) procedure (string->number (string string?) (radix integer?) ) ⟹ number? / #f /

    Returns a number of the maximally precise representation expressed by the given string. Radix must be an exact integer, either 2, 8, 10, or 16. If supplied, radix is a default radix that may be overridden by an explicit radix prefix in string (e.g. "#o177"). If radix is not supplied, then the default radix is 10. If string is not a syntactically valid notation for a number, then string->number returns #f.

    Note: The domain of string->number may be restricted by implementations in the following ways. String->number is permitted to return #f whenever string contains an explicit radix prefix. If all numbers supported by an implementation are real, then string->number is permitted to return #f whenever string uses the polar or rectangular notations for complex numbers. If all numbers are integers, then string->number may return #f whenever the fractional notation is used. If all numbers are exact, then string->number may return #f whenever an exponent marker or explicit exactness prefix is used, or if a # appears in place of a digit. If all inexact numbers are integers, then string->number may return #f whenever a decimal point is used.

    (scheme r5rs) procedure (string->symbol (string string?) ) ⟹ symbol?

    Returns the symbol whose name is string. This procedure can create symbols with names containing special characters or letters in the non-standard case, but it is usually a bad idea to create such symbols because in some implementations of Scheme they cannot be read as themselves. See symbol->string.

    (scheme r5rs) procedure (string-append (string string?) ... ) ⟹ string?

    Returns a newly allocated string whose characters form the concatenation of the given strings.

    (scheme r5rs) procedure (string-copy (string string?) ) ⟹ string?

    Returns a newly allocated copy of the given string.

    (scheme r5rs) procedure (string-fill! (string string?) (fill char?) ) ⟹ undefined

    Stores char in every element of the given string and returns an unspecified value.

    (scheme r5rs) procedure (string-length (string string?) ) ⟹ integer?

    Returns the number of characters in the given string.

    (scheme r5rs) procedure (string-ref (string string?) (k integer?) ) ⟹ char?

    k must be a valid index of string. String-ref returns character k of string using zero-origin indexing.

    (scheme r5rs) procedure (string-set! (string string?) (k integer?) (char char?) ) ⟹ undefined

    k must be a valid index of string. String-set! stores char in element k of string and returns an unspecified value.

    (scheme r5rs) procedure (string<=? (string1 string?) (string2 string?) ) ⟹ boolean?

    string<=? is the lexicographic ordering on strings induced by the ordering char<=? on characters. If two strings differ in length but are the same up to the length of the shorter string, the shorter string is considered to be lexicographically less than the longer string. Implementations may generalize the procedure to take more than two arguments, as with the corresponding numerical predicates.

    (scheme r5rs) procedure (string<? (string1 string?) (string2 string?) ) ⟹ boolean?

    string<? is the lexicographic ordering on strings induced by the ordering char<? on characters. If two strings differ in length but are the same up to the length of the shorter string, the shorter string is considered to be lexicographically less than the longer string. Implementations may generalize the procedure to take more than two arguments, as with the corresponding numerical predicates.

    (scheme r5rs) procedure (string=? (string1 string?) (string2 string?) ) ⟹ boolean?

    Returns #t if the two strings are the same length and contain the same characters in the same positions, otherwise returns #f.

    (scheme r5rs) procedure (string>=? (string1 string?) (string2 string?) ) ⟹ boolean?

    string>=? is the lexicographic ordering on strings induced by the ordering char>=? on characters. If two strings differ in length but are the same up to the length of the shorter string, the shorter string is considered to be lexicographically less than the longer string. Implementations may generalize the procedure to take more than two arguments, as with the corresponding numerical predicates.

    (scheme r5rs) procedure (string>? (string1 string?) (string2 string?) ) ⟹ boolean?

    string>? is the lexicographic ordering on strings induced by the ordering char>? on characters. If two strings differ in length but are the same up to the length of the shorter string, the shorter string is considered to be lexicographically less than the longer string. Implementations may generalize the procedure to take more than two arguments, as with the corresponding numerical predicates.

    (scheme r5rs) procedure (string? obj ) ⟹ boolean?

    Returns #t if obj is a string, otherwise returns #f

    (scheme r5rs) procedure (substring (string string?) (start integer?) (end integer?) ) ⟹ string?

    Substring returns a newly allocated string formed from the characters of string beginning with index start (inclusive) and ending with index end (exclusive).

    (scheme r5rs) procedure (symbol->string (symbol symbol?) ) ⟹ string?

    Returns the name of symbol as a string. If the symbol was part of an object returned as the value of a literal expression (section 4.1.2) or by a call to the read procedure, and its name contains alphabetic characters, then the string returned will contain characters in the implementation’s preferred standard case—some implementations will prefer upper case, others lower case. If the symbol was returned by string->symbol, the case of characters in the string returned will be the same as the case in the string that was passed to string->symbol. It is an error to apply mutation procedures like string-set! to strings returned by this procedure.

    (scheme r5rs) procedure (symbol? obj ) ⟹ boolean?

    Returns #t if obj is a symbol, otherwise returns #f.

    (scheme r5rs) syntax (syntax-rules (_ ) ((_ (literal ...) syntax-rule ...) transformer-spec) )

    (pattern template)

    _ identifier constant (pattern ...) (pattern pattern ... . pattern) (pattern ... pattern ellipsis pattern ...) (pattern ... pattern ellipsis pattern ... . pattern) #(pattern ...) #(pattern ... pattern ellipsis pattern ...)

    identifier constant (element ...) (element element ... . template) (ellipsis template) #(element ...)

    template template ellipsis

    An instance of syntax-rules produces a new macro transformer by specifying a sequence of hygienic rewrite rules. A use of a macro whose keyword is associated with a transformer specified by syntax-rules is matched against the patterns contained in the 〈syntax rule〉s, beginning with the leftmost 〈syntax rule〉. When a match is found, the macro use is transcribed hygienically according to the template.

    An identifier that appears in the pattern of a 〈syntax rule〉 is a pattern variable, unless it is the keyword that begins the pattern, is listed in 〈literals〉, or is the identifier “...”. Pattern variables match arbitrary input elements and are used to refer to elements of the input in the template. It is an error for the same pattern variable to appear more than once in a 〈pattern〉.

    The keyword at the beginning of the pattern in a 〈syntax rule〉 is not involved in the matching and is not considered a pattern variable or literal identifier.

    Rationale: The scope of the keyword is determined by the expression or syntax definition that binds it to the associated macro transformer. If the keyword were a pattern variable or literal identifier, then the template that follows the pattern would be within its scope regardless of whether the keyword were bound by let-syntax or by letrec-syntax.

    Identifiers that appear in 〈literals〉 are interpreted as literal identifiers to be matched against corresponding subforms of the input. A subform in the input matches a literal identifier if and only if it is an identifier and either both its occurrence in the macro expression and its occurrence in the macro definition have the same lexical binding, or the two identifiers are equal and both have no lexical binding.

    A subpattern followed by ... can match zero or more elements of the input. It is an error for ... to appear in 〈literals〉. Within a pattern the identifier ... must follow the last element of a nonempty sequence of subpatterns.

    More formally, an input form F matches a pattern P if and only if:

  • P is a non-literal identifier; or
  • P is a literal identifier and F is an identifier with the same binding; or
  • P is a list (P1 . . . Pn) and F is a list of n forms that match P1 through Pn, respectively; or
  • P is an improper list (P1 P2 . . . Pn . Pn+1) and F is a list or improper list of n or more forms that match P1 through Pn, respectively, and whose nth "cdr" matches Pn+1; or
  • P is of the form (P1 . . . Pn Pn+1 〈ellipsis〉) where 〈ellipsis〉 is the identifier ... and F is a proper list of at least n forms, the first n of which match P1 through Pn, respectively, and each remaining element of F matches Pn+1; or
  • P is a vector of the form #(P1 . . . Pn) and F is a vector of n forms that match P1 through Pn; or
  • P is of the form #(P1 . . . Pn Pn+1 〈ellipsis〉) where 〈ellipsis〉 is the identifier ... and F is a vector of n or more forms the first n of which match P1 through Pn, respectively, and each remaining element of F matches Pn+1; or
  • P is a datum and F is equal to P in the sense of the equal? procedure.
  • It is an error to use a macro keyword, within the scope of its binding, in an expression that does not match any of the patterns.

    When a macro use is transcribed according to the template of the matching 〈syntax rule〉, pattern variables that occur in the template are replaced by the subforms they match in the input. Pattern variables that occur in subpatterns followed by one or more instances of the identifier ... are allowed only in subtemplates that are followed by as many instances of .... They are replaced in the output by all of the subforms they match in the input, distributed as indicated. It is an error if the output cannot be built up as specified.

    Identifiers that appear in the template but are not pattern variables or the identifier ... are inserted into the output as literal identifiers. If a literal identifier is inserted as a free identifier then it refers to the binding of that identifier within whose scope the instance of syntax-rules appears. If a literal identifier is inserted as a bound identifier then it is in effect renamed to prevent inadvertent captures of free identifiers.

    (scheme r5rs) procedure (truncate (x real?) ) ⟹ integer?

    Truncate returns the integer closest to x whose absolute value is not larger than the absolute value of x. Note: If the argument to the procedure is inexact, then the result will also be inexact. If an exact value is needed, the result should be passed to the inexact->exact procedure.

    (scheme r5rs) syntax (unquote () ((_ expression)) )

    "Backquote" or "quasiquote" expressions are useful for constructing a list or vector structure when most but not all of the desired structure is known in advance. If no commas appear within the 〈qq template〉, the result of evaluating `〈qq template〉 is equivalent to the result of evaluating ’〈qq template〉. If a comma appears within the 〈qq template〉, however, the expression following the comma is evaluated ("unquoted") and its result is inserted into the structure instead of the comma and the expression. If a comma appears followed immediately by an at-sign (@), then the following expression must evaluate to a list; the opening and closing parentheses of the list are then “stripped away” and the elements of the list are inserted in place of the comma at-sign expression sequence. A comma at-sign should only appear within a list or vector 〈qq template〉.

    Quasiquote forms may be nested. Substitutions are made only for unquoted components appearing at the same nesting level as the outermost backquote. The nesting level increases by one inside each successive quasiquotation, and decreases by one inside each unquotation.

    The two notations `〈qq template〉 and (quasiquote 〈qq template〉) are identical in all respects. ,〈expression〉 is identical to (unquote 〈expression〉), and ,@〈expression〉 is identical to (unquote-splicing 〈expression〉). The external syntax generated by write for two-element lists whose car is one of these symbols may vary between implementations.

    Unpredictable behavior can result if any of the symbols quasiquote, unquote, or unquote-splicing appear in positions within a 〈qq template〉 otherwise than as described above.

    (scheme r5rs) syntax (unquote-splicing () ((_ expression)) )

    "Backquote" or "quasiquote" expressions are useful for constructing a list or vector structure when most but not all of the desired structure is known in advance. If no commas appear within the 〈qq template〉, the result of evaluating `〈qq template〉 is equivalent to the result of evaluating ’〈qq template〉. If a comma appears within the 〈qq template〉, however, the expression following the comma is evaluated ("unquoted") and its result is inserted into the structure instead of the comma and the expression. If a comma appears followed immediately by an at-sign (@), then the following expression must evaluate to a list; the opening and closing parentheses of the list are then “stripped away” and the elements of the list are inserted in place of the comma at-sign expression sequence. A comma at-sign should only appear within a list or vector 〈qq template〉.

    Quasiquote forms may be nested. Substitutions are made only for unquoted components appearing at the same nesting level as the outermost backquote. The nesting level increases by one inside each successive quasiquotation, and decreases by one inside each unquotation.

    The two notations `〈qq template〉 and (quasiquote 〈qq template〉) are identical in all respects. ,〈expression〉 is identical to (unquote 〈expression〉), and ,@〈expression〉 is identical to (unquote-splicing 〈expression〉). The external syntax generated by write for two-element lists whose car is one of these symbols may vary between implementations.

    Unpredictable behavior can result if any of the symbols quasiquote, unquote, or unquote-splicing appear in positions within a 〈qq template〉 otherwise than as described above.

    (scheme r5rs) procedure (values obj ... ) ⟹ (values *...)

    Delivers all of its arguments to its continuation. Except for continuations created by the call-with-values procedure, all continuations take exactly one value.

    (scheme r5rs) procedure (vector obj ... ) ⟹ vector?

    Returns a newly allocated vector whose elements contain the given arguments. Analogous to list.

    (scheme r5rs) procedure (vector->list (vector vector?) ) ⟹ list?

    Vector->list returns a newly allocated list of the objects contained in the elements of vector.

    (scheme r5rs) procedure (vector-fill! (vector vector?) fill ) ⟹ undefined

    Stores fill in every element of vector . The value returned by vector-fill! is unspecified.

    (scheme r5rs) procedure (vector-length (vector vector?) ) ⟹ integer?

    Returns the number of elements in vector as an exact integer.

    (scheme r5rs) procedure (vector-ref (vector vector?) (k integer?) ) ⟹ *

    k must be a valid index of vector . Vector-ref returns the contents of element k of vector .

    (scheme r5rs) procedure (vector-set! (vector vector?) (k integer?) obj ) ⟹ undefined

    k must be a valid index of vector . Vector-set! stores obj in element k of vector . The value returned by vector-set! is unspecified.

    (scheme r5rs) procedure (vector? obj ) ⟹ boolean?

    Returns #t if obj is a vector, otherwise returns #f.

    (scheme r5rs) procedure (write-char (char char?) ) ⟹ undefined

    (scheme r5rs) procedure (write-char (char char?) (port output-port?) ) ⟹ undefined

    Writes the character char (not an external representation of the character) to the given port and returns an unspecified value. The port argument may be omitted, in which case it defaults to the value returned by current-output-port.

    (scheme r5rs) procedure (char-ci<=? (char1 char?) (char2 char?) (char3 char?) ... ) ⟹ boolean?

    The procedure is similar to char<=?, but treats upper case and lower case letters as the same.

    (scheme r5rs) procedure (char-ci<? (char1 char?) (char2 char?) (char3 char?) ... ) ⟹ boolean?

    The procedure is similar to char<?, but treats upper case and lower case letters as the same.

    (scheme r5rs) procedure (char-ci=? (char1 char?) (char2 char?) (char3 char?) ... ) ⟹ boolean?

    The procedure is similar to char=?, but treats upper case and lower case letters as the same.

    (scheme r5rs) procedure (char-ci>=? (char1 char?) (char2 char?) (char3 char?) ... ) ⟹ boolean?

    The procedure is similar to char>=?, but treats upper case and lower case letters as the same.

    (scheme r5rs) procedure (char-ci>? (char1 char?) (char2 char?) (char3 char?) ... ) ⟹ boolean?

    The procedure is similar to char>?, but treats upper case and lower case letters as the same.

    (scheme r5rs) procedure (char-downcase (char char?) ) ⟹ char?

    The procedure returns a character char2 such that (char-ci=? char char2). In addition, if char is alphabetic, then the result of char-downcase is lower case.

    (scheme r5rs) procedure (char-upcase (char char?) ) ⟹ char?

    The procedure returns a character char2 such that (char-ci=? char char2). In addition, if char is alphabetic, then the result of char-upcase is upper case.

    (scheme r5rs) procedure (string-ci<=? (string1 string?) (string2 string?) ) ⟹ boolean?

    string-ci<=? is the lexicographic ordering on strings induced by the ordering char-ci<=? on characters. If two strings differ in length but are the same up to the length of the shorter string, the shorter string is considered to be lexicographically less than the longer string. Implementations may generalize the procedure to take more than two arguments, as with the corresponding numerical predicates.

    (scheme r5rs) procedure (string-ci<? (string1 string?) (string2 string?) ) ⟹ boolean?

    string-ci<? is the lexicographic ordering on strings induced by the ordering char-ci<? on characters. If two strings differ in length but are the same up to the length of the shorter string, the shorter string is considered to be lexicographically less than the longer string. Implementations may generalize the procedure to take more than two arguments, as with the corresponding numerical predicates.

    (scheme r5rs) procedure (string-ci=? (string1 string?) (string2 string?) ) ⟹ boolean?

    Returns #t if the two strings are the same length and contain the same characters in the same positions, otherwise returns #f. String-ci=? treats upper and lower case letters as though they were the same character.

    (scheme r5rs) procedure (string-ci>=? (string1 string?) (string2 string?) ) ⟹ boolean?

    string-ci>=? is the lexicographic ordering on strings induced by the ordering char-ci>=? on characters. If two strings differ in length but are the same up to the length of the shorter string, the shorter string is considered to be lexicographically less than the longer string. Implementations may generalize the procedure to take more than two arguments, as with the corresponding numerical predicates.

    (scheme r5rs) procedure (string-ci>? (string1 string?) (string2 string?) ) ⟹ boolean?

    string-ci>? is the lexicographic ordering on strings induced by the ordering char-ci>? on characters. If two strings differ in length but are the same up to the length of the shorter string, the shorter string is considered to be lexicographically less than the longer string. Implementations may generalize the procedure to take more than two arguments, as with the corresponding numerical predicates.

    (scheme r5rs) procedure (caaaar (pair pair?) ) ⟹ *

    Composition of car, car, car, car.

    (scheme r5rs) procedure (caaadr (pair pair?) ) ⟹ *

    Composition of car, car, car, cdr.

    (scheme r5rs) procedure (caaar (pair pair?) ) ⟹ *

    Composition of car, car, car.

    (scheme r5rs) procedure (caadar (pair pair?) ) ⟹ *

    Composition of car, car, cdr, car.

    (scheme r5rs) procedure (caaddr (pair pair?) ) ⟹ *

    Composition of car, car, cdr, cdr.

    (scheme r5rs) procedure (caadr (pair pair?) ) ⟹ *

    Composition of car, car, cdr.

    (scheme r5rs) procedure (cadaar (pair pair?) ) ⟹ *

    Composition of car, cdr, car, car.

    (scheme r5rs) procedure (cadadr (pair pair?) ) ⟹ *

    Composition of car, cdr, car, cdr.

    (scheme r5rs) procedure (cadar (pair pair?) ) ⟹ *

    Composition of car, cdr, car.

    (scheme r5rs) procedure (caddar (pair pair?) ) ⟹ *

    Composition of car, cdr, cdr, car.

    (scheme r5rs) procedure (cadddr (pair pair?) ) ⟹ *

    Composition of car, cdr, cdr, cdr.

    (scheme r5rs) procedure (caddr (pair pair?) ) ⟹ *

    Composition of car, cdr, cdr.

    (scheme r5rs) procedure (cdaaar (pair pair?) ) ⟹ *

    Composition of cdr, car, car, car.

    (scheme r5rs) procedure (cdaadr (pair pair?) ) ⟹ *

    Composition of cdr, car, car, cdr.

    (scheme r5rs) procedure (cdaar (pair pair?) ) ⟹ *

    Composition of cdr, car, car.

    (scheme r5rs) procedure (cdadar (pair pair?) ) ⟹ *

    Composition of cdr, car, cdr, car.

    (scheme r5rs) procedure (cdaddr (pair pair?) ) ⟹ *

    Composition of cdr, car, cdr, cdr.

    (scheme r5rs) procedure (cdadr (pair pair?) ) ⟹ *

    Composition of cdr, car, cdr.

    (scheme r5rs) procedure (cddaar (pair pair?) ) ⟹ *

    Composition of cdr, cdr, car, car.

    (scheme r5rs) procedure (cddadr (pair pair?) ) ⟹ *

    Composition of cdr, cdr, car, cdr.

    (scheme r5rs) procedure (cddar (pair pair?) ) ⟹ *

    Composition of cdr, cdr, car.

    (scheme r5rs) procedure (cdddar (pair pair?) ) ⟹ *

    Composition of cdr, cdr, cdr, car.

    (scheme r5rs) procedure (cddddr (pair pair?) ) ⟹ *

    Composition of cdr, cdr, cdr, cdr.

    (scheme r5rs) procedure (cdddr (pair pair?) ) ⟹ *

    Composition of cdr, cdr, cdr.

    (scheme r5rs) procedure (eval expr-or-def (environment-specifier environment) ) ⟹ *

    Evaluates expression in the specified environment and returns its value. Expression must be a valid Scheme expression represented as data, and environment-specifier must be a value returned by one of the three procedures described below. Implementations may extend eval to allow non-expression programs (definitions) as the first argument and to allow other values as environments, with the restriction that eval is not allowed to create new bindings in the environments associated with null-environment or scheme-report-environment.

    (scheme r5rs) procedure (scheme-report-environment (version integer?) ) ⟹ environment

    Version must be the exact integer 5, corresponding to this revision of the Scheme report (the Revised5 Report on Scheme). Scheme-report-environment returns a specifier for an environment that is empty except for all bindings defined in this report that are either required or both optional and supported by the implementation.

    Other values of version can be used to specify environments matching past revisions of this report, but their support is not required. An implementation will signal an error if version is neither 5 nor another value supported by the implementation.

    The effect of assigning (through the use of eval) a variable bound in a scheme-report-environment (for example car) is unspecified. Thus the environments specified by scheme-report-environment may be immutable.

    (scheme r5rs) procedure (null-environment (version integer?) ) ⟹ environment

    Version must be the exact integer 5, corresponding to this revision of the Scheme report (the Revised5 Report on Scheme).

    Null-environment returns a specifier for an environment that is empty except for the (syntactic) bindings for all syntactic keywords defined in this report that are either required or both optional and supported by the implementation.

    (scheme r5rs) procedure (sqrt (z number?) ) ⟹ number?

    Returns the principal square root of z. The result will have either positive real part, or zero real part and non-negative imaginary part.

    (scheme r5rs) procedure (call-with-input-file (string string?) (proc procedure?) ) ⟹ *

    (proc (port input-port?) ) ⟹ *

    String should be a string naming a file, and proc should be a procedure that accepts one argument. For call-with-input-file, the file should already exist. The procedure calls proc with one argument: the port obtained by opening the named file for input. If the file cannot be opened, an error is signalled. If proc returns, then the port is closed automatically and the value(s) yielded by the proc is(are) returned. If proc does not return, then the port will not be closed automatically unless it is possible to prove that the port will never again be used for a read or write operation.

    (scheme r5rs) procedure (call-with-output-file (string string?) (proc procedure?) ) ⟹ *

    (proc (port output-port?) ) ⟹ *

    String should be a string naming a file, and proc should be a procedure that accepts one argument. For call-with-output-file, the effect is unspecified if the file already exists. The procedure calls proc with one argument: the port obtained by opening the named file for output. If the file cannot be opened, an error is signalled. If proc returns, then the port is closed automatically and the value(s) yielded by the proc is(are) returned. If proc does not return, then the port will not be closed automatically unless it is possible to prove that the port will never again be used for a read or write operation.

    (scheme r5rs) procedure (open-input-file (string string?) ) ⟹ input-port?

    Takes a string naming an existing file and returns an input port capable of delivering characters from the file. If the file cannot be opened, an error is signalled.

    (scheme r5rs) procedure (open-output-file (string string?) ) ⟹ output-port?

    Takes a string naming an output file to be created and returns an output port capable of writing characters to a new file by that name. If the file cannot be opened, an error is signalled. If a file with the given name already exists, the effect is unspecified.

    (scheme r5rs) procedure (with-input-from-file (string string?) (thunk procedure?) ) ⟹ *

    (thunk ) ⟹ *

    String should be a string naming a file, and proc should be a procedure that accepts one argument. For call-with-input-file, the file should already exist. The file is opened for input, an input port connected to it is made the default value returned by current-input-port, and the thunk is called with no arguments. When the thunk returns, the port is closed and the previous default is restored. With-input-from-file returns the value(s) yielded by thunk . If an escape procedure is used to escape from the continuation of the procedure, its behavior is implementation dependent.

    (scheme r5rs) procedure (with-output-to-file (string string?) (thunk procedure?) ) ⟹ *

    (thunk ) ⟹ *

    String should be a string naming a file, and proc should be a procedure that accepts one argument. For call-with-output-file, the effect is unspecified if the file already exists. The file is opened for output, an output port connected to it is made the default value returned by current-output-port, and the thunk is called with no arguments. When the thunk returns, the port is closed and the previous default is restored. With-output-from-file returns the value(s) yielded by thunk . If an escape procedure is used to escape from the continuation of the procedure, its behavior is implementation dependent.

    (scheme r5rs) syntax (delay () ((_ expression) promise?) )

    The delay construct is used together with the procedure force to implement lazy evaluation or call by need. (delay 〈expression〉) returns an object called a promise which at some point in the future may be asked (by the force procedure) to evaluate 〈expression〉, and deliver the resulting value. The effect of 〈expression〉 returning multiple values is unspecified.

    (scheme r5rs) procedure (force (promise promise?) ) ⟹ *

    Forces the value of promise (see delay, section 4.2.5). If no value has been computed for the promise, then a value is computed and returned. The value of the promise is cached (or “memoized”) so that if it is forced a second time, the previously computed value is returned.

    (scheme r5rs) procedure (load (filename string?) ) ⟹ undefined

    Filename should be a string naming an existing file containing Scheme source code. The load procedure reads expressions and definitions from the file and evaluates them sequentially. It is unspecified whether the results of the expressions are printed. The load procedure does not affect the values returned by current-input-port and current-output-port. Load returns an unspecified value.

    Rationale: For portability, load must operate on source files. Its operation on other kinds of files necessarily varies among implementations.

    (scheme r5rs) procedure (read ) ⟹ *

    (scheme r5rs) procedure (read (port input-port?) ) ⟹ *

    Read converts external representations of Scheme objects into the objects themselves. That is, it is a parser for the nonterminal <datum> (see sections 7.1.2 and 6.3.2). Read returns the next object parsable from the given input port, updating port to point to the first character past the end of the external representation of the object.

    If an end of file is encountered in the input before any characters are found that can begin an object, then an end of file object is returned. The port remains open, and further attempts to read will also return an end of file object. If an end of file is encountered after the beginning of an object’s external representation, but the external representation is incomplete and therefore not parsable, an error is signalled.

    The port argument may be omitted, in which case it defaults to the value returned by current-input-port. It is an error to read from a closed port.

    (scheme r5rs) procedure (transcript-on (filename string?) ) ⟹ undefined

    Filename must be a string naming an output file to be created. The effect of transcript-on is to open the named file for output, and to cause a transcript of subsequent interaction between the user and the Scheme system to be written to the file. The transcript is ended by a call to transcript-off, which closes the transcript file. Only one transcript may be in progress at any time, though some implementations may relax this restriction. The values returned by these procedures are unspecified.

    (scheme r5rs) procedure (transcript-off ) ⟹ undefined

    Ends transcript and closes transcript file. See transcript-on.

    (scheme r5rs) procedure (display obj ) ⟹ undefined

    (scheme r5rs) procedure (display obj (port output-port?) ) ⟹ undefined

    Writes a representation of obj to the given port. Strings that appear in the written representation are not enclosed in doublequotes, and no characters are escaped within those strings. Character objects appear in the representation as if written by write-char instead of by write. Display returns an unspecified value. The port argument may be omitted, in which case it defaults to the value returned by current-output-port.

    Rationale: Write is intended for producing machine-readable output and display is for producing human-readable output. Implementations that allow “slashification” within symbols will probably want write but not display to slashify funny characters in symbols.

    (scheme r5rs) procedure (write obj ) ⟹ undefined

    (scheme r5rs) procedure (write obj (port output-port?) ) ⟹ undefined

    Writes a written representation of obj to the given port. Strings that appear in the written representation are enclosed in doublequotes, and within those strings backslash and doublequote characters are escaped by backslashes. Character objects are written using the #\ notation. Write returns an unspecified value. The port argument may be omitted, in which case it defaults to the value returned by current-output-port.

    (scheme r5rs) procedure (even? (n integer?) ) ⟹ boolean?

    (scheme r5rs) procedure (odd? (n integer?) ) ⟹ boolean?

    (scheme r5rs) procedure (zero? (z number?) ) ⟹ boolean?

    (scheme r5rs) procedure (positive? (x real?) ) ⟹ boolean?

    (scheme r5rs) procedure (negative? (x real?) ) ⟹ boolean?

    These numerical predicates test a number for a particular property, returning #t or #f.

    (scheme r5rs) procedure (acos (z number?) ) ⟹ number?

    (scheme r5rs) procedure (asin (z number?) ) ⟹ number?

    (scheme r5rs) procedure (atan (z number?) ) ⟹ number?

    (scheme r5rs) procedure (atan (y real?) (x real?) ) ⟹ number?

    (scheme r5rs) procedure (cos (z number?) ) ⟹ number?

    (scheme r5rs) procedure (exp (z number?) ) ⟹ number?

    (scheme r5rs) procedure (log (z number?) ) ⟹ number?

    (scheme r5rs) procedure (sin (z number?) ) ⟹ number?

    (scheme r5rs) procedure (tan (z number?) ) ⟹ number?

    These procedures compute the usual transcendental functions. The log procedure computes the natural logarithm of z (not the base ten logarithm) if a single argument is given, or the base-z2 logarithm of z1 if two arguments are given. The asin, acos, and atan procedures compute arcsine (sin−1), arc-cosine (cos−1), and arctangent (tan−1), respectively. The two-argument variant of atan computes (angle (make-rectangular x y)) (see below), even in implementations that don’t support complex numbers.

    In general, the mathematical functions log, arcsine, arccosine, and arctangent are multiply defined. The value of log z is defined to be the one whose imaginary part lies in the range from −π (inclusive if -0.0 is distinguished, exclusive otherwise) to π (inclusive). The value of log 0 is mathematically undefined. With log defined this way, the values of sin−1 z, cos−1 z, and tan−1 z are according to the following formulæ:

    sin^-1 z = -i log(iz + (1 - z^2)^0.5)

    cos^-1 z = pi/2 - sin^-1 z

    tan^-1 z = (log(1 + iz) - log(1 - iz)) / (2i)

    (scheme r5rs) procedure (number? obj ) ⟹ boolean?

    (scheme r5rs) procedure (complex? obj ) ⟹ boolean?

    (scheme r5rs) procedure (real? obj ) ⟹ boolean?

    (scheme r5rs) procedure (rational? obj ) ⟹ boolean?

    (scheme r5rs) procedure (integer? obj ) ⟹ boolean?

    These numerical type predicates can be applied to any kind of argument, including non-numbers. They return #t if the object is of the named type, and otherwise they return #f. In general, if a type predicate is true of a number then all higher type predicates are also true of that number. Consequently, if a type predicate is false of a number, then all lower type predicates are also false of that number. If z is an inexact complex number, then (real? z) is true if and only if (zero? (imag-part z)) is true. If x is an inexact real number, then (integer? x) is true if and only if (= x (round x)).

    (scheme r5rs) procedure (angle (z complex?) ) ⟹ real?

    (scheme r5rs) procedure (imag-part (z complex?) ) ⟹ real?

    (scheme r5rs) procedure (magnitude (z complex?) ) ⟹ real?

    (scheme r5rs) procedure (make-polar (x3 real?) (x4 real?) ) ⟹ complex?

    (scheme r5rs) procedure (make-rectangular (x1 real?) (x2 real?) ) ⟹ complex?

    (scheme r5rs) procedure (real-part (z complex?) ) ⟹ real?

    Let x1, x2, x3, and x4 be real numbers and z be a complex number such that

    z = x1 + x2i = x3 * e^(i*x4)

    Then all of

    (make-rectangular x1 x2) => z

    (make-polar x3 x4) => z

    (real-part z) => x1

    (imag-part z) => x2

    (magnitude z) => |x3|

    (angle z) =⇒ x_angle

    are true, where -pi <= x_angle <= pi with x_angle = x4 + 2*pi*n for some integer n.

    The make-polar procedure may return an inexact complex number even if its arguments are exact. The real-part and imag-part procedures may return exact real numbers when applied to an inexact complex number if the corresponding argument passed to make-rectangular was exact.

    (scheme r5rs) procedure (char-alphabetic? (char char?) ) ⟹ boolean?

    (scheme r5rs) procedure (char-numeric? (char char?) ) ⟹ boolean?

    (scheme r5rs) procedure (char-whitespace? (char char?) ) ⟹ boolean?

    (scheme r5rs) procedure (char-upper-case? (char char?) ) ⟹ boolean?

    (scheme r5rs) procedure (char-lower-case? (char char?) ) ⟹ boolean?

    These procedures return #t if their arguments are alphabetic, numeric, whitespace, upper case, or lower case characters, respectively, otherwise they return #f. The following remarks, which are specific to the ASCII character set, are intended only as a guide: The alphabetic characters are the 52 upper and lower case letters. The numeric characters are the ten decimal digits. The whitespace characters are space, tab, line feed, form feed, and carriage return.

    library (scheme box)

    (scheme box) procedure (box value ) ⟹ box?

    Constructor. Returns a newly allocated box initialized to value.

    (scheme box) procedure (box? object ) ⟹ boolean?

    Predicate. Returns #t if object is a box, and #f otherwise.

    (scheme box) procedure (unbox (box box?) ) ⟹ *

    Accessor. Returns the current value of box.

    (scheme box) procedure (set-box! (box box?) value ) ⟹ undefined

    Mutator. Changes box to hold value.

    library (scheme comparator)

    (scheme comparator) procedure (comparator? obj ) ⟹ boolean?

    Returns #t if obj is a comparator, and #f otherwise.

    (scheme comparator) procedure (comparator-ordered? (comparator comparator?) ) ⟹ boolean?

    Returns #t if comparator has a supplied ordering predicate, and #f otherwise.

    (scheme comparator) procedure (comparator-hashable? (comparator comparator?) ) ⟹ boolean?

    Returns #t if comparator has a supplied hash function, and #f otherwise.

    (scheme comparator) procedure (make-comparator (type-test procedure?) (equality procedure?) (ordering (or procedure?#f)) (hash (or procedure?#f)) ) ⟹ comparator?

    (type-test obj ) ⟹ boolean?

    (equality obj1 obj2 ) ⟹ boolean?

    (ordering obj1 obj2 ) ⟹ boolean?

    (hash obj ) ⟹ integer?

    Returns a comparator which bundles the type-test, equality, ordering, and hash procedures provided. However, if ordering or hash is #f, a procedure is provided that signals an error on application. The predicates comparator-ordered? and/or comparator-hashable?, respectively, will return #f in these cases.

    (scheme comparator) procedure (make-pair-comparator (car-comparator comparator?) (cdr-comparator comparator?) ) ⟹ comparator?

    This procedure returns comparators whose functions behave as follows.

    1 The type test returns #t if its argument is a pair, if the car satisfies the type test predicate of car-comparator, and the cdr satisfies the type test predicate of cdr-comparator.

    2 The equality function returns #t if the cars are equal according to car-comparator and the cdrs are equal according to cdr-comparator, and #f otherwise.

    3 The ordering function first compares the cars of its pairs using the equality predicate of car-comparator. If they are not equal, then the ordering predicate of car-comparator is applied to the cars and its value is returned. Otherwise, the predicate compares the cdrs using the equality predicate of cdr-comparator. If they are not equal, then the ordering predicate of cdr-comparator is applied to the cdrs and its value is returned.

    4 The hash function computes the hash values of the car and the cdr using the hash functions of car-comparator and cdr-comparator respectively and then hashes them together in an implementation-defined way.

    (scheme comparator) procedure (make-list-comparator (element-comparator comparator?) (type-test procedure?) (empty? procedure?) (head procedure?) (tail procedure?) ) ⟹ comparator?

    (type-test obj ) ⟹ boolean?

    (empty? obj ) ⟹ boolean?

    (head obj ) ⟹ *

    (tail obj ) ⟹ *

    This procedure returns comparators whose functions behave as follows:

    1 The type test returns #t if its argument satisfies type-test and the elements satisfy the type test predicate of element-comparator.

    2 The total order defined by the equality and ordering functions is as follows (known as lexicographic order):

    2.1 The empty sequence, as determined by calling empty?, compares equal to itself.

    2.2 The empty sequence compares less than any non-empty sequence.

    2.3 Two non-empty sequences are compared by calling the head procedure on each. If the heads are not equal when compared using element-comparator, the result is the result of that comparison. Otherwise, the results of calling the tail procedure are compared recursively.

    3 The hash function computes the hash values of the elements using the hash function of element-comparator and then hashes them together in an implementation-defined way.

    (scheme comparator) procedure (make-vector-comparator (element-comparator comparator?) (type-test procedure?) (length procedure?) (ref procedure?) ) ⟹ comparator?

    (type-test obj ) ⟹ boolean?

    (length obj ) ⟹ integer?

    (ref vec (index integer?) ) ⟹ *

    This procedure returns comparators whose functions behave as follows:

    1 The type test returns #t if its argument satisfies type-test and the elements satisfy the type test predicate of element-comparator.

    2 The equality predicate returns #t if both of the following tests are satisfied in order: the lengths of the vectors are the same in the sense of =, and the elements of the vectors are the same in the sense of the equality predicate of element-comparator.

    3 The ordering predicate returns #t if the results of applying length to the first vector is less than the result of applying length to the second vector. If the lengths are equal, then the elements are examined pairwise using the ordering predicate of element-comparator. If any pair of elements returns #t, then that is the result of the list comparator's ordering predicate; otherwise the result is #f

    4 The hash function computes the hash values of the elements using the hash function of element-comparator and then hashes them together in an implementation-defined way.

    (scheme comparator) procedure (make-eq-comparator ) ⟹ comparator?

    make-eq-comparator, make-eqv-comparator, make-equal-comparator These procedures return comparators whose functions behave as follows:

    1 The type test returns #t in all cases.

    2 The equality functions are eq?, eqv?, and equal? respectively.

    3 The ordering function is implementation-defined, except that it must conform to the rules for ordering functions. It may signal an error instead.

    4 The hash function is default-hash.

    (scheme comparator) procedure (make-eqv-comparator ) ⟹ comparator?

    make-eq-comparator, make-eqv-comparator, make-equal-comparator These procedures return comparators whose functions behave as follows:

    1 The type test returns #t in all cases.

    2 The equality functions are eq?, eqv?, and equal? respectively.

    3 The ordering function is implementation-defined, except that it must conform to the rules for ordering functions. It may signal an error instead.

    4 The hash function is default-hash.

    (scheme comparator) procedure (make-equal-comparator ) ⟹ comparator?

    make-eq-comparator, make-eqv-comparator, make-equal-comparator These procedures return comparators whose functions behave as follows:

    1 The type test returns #t in all cases.

    2 The equality functions are eq?, eqv?, and equal? respectively.

    3 The ordering function is implementation-defined, except that it must conform to the rules for ordering functions. It may signal an error instead.

    4 The hash function is default-hash.

    (scheme comparator) procedure (boolean-hash obj ) ⟹ integer?

    boolean-hash, char-hash, char-ci-hash string-hash, string-ci-hash, symbol-hash, number-hash These are hash functions for some standard Scheme types, suitable for passing to make-comparator. Users may write their own hash functions with the same signature. However, if programmers wish their hash functions to be backward compatible with the reference implementation of SRFI 69, they are advised to write their hash functions to accept a second argument and ignore it. These are suitable hash functions for the specified types. The hash functions char-ci-hash and string-ci-hash treat their argument case-insensitively. Note that while symbol-hash may return the hashed value of applying symbol->string and then string-hash to the symbol, this is not a requirement.

    (scheme comparator) procedure (char-hash obj ) ⟹ integer?

    boolean-hash, char-hash, char-ci-hash string-hash, string-ci-hash, symbol-hash, number-hash These are hash functions for some standard Scheme types, suitable for passing to make-comparator. Users may write their own hash functions with the same signature. However, if programmers wish their hash functions to be backward compatible with the reference implementation of SRFI 69, they are advised to write their hash functions to accept a second argument and ignore it. These are suitable hash functions for the specified types. The hash functions char-ci-hash and string-ci-hash treat their argument case-insensitively. Note that while symbol-hash may return the hashed value of applying symbol->string and then string-hash to the symbol, this is not a requirement.

    (scheme comparator) procedure (char-ci-hash obj ) ⟹ integer?

    boolean-hash, char-hash, char-ci-hash string-hash, string-ci-hash, symbol-hash, number-hash These are hash functions for some standard Scheme types, suitable for passing to make-comparator. Users may write their own hash functions with the same signature. However, if programmers wish their hash functions to be backward compatible with the reference implementation of SRFI 69, they are advised to write their hash functions to accept a second argument and ignore it. These are suitable hash functions for the specified types. The hash functions char-ci-hash and string-ci-hash treat their argument case-insensitively. Note that while symbol-hash may return the hashed value of applying symbol->string and then string-hash to the symbol, this is not a requirement.

    (scheme comparator) procedure (string-hash obj ) ⟹ integer?

    boolean-hash, char-hash, char-ci-hash string-hash, string-ci-hash, symbol-hash, number-hash These are hash functions for some standard Scheme types, suitable for passing to make-comparator. Users may write their own hash functions with the same signature. However, if programmers wish their hash functions to be backward compatible with the reference implementation of SRFI 69, they are advised to write their hash functions to accept a second argument and ignore it. These are suitable hash functions for the specified types. The hash functions char-ci-hash and string-ci-hash treat their argument case-insensitively. Note that while symbol-hash may return the hashed value of applying symbol->string and then string-hash to the symbol, this is not a requirement.

    (scheme comparator) procedure (string-ci-hash obj ) ⟹ integer?

    boolean-hash, char-hash, char-ci-hash string-hash, string-ci-hash, symbol-hash, number-hash These are hash functions for some standard Scheme types, suitable for passing to make-comparator. Users may write their own hash functions with the same signature. However, if programmers wish their hash functions to be backward compatible with the reference implementation of SRFI 69, they are advised to write their hash functions to accept a second argument and ignore it. These are suitable hash functions for the specified types. The hash functions char-ci-hash and string-ci-hash treat their argument case-insensitively. Note that while symbol-hash may return the hashed value of applying symbol->string and then string-hash to the symbol, this is not a requirement.

    (scheme comparator) procedure (symbol-hash obj ) ⟹ integer?

    boolean-hash, char-hash, char-ci-hash string-hash, string-ci-hash, symbol-hash, number-hash These are hash functions for some standard Scheme types, suitable for passing to make-comparator. Users may write their own hash functions with the same signature. However, if programmers wish their hash functions to be backward compatible with the reference implementation of SRFI 69, they are advised to write their hash functions to accept a second argument and ignore it. These are suitable hash functions for the specified types. The hash functions char-ci-hash and string-ci-hash treat their argument case-insensitively. Note that while symbol-hash may return the hashed value of applying symbol->string and then string-hash to the symbol, this is not a requirement.

    (scheme comparator) procedure (number-hash obj ) ⟹ integer?

    boolean-hash, char-hash, char-ci-hash string-hash, string-ci-hash, symbol-hash, number-hash These are hash functions for some standard Scheme types, suitable for passing to make-comparator. Users may write their own hash functions with the same signature. However, if programmers wish their hash functions to be backward compatible with the reference implementation of SRFI 69, they are advised to write their hash functions to accept a second argument and ignore it. These are suitable hash functions for the specified types. The hash functions char-ci-hash and string-ci-hash treat their argument case-insensitively. Note that while symbol-hash may return the hashed value of applying symbol->string and then string-hash to the symbol, this is not a requirement.

    (scheme comparator) syntax (hash-bound () ((_) integer?) )

    Hash functions should be written so as to return a number between 0 and the largest reasonable number of elements (such as hash buckets) a data structure in the implementation might have. What that value is depends on the implementation. This value provides the current bound as a positive exact integer, typically for use by user-written hash functions. However, they are not required to bound their results in this way.

    (scheme comparator) syntax (hash-salt () ((_) integer?) )

    A salt is random data in the form of a non-negative exact integer used as an additional input to a hash function in order to defend against dictionary attacks, or (when used in hash tables) against denial-of-service attacks that overcrowd certain hash buckets, increasing the amortized O(1) lookup time to O(n). Salt can also be used to specify which of a family of hash functions should be used for purposes such as cuckoo hashing. This macro provides the current value of the salt, typically for use by user-written hash functions. However, they are not required to make use of the current salt.

    The initial value is implementation-dependent, but must be less than the value of (hash-bound), and should be distinct for distinct runs of a program unless otherwise specified by the implementation. Implementations may provide a means to specify the salt value to be used by a particular invocation of a hash function.

    (scheme comparator) procedure (make-default-comparator ) ⟹ comparator?

    Returns a comparator known as a default comparator that accepts Scheme values and orders them in some implementation-defined way, subject to the following conditions:

    1 Given disjoint types a and b, one of three conditions must hold:

    1.1 All objects of type a compare less than all objects of type b.

    1.2 All objects of type a compare greater than all objects of type b.

    1.3 All objects of both type a and type b compare equal to each other. This is not permitted for any of the Scheme types mentioned below.

    2 The empty list must be ordered before all pairs.

    3 When comparing booleans, it must use the total order #f < #t.

    4 When comparing characters, it must use char=? and char<?. Note: In R5RS, this is an implementation-dependent order that is typically the same as Unicode codepoint order; in R6RS and R7RS, it is Unicode codepoint order.

    5 When comparing pairs, it must behave the same as a comparator returned by make-pair-comparator with default comparators as arguments.

    6 When comparing symbols, it must use an implementation-dependent total order. One possibility is to use the order obtained by applying symbol->string to the symbols and comparing them using the total order implied by string<?.

    7 When comparing bytevectors, it must behave the same as a comparator created by the expression (make-vector-comparator (make-comparator bytevector? = < number-hash) bytevector? bytevector-length bytevector-u8-ref).

    8 When comparing numbers where either number is complex, since non-real numbers cannot be compared with <, the following least-surprising ordering is defined: If the real parts are < or >, so are the numbers; otherwise, the numbers are ordered by their imaginary parts. This can still produce somewhat surprising results if one real part is exact and the other is inexact.

    9 When comparing real numbers, it must use = and <.

    10 When comparing strings, it must use string=? and string<?. Note: In R5RS, this is lexicographic order on the implementation-dependent order defined by char<?; in R6RS it is lexicographic order on Unicode codepoint order; in R7RS it is an implementation-defined order.

    11 When comparing vectors, it must behave the same as a comparator returned by (make-vector-comparator (make-default-comparator) vector? vector-length vector-ref).

    12 When comparing members of types registered with comparator-register-default!, it must behave in the same way as the comparator registered using that function.

    Default comparators use default-hash as their hash function.

    (scheme comparator) procedure (default-hash obj ) ⟹ integer?

    This is the hash function used by default comparators, which accepts a Scheme value and hashes it in some implementation-defined way, subject to the following conditions:

    1 When applied to a pair, it must return the result of hashing together the values returned by default-hash when applied to the car and the cdr.

    2 When applied to a boolean, character, string, symbol, or number, it must return the same result as boolean-hash, char-hash, string-hash, symbol-hash, or number-hash respectively.

    3 When applied to a list or vector, it must return the result of hashing together the values returned by default-hash when applied to each of the elements.

    (scheme comparator) procedure (comparator-register-default! (comparator comparator?) ) ⟹ undefined

    Registers comparator for use by default comparators, such that if the objects being compared both satisfy the type test predicate of comparator, it will be employed by default comparators to compare them. Returns an unspecified value. It is an error if any value satisfies both the type test predicate of comparator and any of the following type test predicates: boolean?, char?, null?, pair?, symbol?, bytevector?, number?, string?, vector?, or the type test predicate of a comparator that has already been registered.

    This procedure is intended only to extend default comparators into territory that would otherwise be undefined, not to override their existing behavior. In general, the ordering of calls to comparator-register-default! should be irrelevant. However, implementations that support inheritance of record types may wish to ensure that default comparators always check subtypes before supertypes.

    This SRFI recommends (but does not require) that libraries which expose comparators do not register them with this procedure, because the default comparator (which is meant mostly for ad hoc programming) is meant to be under the control of the program author rather than the library author. It is the program author's responsibility to ensure that the registered comparators do not conflict with each other.

    (scheme comparator) procedure (comparator-type-test-predicate (comparator comparator?) ) ⟹ procedure?

    (return obj ) ⟹ boolean?

    (scheme comparator) procedure (comparator-equality-predicate (comparator comparator?) ) ⟹ procedure?

    (return obj1 obj2 ) ⟹ boolean?

    (scheme comparator) procedure (comparator-ordering-predicate (comparator comparator?) ) ⟹ #f / procedure? /

    (return obj1 obj2 ) ⟹ boolean?

    (scheme comparator) procedure (comparator-hash-function (comparator comparator?) ) ⟹ #f / procedure? /

    (return obj ) ⟹ integer?

    Return the four procedures of comparator.

    (scheme comparator) procedure (comparator-test-type (comparator comparator?) obj ) ⟹ boolean?

    Invokes the type test predicate of comparator on obj and returns what it returns. More convenient than comparator-type-test-predicate, but less efficient when the predicate is called repeatedly.

    (scheme comparator) procedure (comparator-check-type (comparator comparator?) obj ) ⟹ boolean?

    Invokes the type test predicate of comparator on obj and returns true if it returns true, but signals an error otherwise. More convenient than comparator-type-test-predicate, but less efficient when the predicate is called repeatedly.

    (scheme comparator) procedure (comparator-hash (comparator comparator?) obj ) ⟹ integer?

    Invokes the hash function of comparator on obj and returns what it returns. More convenient than comparator-hash-function, but less efficient when the function is called repeatedly. Note: No invokers are required for the equality and ordering predicates, because =? and <? serve this function.

    (scheme comparator) procedure (=? (comparator comparator?) object1 object2 object3 ... ) ⟹ boolean?

    =?, <?, >?, <=?, >=? These procedures are analogous to the number, character, and string comparison predicates of Scheme. They allow the convenient use of comparators to handle variable data types.

    These procedures apply the equality and ordering predicates of comparator to the objects as follows. If the specified relation returns #t for all objecti and objectj where n is the number of objects and 1 <= i < j <= n, then the procedures return #t, but otherwise #f. Because the relations are transitive, it suffices to compare each object with its successor. The order in which the values are compared is unspecified.

    (scheme comparator) procedure (<? (comparator comparator?) object1 object2 object3 ... ) ⟹ boolean?

    =?, <?, >?, <=?, >=? These procedures are analogous to the number, character, and string comparison predicates of Scheme. They allow the convenient use of comparators to handle variable data types.

    These procedures apply the equality and ordering predicates of comparator to the objects as follows. If the specified relation returns #t for all objecti and objectj where n is the number of objects and 1 <= i < j <= n, then the procedures return #t, but otherwise #f. Because the relations are transitive, it suffices to compare each object with its successor. The order in which the values are compared is unspecified.

    (scheme comparator) procedure (>? (comparator comparator?) object1 object2 object3 ... ) ⟹ boolean?

    =?, <?, >?, <=?, >=? These procedures are analogous to the number, character, and string comparison predicates of Scheme. They allow the convenient use of comparators to handle variable data types.

    These procedures apply the equality and ordering predicates of comparator to the objects as follows. If the specified relation returns #t for all objecti and objectj where n is the number of objects and 1 <= i < j <= n, then the procedures return #t, but otherwise #f. Because the relations are transitive, it suffices to compare each object with its successor. The order in which the values are compared is unspecified.

    (scheme comparator) procedure (<=? (comparator comparator?) object1 object2 object3 ... ) ⟹ boolean?

    =?, <?, >?, <=?, >=? These procedures are analogous to the number, character, and string comparison predicates of Scheme. They allow the convenient use of comparators to handle variable data types.

    These procedures apply the equality and ordering predicates of comparator to the objects as follows. If the specified relation returns #t for all objecti and objectj where n is the number of objects and 1 <= i < j <= n, then the procedures return #t, but otherwise #f. Because the relations are transitive, it suffices to compare each object with its successor. The order in which the values are compared is unspecified.

    (scheme comparator) procedure (>=? (comparator comparator?) object1 object2 object3 ... ) ⟹ boolean?

    =?, <?, >?, <=?, >=? These procedures are analogous to the number, character, and string comparison predicates of Scheme. They allow the convenient use of comparators to handle variable data types.

    These procedures apply the equality and ordering predicates of comparator to the objects as follows. If the specified relation returns #t for all objecti and objectj where n is the number of objects and 1 <= i < j <= n, then the procedures return #t, but otherwise #f. Because the relations are transitive, it suffices to compare each object with its successor. The order in which the values are compared is unspecified.

    (scheme comparator) syntax (comparator-if<=> () ((_ comparator object1 object2 less-than equal-to greater-than)) ((_ object1 object2 less-than equal-to greater-than)) )

    comparator ⟹ comparator?

    It is an error unless <comparator> evaluates to a comparator and <object1> and <object2> evaluate to objects that the comparator can handle. If the ordering predicate returns true when applied to the values of <object1> and <object2> in that order, then <less-than> is evaluated and its value returned. If the equality predicate returns true when applied in the same way, then <equal-to> is evaluated and its value returned. If neither returns true, <greater-than> is evaluated and its value returned.

    If <comparator> is omitted, a default comparator is used.

    library (scheme charset)

    (scheme charset) procedure (char-set? obj ) ⟹ boolean?

    Is the object obj a character set?

    (scheme charset) procedure (char-set= (cs1 char-set?) ... ) ⟹ boolean?

    Are the character sets equal?

    Boundary cases:

    (char-set=) => true

    (char-set= cs) => true

    Rationale: transitive binary relations are generally extended to n-ary relations in Scheme, which enables clearer, more concise code to be written. While the zero-argument and one-argument cases will almost certainly not arise in first-order uses of such relations, they may well arise in higher-order cases or macro-generated code. E.g., consider

    (apply char-set= cset-list)

    This is well-defined if the list is empty or a singleton list. Hence we extend these relations to any number of arguments. Implementors have reported actual uses of n-ary relations in higher-order cases allowing for fewer than two arguments. The way of Scheme is to handle the general case; we provide the fully general extension.

    A counter-argument to this extension is that R5RS's transitive binary arithmetic relations (=, <, etc.) require at least two arguments, hence this decision is a break with the prior convention -- although it is at least one that is backwards-compatible.

    (scheme charset) procedure (char-set<= (cs1 char-set?) ... ) ⟹ boolean?

    Returns true if every character set csi is a subset of character set csi+1.

    Boundary cases:

    (char-set<=) => true

    (char-set<= cs) => true

    Rationale: See char-set= for discussion of zero- and one-argument applications. Consider testing a list of char-sets for monotonicity with

    (apply char-set<= cset-list)

    (scheme charset) procedure (char-set-hash (cs char-set?) ) ⟹ integer?

    (scheme charset) procedure (char-set-hash (cs char-set?) (bound integer?) ) ⟹ integer?

    Compute a hash value for the character set cs. Bound is a non-negative exact integer specifying the range of the hash function. A positive value restricts the return value to the range [0,bound).

    If bound is either zero or not given, the implementation may use an implementation-specific default value, chosen to be as large as is efficiently practical. For instance, the default range might be chosen for a given implementation to map all strings into the range of integers that can be represented with a single machine word.

    Invariant:

    (char-set= cs1 cs2) => (= (char-set-hash cs1 b) (char-set-hash cs2 b))

    A legal but nonetheless discouraged implementation:

    (define (char-set-hash cs . maybe-bound) 1)

    Rationale: allowing the user to specify an explicit bound simplifies user code by removing the mod operation that typically accompanies every hash computation, and also may allow the implementation of the hash function to exploit a reduced range to efficiently compute the hash value. E.g., for small bounds, the hash function may be computed in a fashion such that intermediate values never overflow into bignum integers, allowing the implementor to provide a fixnum-specific "fast path" for computing the common cases very rapidly.

    (scheme charset) procedure (char-set-cursor (cset char-set?) ) ⟹ *

    (shared description for char-set-cursor, char-set-ref, char-set-cursor-next, end-of-char-set?)

    Cursors are a low-level facility for iterating over the characters in a set. A cursor is a value that indexes a character in a char set. char-set-cursor produces a new cursor for a given char set. The set element indexed by the cursor is fetched with char-set-ref. A cursor index is incremented with char-set-cursor-next; in this way, code can step through every character in a char set. Stepping a cursor "past the end" of a char set produces a cursor that answers true to end-of-char-set?. It is an error to pass such a cursor to char-set-ref or to char-set-cursor-next.

    A cursor value may not be used in conjunction with a different character set; if it is passed to char-set-ref or char-set-cursor-next with a character set other than the one used to create it, the results and effects are undefined.

    Cursor values are not necessarily distinct from other types. They may be integers, linked lists, records, procedures or other values. This license is granted to allow cursors to be very "lightweight" values suitable for tight iteration, even in fairly simple implementations.

    Note that these primitives are necessary to export an iteration facility for char sets to loop macros.

    Rationale: Note that the cursor API's four functions "fit" the functional protocol used by the unfolders provided by the list, string and char-set SRFIs (see the example above). By way of contrast, here is a simpler, two-function API that was rejected for failing this criterion. Besides char-set-cursor, it provided a single function that mapped a cursor and a character set to two values, the indexed character and the next cursor. If the cursor had exhausted the character set, then this function returned false instead of the character value, and another end-of-char-set cursor. In this way, the other three functions of the current API were combined together.

    (scheme charset) procedure (char-set-ref (cset char-set?) cursor ) ⟹ char?

    (shared description for char-set-cursor, char-set-ref, char-set-cursor-next, end-of-char-set?)

    Cursors are a low-level facility for iterating over the characters in a set. A cursor is a value that indexes a character in a char set. char-set-cursor produces a new cursor for a given char set. The set element indexed by the cursor is fetched with char-set-ref. A cursor index is incremented with char-set-cursor-next; in this way, code can step through every character in a char set. Stepping a cursor "past the end" of a char set produces a cursor that answers true to end-of-char-set?. It is an error to pass such a cursor to char-set-ref or to char-set-cursor-next.

    A cursor value may not be used in conjunction with a different character set; if it is passed to char-set-ref or char-set-cursor-next with a character set other than the one used to create it, the results and effects are undefined.

    Cursor values are not necessarily distinct from other types. They may be integers, linked lists, records, procedures or other values. This license is granted to allow cursors to be very "lightweight" values suitable for tight iteration, even in fairly simple implementations.

    Note that these primitives are necessary to export an iteration facility for char sets to loop macros.

    Rationale: Note that the cursor API's four functions "fit" the functional protocol used by the unfolders provided by the list, string and char-set SRFIs (see the example above). By way of contrast, here is a simpler, two-function API that was rejected for failing this criterion. Besides char-set-cursor, it provided a single function that mapped a cursor and a character set to two values, the indexed character and the next cursor. If the cursor had exhausted the character set, then this function returned false instead of the character value, and another end-of-char-set cursor. In this way, the other three functions of the current API were combined together.

    (scheme charset) procedure (char-set-cursor-next (cset char-set?) cursor ) ⟹ *

    (shared description for char-set-cursor, char-set-ref, char-set-cursor-next, end-of-char-set?)

    Cursors are a low-level facility for iterating over the characters in a set. A cursor is a value that indexes a character in a char set. char-set-cursor produces a new cursor for a given char set. The set element indexed by the cursor is fetched with char-set-ref. A cursor index is incremented with char-set-cursor-next; in this way, code can step through every character in a char set. Stepping a cursor "past the end" of a char set produces a cursor that answers true to end-of-char-set?. It is an error to pass such a cursor to char-set-ref or to char-set-cursor-next.

    A cursor value may not be used in conjunction with a different character set; if it is passed to char-set-ref or char-set-cursor-next with a character set other than the one used to create it, the results and effects are undefined.

    Cursor values are not necessarily distinct from other types. They may be integers, linked lists, records, procedures or other values. This license is granted to allow cursors to be very "lightweight" values suitable for tight iteration, even in fairly simple implementations.

    Note that these primitives are necessary to export an iteration facility for char sets to loop macros.

    Rationale: Note that the cursor API's four functions "fit" the functional protocol used by the unfolders provided by the list, string and char-set SRFIs (see the example above). By way of contrast, here is a simpler, two-function API that was rejected for failing this criterion. Besides char-set-cursor, it provided a single function that mapped a cursor and a character set to two values, the indexed character and the next cursor. If the cursor had exhausted the character set, then this function returned false instead of the character value, and another end-of-char-set cursor. In this way, the other three functions of the current API were combined together.

    (scheme charset) procedure (end-of-char-set? cursor ) ⟹ boolean?

    (shared description for char-set-cursor, char-set-ref, char-set-cursor-next, end-of-char-set?)

    Cursors are a low-level facility for iterating over the characters in a set. A cursor is a value that indexes a character in a char set. char-set-cursor produces a new cursor for a given char set. The set element indexed by the cursor is fetched with char-set-ref. A cursor index is incremented with char-set-cursor-next; in this way, code can step through every character in a char set. Stepping a cursor "past the end" of a char set produces a cursor that answers true to end-of-char-set?. It is an error to pass such a cursor to char-set-ref or to char-set-cursor-next.

    A cursor value may not be used in conjunction with a different character set; if it is passed to char-set-ref or char-set-cursor-next with a character set other than the one used to create it, the results and effects are undefined.

    Cursor values are not necessarily distinct from other types. They may be integers, linked lists, records, procedures or other values. This license is granted to allow cursors to be very "lightweight" values suitable for tight iteration, even in fairly simple implementations.

    Note that these primitives are necessary to export an iteration facility for char sets to loop macros.

    Rationale: Note that the cursor API's four functions "fit" the functional protocol used by the unfolders provided by the list, string and char-set SRFIs (see the example above). By way of contrast, here is a simpler, two-function API that was rejected for failing this criterion. Besides char-set-cursor, it provided a single function that mapped a cursor and a character set to two values, the indexed character and the next cursor. If the cursor had exhausted the character set, then this function returned false instead of the character value, and another end-of-char-set cursor. In this way, the other three functions of the current API were combined together.

    (scheme charset) procedure (char-set-fold (kons procedure?) knil (cs char-set?) ) ⟹ *

    (kons (c char?) state ) ⟹ *

    This is the fundamental iterator for character sets. Applies the function kons across the character set cs using initial state value knil. That is, if cs is the empty set, the procedure returns knil. Otherwise, some element c of cs is chosen; let cs' be the remaining, unchosen characters. The procedure returns

    (char-set-fold kons (kons c knil) cs')

    (scheme charset) procedure (char-set-unfold (f procedure?) (p procedure?) (g procedure?) seed ) ⟹ char-set?

    (scheme charset) procedure (char-set-unfold (f procedure?) (p procedure?) (g procedure?) seed (base-cs char-set?) ) ⟹ char-set?

    (f seed ) ⟹ char?

    (p seed ) ⟹ boolean?

    (g seed ) ⟹ *

    (shared description for char-set-unfold, char-set-unfold!) This is a fundamental constructor for char-sets.

  • G is used to generate a series of "seed" values from the initial seed: seed, (g seed), (g2 seed), (g3 seed), ...
  • P tells us when to stop -- when it returns true when applied to one of these seed values.
  • F maps each seed value to a character. These characters are added to the base character set base-cs to form the result; base-cs defaults to the empty set. char-set-unfold! adds the characters to base-cs in a linear-update -- it is allowed, but not required, to side-effect and use base-cs's storage to construct the result.
  • (scheme charset) procedure (char-set-unfold! (f procedure?) (p procedure?) (g procedure?) seed (base-cs char-set?) ) ⟹ char-set?

    (f seed ) ⟹ char?

    (p seed ) ⟹ boolean?

    (g seed ) ⟹ *

    (shared description for char-set-unfold, char-set-unfold!) This is a fundamental constructor for char-sets.

  • G is used to generate a series of "seed" values from the initial seed: seed, (g seed), (g2 seed), (g3 seed), ...
  • P tells us when to stop -- when it returns true when applied to one of these seed values.
  • F maps each seed value to a character. These characters are added to the base character set base-cs to form the result; base-cs defaults to the empty set. char-set-unfold! adds the characters to base-cs in a linear-update -- it is allowed, but not required, to side-effect and use base-cs's storage to construct the result.
  • (scheme charset) procedure (char-set-for-each (proc procedure?) (cs char-set?) ) ⟹ undefined

    (proc (c char?) ) ⟹ undefined

    Apply procedure proc to each character in the character set cs. Note that the order in which proc is applied to the characters in the set is not specified, and may even change from one procedure application to another.

    Nothing at all is specified about the value returned by this procedure; it is not even required to be consistent from call to call. It is simply required to be a value (or values) that may be passed to a command continuation, e.g. as the value of an expression appearing as a non-terminal subform of a begin expression. Note that in R5RS, this restricts the procedure to returning a single value; non-R5RS systems may not even provide this restriction.

    (scheme charset) procedure (char-set-map (proc procedure?) (cs char-set?) ) ⟹ char-set?

    (proc (c char?) ) ⟹ char?

    proc is a char->char procedure. Apply it to all the characters in the char-set cs, and collect the results into a new character set.

    Essentially lifts proc from a char->char procedure to a char-set -> char-set procedure.

    (scheme charset) procedure (char-set-copy (cs char-set?) ) ⟹ char-set?

    Returns a copy of the character set cs. "Copy" means that if either the input parameter or the result value of this procedure is passed to one of the linear-update procedures described below, the other character set is guaranteed not to be altered.

    A system that provides pure-functional implementations of the linear-operator suite could implement this procedure as the identity function -- so copies are not guaranteed to be distinct by eq?.

    (scheme charset) procedure (char-set (char1 char?) ... ) ⟹ char-set?

    Return a character set containing the given characters.

    (scheme charset) procedure (list->char-set (char-list list?) ) ⟹ char-set?

    (scheme charset) procedure (list->char-set (char-list list?) (base-cs char-set?) ) ⟹ char-set?

    (shared description for list->char-set, list->char-set!) Return a character set containing the characters in the list of characters char-list.

    If character set base-cs is provided, the characters from char-list are added to it. list->char-set! is allowed, but not required, to side-effect and reuse the storage in base-cs; list->char-set produces a fresh character set.

    (scheme charset) procedure (list->char-set! (char-list list?) (base-cs char-set?) ) ⟹ char-set?

    (shared description for list->char-set, list->char-set!) Return a character set containing the characters in the list of characters char-list.

    If character set base-cs is provided, the characters from char-list are added to it. list->char-set! is allowed, but not required, to side-effect and reuse the storage in base-cs; list->char-set produces a fresh character set.

    (scheme charset) procedure (string->char-set (s string?) ) ⟹ char-set?

    (scheme charset) procedure (string->char-set (s string?) (base-cs char-set?) ) ⟹ char-set?

    (shared description for string->char-set, string->char-set!) Return a character set containing the characters in the string s.

    If character set base-cs is provided, the characters from s are added to it. string->char-set! is allowed, but not required, to side-effect and reuse the storage in base-cs; string->char-set produces a fresh character set.

    (scheme charset) procedure (string->char-set! (s string?) (base-cs char-set?) ) ⟹ char-set?

    (shared description for string->char-set, string->char-set!) Return a character set containing the characters in the string s.

    If character set base-cs is provided, the characters from s are added to it. string->char-set! is allowed, but not required, to side-effect and reuse the storage in base-cs; string->char-set produces a fresh character set.

    (scheme charset) procedure (char-set-filter (pred procedure?) (cs char-set?) ) ⟹ char-set?

    (scheme charset) procedure (char-set-filter (pred procedure?) (cs char-set?) (base-cs char-set?) ) ⟹ char-set?

    (pred (c char?) ) ⟹ boolean?

    (shared description for char-set-filter, char-set-filter!) Returns a character set containing every character c in cs such that (pred c) returns true.

    If character set base-cs is provided, the characters specified by pred are added to it. char-set-filter! is allowed, but not required, to side-effect and reuse the storage in base-cs; char-set-filter produces a fresh character set.

    An implementation may not save away a reference to pred and invoke it after char-set-filter or char-set-filter! returns -- that is, "lazy", on-demand implementations are not allowed, as pred may have external dependencies on mutable data or have other side-effects.

    Rationale: This procedure provides a means of converting a character predicate into its equivalent character set; the cs parameter allows the programmer to bound the predicate's domain. Programmers should be aware that filtering a character set such as char-set:full could be a very expensive operation in an implementation that provided an extremely large character type, such as 32-bit Unicode. An earlier draft of this library provided a simple predicate->char-set procedure, which was rejected in favor of char-set-filter for this reason.

    (scheme charset) procedure (char-set-filter! (pred procedure?) (cs char-set?) (base-cs char-set?) ) ⟹ char-set?

    (pred (c char?) ) ⟹ boolean?

    (shared description for char-set-filter, char-set-filter!) Returns a character set containing every character c in cs such that (pred c) returns true.

    If character set base-cs is provided, the characters specified by pred are added to it. char-set-filter! is allowed, but not required, to side-effect and reuse the storage in base-cs; char-set-filter produces a fresh character set.

    An implementation may not save away a reference to pred and invoke it after char-set-filter or char-set-filter! returns -- that is, "lazy", on-demand implementations are not allowed, as pred may have external dependencies on mutable data or have other side-effects.

    Rationale: This procedure provides a means of converting a character predicate into its equivalent character set; the cs parameter allows the programmer to bound the predicate's domain. Programmers should be aware that filtering a character set such as char-set:full could be a very expensive operation in an implementation that provided an extremely large character type, such as 32-bit Unicode. An earlier draft of this library provided a simple predicate->char-set procedure, which was rejected in favor of char-set-filter for this reason.

    (scheme charset) procedure (ucs-range->char-set (lower integer?) (upper integer?) ) ⟹ char-set?

    (scheme charset) procedure (ucs-range->char-set (lower integer?) (upper integer?) (error? boolean?) ) ⟹ char-set?

    (scheme charset) procedure (ucs-range->char-set (lower integer?) (upper integer?) (error? boolean?) (base-cs char-set?) ) ⟹ char-set?

    (shared description for ucs-range->char-set, ucs-range->char-set!) Lower and upper are exact non-negative integers; lower <= upper.

    Returns a character set containing every character whose ISO/IEC 10646 UCS-4 code lies in the half-open range [lower,upper).

    * If the requested range includes unassigned UCS values, these are silently ignored (the current UCS specification has "holes" in the space of assigned codes).

    * If the requested range includes "private" or "user space" codes, these are handled in an implementation-specific manner; however, a UCS- or Unicode-based Scheme implementation should pass them through transparently.

    * If any code from the requested range specifies a valid, assigned UCS character that has no corresponding representative in the implementation's character type, then (1) an error is raised if error? is true, and (2) the code is ignored if error? is false (the default). This might happen, for example, if the implementation uses ASCII characters, and the requested range includes non-ASCII characters.

    If character set base-cs is provided, the characters specified by the range are added to it. ucs-range->char-set! is allowed, but not required, to side-effect and reuse the storage in base-cs; ucs-range->char-set produces a fresh character set.

    Note that ASCII codes are a subset of the Latin-1 codes, which are in turn a subset of the 16-bit Unicode codes, which are themselves a subset of the 32-bit UCS-4 codes. We commit to a specific encoding in this routine, regardless of the underlying representation of characters, so that client code using this library will be portable. I.e., a conformant Scheme implementation may use EBCDIC or SHIFT-JIS to encode characters; it must simply map the UCS characters from the given range into the native representation when possible, and report errors when not possible.

    (scheme charset) procedure (ucs-range->char-set! (lower integer?) (upper integer?) (error? boolean?) (base-cs char-set?) ) ⟹ char-set?

    (shared description for ucs-range->char-set, ucs-range->char-set!) Lower and upper are exact non-negative integers; lower <= upper.

    Returns a character set containing every character whose ISO/IEC 10646 UCS-4 code lies in the half-open range [lower,upper).

    * If the requested range includes unassigned UCS values, these are silently ignored (the current UCS specification has "holes" in the space of assigned codes).

    * If the requested range includes "private" or "user space" codes, these are handled in an implementation-specific manner; however, a UCS- or Unicode-based Scheme implementation should pass them through transparently.

    * If any code from the requested range specifies a valid, assigned UCS character that has no corresponding representative in the implementation's character type, then (1) an error is raised if error? is true, and (2) the code is ignored if error? is false (the default). This might happen, for example, if the implementation uses ASCII characters, and the requested range includes non-ASCII characters.

    If character set base-cs is provided, the characters specified by the range are added to it. ucs-range->char-set! is allowed, but not required, to side-effect and reuse the storage in base-cs; ucs-range->char-set produces a fresh character set.

    Note that ASCII codes are a subset of the Latin-1 codes, which are in turn a subset of the 16-bit Unicode codes, which are themselves a subset of the 32-bit UCS-4 codes. We commit to a specific encoding in this routine, regardless of the underlying representation of characters, so that client code using this library will be portable. I.e., a conformant Scheme implementation may use EBCDIC or SHIFT-JIS to encode characters; it must simply map the UCS characters from the given range into the native representation when possible, and report errors when not possible.

    (scheme charset) procedure (->char-set (x string?) ) ⟹ char-set?

    (scheme charset) procedure (->char-set (x char?) ) ⟹ char-set?

    (scheme charset) procedure (->char-set (x char-set?) ) ⟹ char-set?

    Coerces x into a char-set. X may be a string, character or char-set. A string is converted to the set of its constituent characters; a character is converted to a singleton set; a char-set is returned as-is. This procedure is intended for use by other procedures that want to provide "user-friendly", wide-spectrum interfaces to their clients.

    (scheme charset) procedure (char-set-size (cs char-set?) ) ⟹ integer?

    Returns the number of elements in character set cs.

    (scheme charset) procedure (char-set-count (pred procedure?) (cs char-set?) ) ⟹ integer?

    (pred (c char?) ) ⟹ boolean?

    Apply pred to the chars of character set cs, and return the number of chars that caused the predicate to return true.

    (scheme charset) procedure (char-set->list (cs char-set?) ) ⟹ list?

    This procedure returns a list of the members of character set cs. The order in which cs's characters appear in the list is not defined, and may be different from one call to another.

    (scheme charset) procedure (char-set->string (cs char-set?) ) ⟹ string?

    This procedure returns a string containing the members of character set cs. The order in which cs's characters appear in the string is not defined, and may be different from one call to another.

    (scheme charset) procedure (char-set-contains? (cs char-set?) (char char?) ) ⟹ boolean?

    This procedure tests char for membership in character set cs.

    The MIT Scheme character-set package called this procedure char-set-member?, but the argument order isn't consistent with the name.

    (scheme charset) procedure (char-set-every (pred procedure?) (cs char-set?) ) ⟹ boolean?

    (pred (c char?) ) ⟹ boolean?

    (shared description for char-set-every, char-set-any) The char-set-every procedure returns true if predicate pred returns true of every character in the character set cs. Likewise, char-set-any applies pred to every character in character set cs, and returns the first true value it finds. If no character produces a true value, it returns false. The order in which these procedures sequence through the elements of cs is not specified.

    Note that if you need to determine the actual character on which a predicate returns true, use char-set-any and arrange for the predicate to return the character parameter as its true value

    (scheme charset) procedure (char-set-any (pred procedure?) (cs char-set?) ) ⟹ boolean?

    (pred (c char?) ) ⟹ boolean?

    (shared description for char-set-every, char-set-any) The char-set-every procedure returns true if predicate pred returns true of every character in the character set cs. Likewise, char-set-any applies pred to every character in character set cs, and returns the first true value it finds. If no character produces a true value, it returns false. The order in which these procedures sequence through the elements of cs is not specified.

    Note that if you need to determine the actual character on which a predicate returns true, use char-set-any and arrange for the predicate to return the character parameter as its true value

    (scheme charset) procedure (char-set-adjoin (cs char-set?) (char1 char?) ... ) ⟹ char-set?

    Add the chari characters to character set cs.

    (scheme charset) procedure (char-set-delete (cs char-set?) (char1 char?) ... ) ⟹ char-set?

    Delete the chari characters from character set cs.

    (scheme charset) procedure (char-set-adjoin! (cs char-set?) (char1 char?) ... ) ⟹ char-set?

    Add the chari characters to character set cs. Linear-update variant. The procedure is allowed, but not required, to side-effect its first parameter.

    (scheme charset) procedure (char-set-delete! (cs char-set?) (char1 char?) ... ) ⟹ char-set?

    Delete the chari characters from character set cs. Linear-update variant. The procedure is allowed, but not required, to side-effect its first parameter.

    (scheme charset) procedure (char-set-complement (cs char-set?) ) ⟹ char-set?

    (shared description for char-set-complement, char-set-union, char-set-intersection, char-set-difference, char-set-xor, char-set-diff+intersection) These procedures implement set complement, union, intersection, difference, and exclusive-or for character sets. The union, intersection and xor operations are n-ary. The difference function is also n-ary, associates to the left (that is, it computes the difference between its first argument and the union of all the other arguments), and requires at least one argument.

    Boundary cases:

    (char-set-union) => char-set:empty

    (char-set-intersection) => char-set:full

    (char-set-xor) => char-set:empty

    (char-set-difference cs) => cs

    char-set-diff+intersection returns both the difference and the intersection of the arguments -- it partitions its first parameter. It is equivalent to

    (values (char-set-difference cs1 cs2 ...)

    (char-set-intersection cs1 (char-set-union cs2 ...)))

    but can be implemented more efficiently.

    Programmers should be aware that char-set-complement could potentially be a very expensive operation in Scheme implementations that provide a very large character type, such as 32-bit Unicode. If this is a possibility, sets can be complimented with respect to a smaller universe using char-set-difference.

    (scheme charset) procedure (char-set-union (cs1 char-set?) ... ) ⟹ char-set?

    (shared description for char-set-complement, char-set-union, char-set-intersection, char-set-difference, char-set-xor, char-set-diff+intersection) These procedures implement set complement, union, intersection, difference, and exclusive-or for character sets. The union, intersection and xor operations are n-ary. The difference function is also n-ary, associates to the left (that is, it computes the difference between its first argument and the union of all the other arguments), and requires at least one argument.

    Boundary cases:

    (char-set-union) => char-set:empty

    (char-set-intersection) => char-set:full

    (char-set-xor) => char-set:empty

    (char-set-difference cs) => cs

    char-set-diff+intersection returns both the difference and the intersection of the arguments -- it partitions its first parameter. It is equivalent to

    (values (char-set-difference cs1 cs2 ...)

    (char-set-intersection cs1 (char-set-union cs2 ...)))

    but can be implemented more efficiently.

    Programmers should be aware that char-set-complement could potentially be a very expensive operation in Scheme implementations that provide a very large character type, such as 32-bit Unicode. If this is a possibility, sets can be complimented with respect to a smaller universe using char-set-difference.

    (scheme charset) procedure (char-set-intersection (cs1 char-set?) ... ) ⟹ char-set?

    (shared description for char-set-complement, char-set-union, char-set-intersection, char-set-difference, char-set-xor, char-set-diff+intersection) These procedures implement set complement, union, intersection, difference, and exclusive-or for character sets. The union, intersection and xor operations are n-ary. The difference function is also n-ary, associates to the left (that is, it computes the difference between its first argument and the union of all the other arguments), and requires at least one argument.

    Boundary cases:

    (char-set-union) => char-set:empty

    (char-set-intersection) => char-set:full

    (char-set-xor) => char-set:empty

    (char-set-difference cs) => cs

    char-set-diff+intersection returns both the difference and the intersection of the arguments -- it partitions its first parameter. It is equivalent to

    (values (char-set-difference cs1 cs2 ...)

    (char-set-intersection cs1 (char-set-union cs2 ...)))

    but can be implemented more efficiently.

    Programmers should be aware that char-set-complement could potentially be a very expensive operation in Scheme implementations that provide a very large character type, such as 32-bit Unicode. If this is a possibility, sets can be complimented with respect to a smaller universe using char-set-difference.

    (scheme charset) procedure (char-set-difference (cs1 char-set?) (cs2 char-set?) ... ) ⟹ char-set?

    (shared description for char-set-complement, char-set-union, char-set-intersection, char-set-difference, char-set-xor, char-set-diff+intersection) These procedures implement set complement, union, intersection, difference, and exclusive-or for character sets. The union, intersection and xor operations are n-ary. The difference function is also n-ary, associates to the left (that is, it computes the difference between its first argument and the union of all the other arguments), and requires at least one argument.

    Boundary cases:

    (char-set-union) => char-set:empty

    (char-set-intersection) => char-set:full

    (char-set-xor) => char-set:empty

    (char-set-difference cs) => cs

    char-set-diff+intersection returns both the difference and the intersection of the arguments -- it partitions its first parameter. It is equivalent to

    (values (char-set-difference cs1 cs2 ...)

    (char-set-intersection cs1 (char-set-union cs2 ...)))

    but can be implemented more efficiently.

    Programmers should be aware that char-set-complement could potentially be a very expensive operation in Scheme implementations that provide a very large character type, such as 32-bit Unicode. If this is a possibility, sets can be complimented with respect to a smaller universe using char-set-difference.

    (scheme charset) procedure (char-set-xor (cs1 char-set?) ... ) ⟹ char-set?

    (shared description for char-set-complement, char-set-union, char-set-intersection, char-set-difference, char-set-xor, char-set-diff+intersection) These procedures implement set complement, union, intersection, difference, and exclusive-or for character sets. The union, intersection and xor operations are n-ary. The difference function is also n-ary, associates to the left (that is, it computes the difference between its first argument and the union of all the other arguments), and requires at least one argument.

    Boundary cases:

    (char-set-union) => char-set:empty

    (char-set-intersection) => char-set:full

    (char-set-xor) => char-set:empty

    (char-set-difference cs) => cs

    char-set-diff+intersection returns both the difference and the intersection of the arguments -- it partitions its first parameter. It is equivalent to

    (values (char-set-difference cs1 cs2 ...)

    (char-set-intersection cs1 (char-set-union cs2 ...)))

    but can be implemented more efficiently.

    Programmers should be aware that char-set-complement could potentially be a very expensive operation in Scheme implementations that provide a very large character type, such as 32-bit Unicode. If this is a possibility, sets can be complimented with respect to a smaller universe using char-set-difference.

    (scheme charset) procedure (char-set-diff+intersection (cs1 char-set?) (cs2 char-set?) ... ) ⟹ (values char-set?char-set?)

    (shared description for char-set-complement, char-set-union, char-set-intersection, char-set-difference, char-set-xor, char-set-diff+intersection) These procedures implement set complement, union, intersection, difference, and exclusive-or for character sets. The union, intersection and xor operations are n-ary. The difference function is also n-ary, associates to the left (that is, it computes the difference between its first argument and the union of all the other arguments), and requires at least one argument.

    Boundary cases:

    (char-set-union) => char-set:empty

    (char-set-intersection) => char-set:full

    (char-set-xor) => char-set:empty

    (char-set-difference cs) => cs

    char-set-diff+intersection returns both the difference and the intersection of the arguments -- it partitions its first parameter. It is equivalent to

    (values (char-set-difference cs1 cs2 ...)

    (char-set-intersection cs1 (char-set-union cs2 ...)))

    but can be implemented more efficiently.

    Programmers should be aware that char-set-complement could potentially be a very expensive operation in Scheme implementations that provide a very large character type, such as 32-bit Unicode. If this is a possibility, sets can be complimented with respect to a smaller universe using char-set-difference.

    (scheme charset) procedure (char-set-complement! (cs char-set?) ) ⟹ char-set?

    (shared description for char-set-complement!, char-set-union!, char-set-intersection!, char-set-difference!, char-set-xor!, char-set-diff+intersection!)

    These are linear-update variants of the set-algebra functions. They are allowed, but not required, to side-effect their first (required) parameter.

    char-set-diff+intersection! is allowed to side-effect both of its two required parameters, cs1 and cs2.

    (scheme charset) procedure (char-set-union (cs1 char-set?) (cs2 char-set?) ... ) ⟹ char-set?

    (shared description for char-set-complement!, char-set-union!, char-set-intersection!, char-set-difference!, char-set-xor!, char-set-diff+intersection!)

    These are linear-update variants of the set-algebra functions. They are allowed, but not required, to side-effect their first (required) parameter.

    char-set-diff+intersection! is allowed to side-effect both of its two required parameters, cs1 and cs2.

    (scheme charset) procedure (char-set-intersection! (cs1 char-set?) (cs2 char-set?) ... ) ⟹ char-set?

    (shared description for char-set-complement!, char-set-union!, char-set-intersection!, char-set-difference!, char-set-xor!, char-set-diff+intersection!)

    These are linear-update variants of the set-algebra functions. They are allowed, but not required, to side-effect their first (required) parameter.

    char-set-diff+intersection! is allowed to side-effect both of its two required parameters, cs1 and cs2.

    (scheme charset) procedure (char-set-difference! (cs1 char-set?) (cs2 char-set?) ... ) ⟹ char-set?

    (shared description for char-set-complement!, char-set-union!, char-set-intersection!, char-set-difference!, char-set-xor!, char-set-diff+intersection!)

    These are linear-update variants of the set-algebra functions. They are allowed, but not required, to side-effect their first (required) parameter.

    char-set-diff+intersection! is allowed to side-effect both of its two required parameters, cs1 and cs2.

    (scheme charset) procedure (char-set-xor! (cs1 char-set?) (cs2 char-set?) ... ) ⟹ char-set?

    (shared description for char-set-complement!, char-set-union!, char-set-intersection!, char-set-difference!, char-set-xor!, char-set-diff+intersection!)

    These are linear-update variants of the set-algebra functions. They are allowed, but not required, to side-effect their first (required) parameter.

    char-set-diff+intersection! is allowed to side-effect both of its two required parameters, cs1 and cs2.

    (scheme charset) procedure (char-set-diff+intersection! (cs1 char-set?) (cs2 char-set?) (cs3 char-set?) ... ) ⟹ (values char-set?char-set?)

    (shared description for char-set-complement!, char-set-union!, char-set-intersection!, char-set-difference!, char-set-xor!, char-set-diff+intersection!)

    These are linear-update variants of the set-algebra functions. They are allowed, but not required, to side-effect their first (required) parameter.

    char-set-diff+intersection! is allowed to side-effect both of its two required parameters, cs1 and cs2.

    char-set:lower-casechar-set?

    Lower-case letters

    char-set:upper-casechar-set?

    Upper-case letters

    char-set:title-casechar-set?

    Title-case letters

    char-set:letterchar-set?

    Letters

    char-set:digitchar-set?

    Digits

    char-set:letter+digitchar-set?

    Letters and digits

    char-set:graphicchar-set?

    Printing characters except spaces

    char-set:printingchar-set?

    Printing characters including spaces

    char-set:whitespacechar-set?

    Whitespace characters

    char-set:iso-controlchar-set?

    The ISO control characters

    char-set:punctuationchar-set?

    Punctuation characters

    char-set:symbolchar-set?

    Symbol characters

    char-set:hex-digitchar-set?

    A hexadecimal digit: 0-9, A-F, a-f

    char-set:blankchar-set?

    Blank characters -- horizontal whitespace

    char-set:asciichar-set?

    All characters in the ASCII set.

    char-set:emptychar-set?

    Empty set

    char-set:fullchar-set?

    All characters

    library (scheme ephemeron)

    (scheme ephemeron) procedure (ephemeron? object ) ⟹ boolean?

    Returns #t if object is an ephemeron; otherwise returns #f.

    (scheme ephemeron) procedure (make-ephemeron key datum ) ⟹ ephemeron?

    Returns a newly allocated ephemeron, with components key and datum. Note that if key and datum are the same in the sense of eq?, the ephemeron is effectively a weak reference to the object.

    (scheme ephemeron) procedure (ephemeron-broken? (ephemeron ephemeron?) ) ⟹ boolean?

    Returns #t if ephemeron has been broken; otherwise returns #f.

    This procedure must be used with care. If it returns #f, that guarantees only that prior evaluations of ephemeron-key or ephemeron-datum yielded the key or datum that was stored in ephemeron. However, it makes no guarantees about subsequent calls to ephemeron-key or ephemeron-datum, because the GC may run and break the ephemeron immediately after ephemeron-broken? returns.

    (scheme ephemeron) procedure (ephemeron-key (ephemeron ephemeron?) ) ⟹ *

    (shared description for ephemeron-key, ephemeron-datum) These return the key or datum component, respectively, of ephemeron. If ephemeron has been broken, these operations return #f, but they can also return #f if that is what was stored as the key or datum.

    (scheme ephemeron) procedure (ephemeron-datum (ephemeron ephemeron?) ) ⟹ *

    (shared description for ephemeron-key, ephemeron-datum) These return the key or datum component, respectively, of ephemeron. If ephemeron has been broken, these operations return #f, but they can also return #f if that is what was stored as the key or datum.

    (scheme ephemeron) procedure (reference-barrier key ) ⟹ *

    This procedure ensures that the garbage collector does not break an ephemeron containing an unreferenced key before a certain point in a program. The program can invoke a reference barrier on the key by calling this procedure, which guarantees that even if the program does not use the key, it will be considered strongly reachable until after reference-barrier returns.

    Because one cannot reliably operate on ephemerons in a portable way without calling the procedure reference-barrier, reference-barrier is mandatory.

    library (scheme generator)

    (scheme generator) procedure (generator arg ... ) ⟹ procedure?

    (return ) ⟹ *

    The simplest finite generator. Generates each of its arguments in turn. When no arguments are provided, it returns an empty generator that generates no values.

    (scheme generator) procedure (circular-generator arg ... ) ⟹ procedure?

    (return ) ⟹ *

    The simplest infinite generator. Generates each of its arguments in turn, then generates them again in turn, and so on forever.

    (scheme generator) procedure (make-iota-generator (count integer?) ) ⟹ procedure?

    (scheme generator) procedure (make-iota-generator (count integer?) (start real?) ) ⟹ procedure?

    (scheme generator) procedure (make-iota-generator (count integer?) (start real?) (step real?) ) ⟹ procedure?

    (return ) ⟹ real? / eof-object? /

    Creates a finite generator of a sequence of count numbers. The sequence begins with start (which defaults to 0) and increases by step (which defaults to 1). If both start and step are exact, it generates exact numbers; otherwise it generates inexact numbers. The exactness of count doesn't affect the exactness of the results.

    (scheme generator) procedure (make-range-generator (start real?) ) ⟹ procedure?

    (scheme generator) procedure (make-range-generator (start real?) (end real?) ) ⟹ procedure?

    (scheme generator) procedure (make-range-generator (start real?) (end real?) (step real?) ) ⟹ procedure?

    (return ) ⟹ real? / eof-object? /

    Creates a generator of a sequence of numbers. The sequence begins with start, increases by step (default 1), and continues while the number is less than end, or forever if end is omitted. If both start and step are exact, it generates exact numbers; otherwise it generates inexact numbers. The exactness of end doesn't affect the exactness of the results.

    (scheme generator) procedure (make-coroutine-generator (proc procedure?) ) ⟹ procedure?

    (proc (yield procedure?) ) ⟹ undefined

    (yield value ) ⟹ undefined

    (return ) ⟹ *

    Creates a generator from a coroutine.

    The proc argument is a procedure that takes one argument, yield. When called, make-coroutine-generator immediately returns a generator g. When g is called, proc runs until it calls yield. Calling yield causes the execution of proc to be suspended, and g returns the value passed to yield.

    Whether this generator is finite or infinite depends on the behavior of proc. If proc returns, it is the end of the sequence — g returns an end-of-file object from then on. The return value of proc is ignored.

    (scheme generator) procedure (list->generator (lis list?) ) ⟹ procedure?

    (return ) ⟹ *

    Returns generator that yields each element of the given argument. Mutating the underlying object will affect the results of the generator.

    (scheme generator) procedure (vector->generator (vec vector?) ) ⟹ procedure?

    (scheme generator) procedure (vector->generator (vec vector?) (start integer?) ) ⟹ procedure?

    (scheme generator) procedure (vector->generator (vec vector?) (start integer?) (end integer?) ) ⟹ procedure?

    (return ) ⟹ *

    Returns generator that yields each element of the given argument. Mutating the underlying object will affect the results of the generator.

    (scheme generator) procedure (reverse-vector->generator (vec vector?) ) ⟹ procedure?

    (scheme generator) procedure (reverse-vector->generator (vec vector?) (start integer?) ) ⟹ procedure?

    (scheme generator) procedure (reverse-vector->generator (vec vector?) (start integer?) (end integer?) ) ⟹ procedure?

    (return ) ⟹ *

    Returns generator that yields each element of the given argument. Mutating the underlying object will affect the results of the generator.

    (scheme generator) procedure (string->generator (str string?) ) ⟹ procedure?

    (scheme generator) procedure (string->generator (str string?) (start integer?) ) ⟹ procedure?

    (scheme generator) procedure (string->generator (str string?) (start integer?) (end integer?) ) ⟹ procedure?

    (return ) ⟹ char? / eof-object? /

    Returns generator that yields each element of the given argument. Mutating the underlying object will affect the results of the generator.

    (scheme generator) procedure (bytevector->generator (bytevector bytevector?) ) ⟹ procedure?

    (scheme generator) procedure (bytevector->generator (bytevector bytevector?) (start integer?) ) ⟹ procedure?

    (scheme generator) procedure (bytevector->generator (bytevector bytevector?) (start integer?) (end integer?) ) ⟹ procedure?

    (return ) ⟹ integer? / eof-object? /

    Returns generator that yields each element of the given argument. Mutating the underlying object will affect the results of the generator.

    (scheme generator) procedure (make-for-each-generator (for-each procedure?) obj ) ⟹ procedure?

    (for-each element ) ⟹ undefined

    (return ) ⟹ *

    A generator constructor that converts any collection obj to a generator that returns its elements using a for-each procedure appropriate for obj. This must be a procedure that when called as (for-each proc obj) calls proc on each element of obj. Examples of such procedures are for-each, string-for-each, and vector-for-each from R7RS. The value returned by for-each is ignored. The generator is finite if the collection is finite, which would typically be the case.

    The collections need not be conventional ones (lists, strings, etc.) as long as for-each can invoke a procedure on everything that counts as a member.

    (scheme generator) procedure (make-unfold-generator (stop? procedure?) (mapper procedure?) (successor procedure?) seed ) ⟹ procedure?

    (stop? seed ) ⟹ boolean?

    (mapper seed ) ⟹ *

    (successor seed ) ⟹ *

    (return ) ⟹ *

    A generator constructor similar to SRFI 1's unfold.

    The stop? predicate takes a seed value and determines whether to stop. The mapper procedure calculates a value to be returned by the generator from a seed value. The successor procedure calculates the next seed value from the current seed value.

    For each call of the resulting generator, stop? is called with the current seed value. If it returns true, then the generator returns an end-of-file object. Otherwise, it applies mapper to the current seed value to get the value to return, and uses successor to update the seed value.

    This generator is finite unless stop? never returns true.

    (scheme generator) procedure (gcons* item ... (gen procedure?) ) ⟹ procedure?

    (gen ) ⟹ *

    (return ) ⟹ *

    Returns a generator that adds items in front of gen. Once the items have been consumed, the generator is guaranteed to tail-call gen.

    (scheme generator) procedure (gappend (gen procedure?) ... ) ⟹ procedure?

    (gen ) ⟹ *

    (return ) ⟹ *

    Returns a generator that yields the items from the first given generator, and once it is exhausted, from the second generator, and so on.

    (scheme generator) procedure (gflatten (gen procedure?) ... ) ⟹ procedure?

    (gen ) ⟹ list?

    (return ) ⟹ *

    Returns a generator that yields the elements of the lists produced by the given generator.

    (scheme generator) procedure (ggroup (gen procedure?) (k integer?) ) ⟹ procedure?

    (scheme generator) procedure (ggroup (gen procedure?) (k integer?) padding ) ⟹ procedure?

    (gen ) ⟹ *

    (return ) ⟹ list? / eof-object? /

    Returns a generator that yields lists of k items from the given generator. If fewer than k elements are available for the last list, and padding is absent, the short list is returned; otherwise, it is padded by padding to length k.

    (scheme generator) procedure (gmerge (less-than procedure?) (gen1 procedure?) ... ) ⟹ procedure?

    (less-than a b ) ⟹ boolean?

    (gen ) ⟹ *

    Returns a generator that yields the items from the given generators in the order dictated by less-than. If the items are equal, the leftmost item is used first. When all of given generators are exhausted, the returned generator is exhausted also.

    As a special case, if only one generator is given, it is returned.

    (scheme generator) procedure (gmap (proc procedure?) (gen1 procedure?) ... ) ⟹ procedure?

    (proc el ) ⟹ *

    (gen ) ⟹ *

    When only one generator is given, returns a generator that yields the items from the given generator after invoking proc on them.

    When more than one generator is given, each item of the resulting generator is a result of applying proc to the items from each generator. If any of input generator is exhausted, the resulting generator is also exhausted.

    Note: This differs from generator-map->list, which consumes all values at once and returns the results as a list, while gmap returns a generator immediately without consuming input.

    (scheme generator) procedure (gcombine (proc procedure?) seed (gen1 procedure?) (gen2 procedure?) ... ) ⟹ procedure?

    (proc value1 value2 ... seed ) ⟹ (values **)

    (gen ) ⟹ *

    (return ) ⟹ *

    A generator for mapping with state. It yields a sequence of sub-folds over proc.

    The proc argument is a procedure that takes as many arguments as the input generators plus one. It is called as (proc v1 v2 … seed), where v1, v2, … are the values yielded from the input generators, and seed is the current seed value. It must return two values, the yielding value and the next seed. The result generator is exhausted when any of the genn generators is exhausted, at which time all the others are in an undefined state.

    (scheme generator) procedure (gfilter (pred procedure?) (gen procedure?) ) ⟹ procedure?

    (pred element ) ⟹ boolean?

    (gen ) ⟹ *

    (return ) ⟹ *

    Returns generators that yield the items from the source generator, except those on which pred answers false.

    (scheme generator) procedure (gremove (pred procedure?) (gen procedure?) ) ⟹ procedure?

    (pred element ) ⟹ boolean?

    (gen ) ⟹ *

    (return ) ⟹ *

    Returns generators that yield the items from the source generator, except those on which pred answers true.

    (scheme generator) procedure (gstate-filter (proc procedure?) seed (gen procedure?) ) ⟹ procedure?

    (proc item state ) ⟹ (values boolean?*)

    (gen ) ⟹ *

    (return ) ⟹ *

    Returns a generator that obtains items from the source generator and passes an item and a state (whose initial value is seed) as arguments to proc. Proc in turn returns two values, a boolean and a new value of the state. If the boolean is true, the item is returned; otherwise, this algorithm is repeated until gen is exhausted, at which point the returned generator is also exhausted. The final value of the state is discarded.

    (scheme generator) procedure (gtake (gen procedure?) (k integer?) ) ⟹ procedure?

    (scheme generator) procedure (gtake (gen procedure?) (k integer?) padding ) ⟹ procedure?

    (gen ) ⟹ *

    (return ) ⟹ *

    Gtake returns a generator that yields (at most) the first k items of the source generator.

    The procedure won't complain if the source generator is exhausted before generating k items. By default, the generator returned by gtake terminates when the source generator does, but if you provide the padding argument, then the returned generator will yield exactly k items, using the padding value as needed to provide sufficient additional values.

    (scheme generator) procedure (gdrop (gen procedure?) (k integer?) ) ⟹ procedure?

    (gen ) ⟹ *

    (return ) ⟹ *

    Gdrop returns a generator that skips the first k items of the source generator. The procedure won't complain if the source generator is exhausted before generating k items.

    (scheme generator) procedure (gtake-while (pred procedure?) (gen procedure?) ) ⟹ procedure?

    (pred element ) ⟹ boolean?

    (gen ) ⟹ *

    (return ) ⟹ *

    The generator returned from gtake-while yields items from the source generator as long as pred returns true for each.

    (scheme generator) procedure (gdrop-while (pred procedure?) (gen procedure?) ) ⟹ procedure?

    (pred element ) ⟹ boolean?

    (gen ) ⟹ *

    (return ) ⟹ *

    The generator returned from gdrop-while first reads and discards values from the source generator while pred returns true for them, then starts yielding items returned by the source.

    (scheme generator) procedure (gdelete item (gen procedure?) ) ⟹ procedure?

    (scheme generator) procedure (gdelete item (gen procedure?) (= procedure?) ) ⟹ procedure?

    (gen ) ⟹ *

    (= a b ) ⟹ boolean?

    (return ) ⟹ *

    Creates a generator that returns whatever gen returns, except for any items that are the same as item in the sense of =, which defaults to equal?. The = predicate is passed exactly two arguments, of which the first is item and the second is an element generated by gen.

    (scheme generator) procedure (gdelete-neighbor-dups (gen procedure?) ) ⟹ procedure?

    (scheme generator) procedure (gdelete-neighbor-dups (gen procedure?) (= procedure?) ) ⟹ procedure?

    (gen ) ⟹ *

    (= a b ) ⟹ boolean?

    (return ) ⟹ *

    Creates a generator that returns whatever gen returns, except for any items that are equal to the preceding item in the sense of =, which defaults to equal?. The = predicate is passed exactly two arguments, of which the first was generated by gen before the second.

    (scheme generator) procedure (gindex (value-gen procedure?) (index-gen procedure?) ) ⟹ procedure?

    (value-gen ) ⟹ *

    (index-gen ) ⟹ integer? / eof-object? /

    (return ) ⟹ *

    Creates a generator that returns elements of value-gen specified by the indices (non-negative exact integers) generated by index-gen. It is an error if the indices are not strictly increasing. The result generator is exhausted when either generator is exhausted, at which time the other is in an undefined state.

    (scheme generator) procedure (gselect (value-gen procedure?) (truth-gen procedure?) ) ⟹ procedure?

    (value-gen ) ⟹ *

    (truth-gen ) ⟹ boolean? / eof-object? /

    (return ) ⟹ *

    Creates a generator that returns elements of value-gen that correspond to the values generated by truth-gen. If the current value of truth-gen is true, the current value of value-gen is generated, but otherwise not. The result generator is exhausted when either generator is exhausted, at which time the other is in an undefined state.

    (scheme generator) procedure (generator->list (generator procedure?) ) ⟹ list?

    (scheme generator) procedure (generator->list (generator procedure?) (k integer?) ) ⟹ list?

    (generator ) ⟹ *

    Reads items from generator and returns a newly allocated list of them. By default, it reads until the generator is exhausted.

    If an optional argument k is given, it must be a non-negative integer, and the list ends when either k items are consumed, or generator is exhausted; therefore generator can be infinite in this case.

    (scheme generator) procedure (generator->reverse-list (generator procedure?) ) ⟹ list?

    (scheme generator) procedure (generator->reverse-list (generator procedure?) (k integer?) ) ⟹ list?

    (generator ) ⟹ *

    Reads items from generator and returns a newly allocated list of them in reverse order. By default, this reads until the generator is exhausted.

    If an optional argument k is given, it must be a non-negative integer, and the list ends when either k items are read, or generator is exhausted; therefore generator can be infinite in this case.

    (scheme generator) procedure (generator->vector (generator procedure?) ) ⟹ vector?

    (scheme generator) procedure (generator->vector (generator procedure?) (k integer?) ) ⟹ vector?

    (generator ) ⟹ *

    Reads items from generator and returns a newly allocated vector of them. By default, it reads until the generator is exhausted.

    If an optional argument k is given, it must be a non-negative integer, and the list ends when either k items are consumed, or generator is exhausted; therefore generator can be infinite in this case.

    (scheme generator) procedure (generator->vector! (vector vector?) (at integer?) (generator procedure?) ) ⟹ integer?

    (generator ) ⟹ *

    Reads items from generator and puts them into vector starting at index at, until vector is full or generator is exhausted. Generator can be infinite. The number of elements generated is returned.

    (scheme generator) procedure (generator->string (generator procedure?) ) ⟹ string?

    (scheme generator) procedure (generator->string (generator procedure?) (k integer?) ) ⟹ string?

    (generator ) ⟹ char? / eof-object? /

    Reads items from generator and returns a newly allocated string of them. It is an error if the items are not characters. By default, it reads until the generator is exhausted.

    If an optional argument k is given, it must be a non-negative integer, and the string ends when either k items are consumed, or generator is exhausted; therefore generator can be infinite in this case.

    (scheme generator) procedure (generator-fold (proc procedure?) seed (gen1 procedure?) (gen2 procedure?) ... ) ⟹ procedure?

    (proc val1 val2 ... state ) ⟹ *

    (gen ) ⟹ *

    Works like SRFI 1 fold on the values generated by the generator arguments.

    When one generator is given, for each value v generated by gen, proc is called as (proc v r), where r is the current accumulated result; the initial value of the accumulated result is seed, and the return value from proc becomes the next accumulated result. When gen is exhausted, the accumulated result at that time is returned from generator-fold.

    When more than one generator is given, proc is invoked on the values returned by all the generator arguments followed by the current accumulated result. The procedure terminates when any of the genn generators is exhausted, at which time all the others are in an undefined state.

    (scheme generator) procedure (generator-for-each (proc procedure?) (gen1 procedure?) (gen2 procedure?) ... ) ⟹ undefined

    (proc val1 val2 ... ) ⟹ undefined

    (gen ) ⟹ *

    A generator analogue of for-each that consumes generated values using side effects. Repeatedly applies proc on the values yielded by gen, gen2 … until any one of the generators is exhausted, at which time all the others are in an undefined state. The values returned from proc are discarded. Returns an unspecified value.

    (scheme generator) procedure (generator-map->list (proc procedure?) (gen1 procedure?) (gen2 procedure?) ... ) ⟹ list?

    (proc element ) ⟹ *

    (generator ) ⟹ *

    A generator analogue of map that consumes generated values, processes them through a mapping function, and returns a list of the mapped values. Repeatedly applies proc on the values yielded by gen, gen2 … until any one of the generators is exhausted, at which time all the others are in an undefined state. The values returned from proc are accumulated into a list, which is returned.

    (scheme generator) procedure (generator-find (pred procedure?) (generator procedure?) ) ⟹ *

    (pred element ) ⟹ boolean?

    (generator ) ⟹ *

    Applies pred to each item from gen. As soon as it yields a true value, the item is returned without consuming the rest of gen. If gen is exhausted, returns #f.

    (scheme generator) procedure (generator-count (pred procedure?) (generator procedure?) ) ⟹ integer?

    (pred element ) ⟹ boolean?

    (generator ) ⟹ *

    Returns the number of items available from the generator gen that satisfy the predicate pred.

    (scheme generator) procedure (generator-any (pred procedure?) (generator procedure?) ) ⟹ *

    (pred element ) ⟹ boolean?

    (generator ) ⟹ *

    Applies pred to each item from gen. As soon as it yields a true value, the value is returned without consuming the rest of gen. If gen is exhausted, returns #f.

    (scheme generator) procedure (generator-every (pred procedure?) (generator procedure?) ) ⟹ *

    (pred element ) ⟹ boolean?

    (generator ) ⟹ *

    Applies pred to each item from gen. As soon as it yields a false value, the value is returned without consuming the rest of gen. If gen is exhausted, returns the last value returned by pred, or #t if pred was never called.

    (scheme generator) procedure (generator-unfold (gen procedure?) (unfold procedure?) arg ... ) ⟹ *

    (gen ) ⟹ *

    (unfold (stop? procedure?) (mapper procedure?) (successor procedure?) seed args ... ) ⟹ *

    (stop? seed ) ⟹ boolean?

    (mapper seed ) ⟹ *

    (successor seed ) ⟹ *

    Equivalent to (unfold eof-object? (lambda (x) x) (lambda (x) (gen)) (gen) arg ...). The values of gen are unfolded into the collection that unfold creates.

    The signature of the unfold procedure is (unfold stop? mapper successor seed args ...). Note that the vector-unfold and vector-unfold-right of SRFI 43 and SRFI 133 do not have this signature and cannot be used with this procedure. To unfold into a vector, use SRFI 1's unfold and then apply list->vector to the result.

    (scheme generator) procedure (make-accumulator (kons procedure?) knil (finalizer procedure?) ) ⟹ procedure?

    (kons element state ) ⟹ *

    (finalizer state ) ⟹ *

    (return el ) ⟹ *

    Returns an accumulator that, when invoked on an object other than an end-of-file object, invokes kons on its argument and the accumulator's current state, using the same order as a function passed to fold. It then sets the accumulator's state to the value returned by kons and returns an unspecified value. The initial state of the accumulator is set to knil. However, if an end-of-file object is passed to the accumulator, it returns the result of tail-calling the procedure finalizer on the state. Repeated calls with an end-of-file object will reinvoke finalizer.

    (scheme generator) procedure (count-accumulator ) ⟹ procedure?

    (return el ) ⟹ undefined / integer? /

    Returns an accumulator that, when invoked on an object, adds 1 to a count inside the accumulator and returns an unspecified value. However, if an end-of-file object is passed, the accumulator returns the count.

    (scheme generator) procedure (list-accumulator ) ⟹ procedure?

    (return el ) ⟹ undefined / list? /

    Returns an accumulator that, when invoked on an object, adds that object to a list inside the accumulator in order of accumulation and returns an unspecified value. However, if an end-of-file object is passed, the accumulator returns the list.

    (scheme generator) procedure (reverse-list-accumulator ) ⟹ procedure?

    (return el ) ⟹ undefined / list? /

    Returns an accumulator that, when invoked on an object, adds that object to a list inside the accumulator in reverse order of accumulation and returns an unspecified value. However, if an end-of-file object is passed, the accumulator returns the list.

    (scheme generator) procedure (vector-accumulator ) ⟹ procedure?

    (return el ) ⟹ undefined / vector? /

    Returns an accumulator that, when invoked on an object, adds that object to a vector inside the accumulator in order of accumulation and returns an unspecified value. However, if an end-of-file object is passed, the accumulator returns the vector.

    (scheme generator) procedure (reverse-vector-accumulator ) ⟹ procedure?

    (return el ) ⟹ undefined / vector? /

    Returns an accumulator that, when invoked on an object, adds that object to a vector inside the accumulator in reverse order of accumulation and returns an unspecified value. However, if an end-of-file object is passed, the accumulator returns the vector.

    (scheme generator) procedure (vector-accumulator! (vector vector?) (at integer?) ) ⟹ procedure?

    (return el ) ⟹ undefined / vector? /

    Returns an accumulator that, when invoked on an object, adds that object to consecutive positions of vector starting at at in order of accumulation. It is an error to try to accumulate more objects than vector will hold. An unspecified value is returned. However, if an end-of-file object is passed, the accumulator returns vector.

    (scheme generator) procedure (string-accumulator ) ⟹ procedure?

    (return (char (or char?eof-object?)) ) ⟹ undefined / string? /

    Returns an accumulator that, when invoked on a character, adds that character to a string inside the accumulator in order of accumulation and returns an unspecified value. However, if an end-of-file object is passed, the accumulator returns the string.

    (scheme generator) procedure (bytevector-accumulator ) ⟹ procedure?

    (return (byte (or integer?eof-object?)) ) ⟹ undefined / bytevector? /

    Returns an accumulator that, when invoked on a byte, adds that integer to a bytevector inside the accumulator in order of accumulation and returns an unspecified value. However, if an end-of-file object is passed, the accumulator returns the bytevector.

    (scheme generator) procedure (bytevector-accumulator! (bytevector bytevector?) (at integer?) ) ⟹ procedure?

    (return (byte (or integer?eof-object?)) ) ⟹ undefined / bytevector? /

    Returns an accumulator that, when invoked on a byte, adds that byte to consecutive positions of bytevector starting at at in order of accumulation. It is an error to try to accumulate more bytes than vector will hold. An unspecified value is returned. However, if an end-of-file object is passed, the accumulator returns bytevector.

    (scheme generator) procedure (sum-accumulator ) ⟹ procedure?

    (return (char (or number?eof-object?)) ) ⟹ undefined / number? /

    Returns an accumulator that, when invoked on a number, adds that number to a sum inside the accumulator in order of accumulation and returns an unspecified value. However, if an end-of-file object is passed, the accumulator returns the sum.

    (scheme generator) procedure (product-accumulator ) ⟹ procedure?

    (return (char (or number?eof-object?)) ) ⟹ undefined / number? /

    Returns an accumulator that, when invoked on a number, multiplies that number to a product inside the accumulator in order of accumulation and returns an unspecified value. However, if an end-of-file object is passed, the accumulator returns the product.

    library (scheme hash-table)

    (scheme hash-table) procedure (make-hash-table (comparator comparator?) arg ... ) ⟹ hash-table?

    (scheme hash-table) procedure (make-hash-table (equality-predicate procedure?) arg ... ) ⟹ hash-table?

    (scheme hash-table) procedure (make-hash-table (equality-predicate procedure?) (hash-function procedure?) arg ... ) ⟹ hash-table?

    (equality-predicate a b ) ⟹ boolean?

    (hash-function obj ) ⟹ integer?

    Returns a newly allocated hash table whose equality predicate and hash function are extracted from comparator. Alternatively, for backward compatibility with SRFI 69 the equality predicate and hash function can be passed as separate arguments; this usage is deprecated.

    As mentioned above, implementations are free to use an appropriate implementation-dependent hash function instead of the specified hash function, provided that the specified equality predicate is a refinement of the equal? predicate. This applies whether the hash function and equality predicate are passed as separate arguments or packaged up into a comparator.

    If an equality predicate rather than a comparator is provided, the ability to omit the hash-function argument is severely limited. The implementation must provide hash functions appropriate for use with the predicates eq?, eqv?, equal?, string=?, and string-ci=?, and may extend this list. But if any unknown equality predicate is provided without a hash function, an error should be signaled. The constraints on equality predicates and hash functions are given in SRFI 128.

    The meaning of any further arguments is implementation-dependent. However, implementations which support the ability to specify the initial capacity of a hash table should interpret a non-negative exact integer as the specification of that capacity. In addition, if the symbols thread-safe, weak-keys, ephemeral-keys, weak-values, or ephemeral-values are present, implementations should create thread-safe hash tables, hash tables with weak keys or ephemeral keys, or hash tables with weak or ephemeral values respectively. Implementations are free to use ephemeral keys or values when weak keys or values respectively have been requested. To avoid collision with the hash-function argument, none of these arguments can be procedures.

    (R6RS make-eq-hashtable, make-eqv-hashtable, and make-hashtable; Common Lisp make-hash-table)

    (scheme hash-table) procedure (hash-table (comparator comparator?) key1 value1 ... ) ⟹ hash-table?

    Returns a newly allocated hash table, created as if by make-hash-table using comparator. For each pair of arguments, an association is added to the new hash table with key as its key and value as its value. If the implementation supports immutable hash tables, this procedure returns an immutable hash table. If the same key (in the sense of the equality predicate) is specified more than once, it is an error.

    (scheme hash-table) procedure (hash-table-unfold (stop? procedure?) (mapper procedure?) (successor procedure?) seed (comparator comparator?) arg ... ) ⟹ hash-table?

    (stop? seed ) ⟹ boolean?

    (mapper seed ) ⟹ (values **)

    (successor seed ) ⟹ *

    Create a new hash table as if by make-hash-table using comparator and the args. If the result of applying the predicate stop? to seed is true, return the hash table. Otherwise, apply the procedure mapper to seed. Mapper returns two values, which are inserted into the hash table as the key and the value respectively. Then get a new seed by applying the procedure successor to seed, and repeat this algorithm.

    (scheme hash-table) procedure (alist->hash-table (alist list?) (comparator comparator?) arg ... ) ⟹ hash-table?

    (scheme hash-table) procedure (alist->hash-table (alist list?) (equality-predicate procedure?) arg ... ) ⟹ hash-table?

    (scheme hash-table) procedure (alist->hash-table (alist list?) (equality-predicate procedure?) (hash-function procedure?) arg ... ) ⟹ hash-table?

    (equality-predicate a b ) ⟹ boolean?

    (hash-function obj ) ⟹ integer?

    Returns a newly allocated hash-table as if by make-hash-table using comparator and the args. It is then initialized from the associations of alist. Associations earlier in the list take precedence over those that come later. The second form is for compatibility with SRFI 69, and is deprecated.

    (scheme hash-table) procedure (hash-table? obj ) ⟹ boolean?

    Returns #t if obj is a hash table, and #f otherwise. (R6RS hashtable?; Common Lisp hash-table-p)

    (scheme hash-table) procedure (hash-table-contains? (hash-table hash-table?) key ) ⟹ boolean?

    Returns #t if there is any association to key in hash-table, and #f otherwise. Must execute in expected amortized constant time. (R6RS hashtable-contains?)

    (scheme hash-table) procedure (hash-table-exists? (hash-table hash-table?) key ) ⟹ boolean?

    Returns #t if there is any association to key in hash-table, and #f otherwise. Must execute in expected amortized constant time. The hash-table-exists? procedure is the same as hash-table-contains?, is provided for backward compatibility with SRFI 69, and is deprecated. (R6RS hashtable-contains?)

    (scheme hash-table) procedure (hash-table-empty? (hash-table hash-table?) ) ⟹ boolean?

    Returns #t if hash-table contains no associations, and #f otherwise.

    (scheme hash-table) procedure (hash-table=? (value-comparator comparator?) (hash-table1 hash-table?) (hash-table2 hash-table?) ) ⟹ boolean?

    Returns #t if hash-table1 and hash-table2 have the same keys (in the sense of their common equality predicate) and each key has the same value (in the sense of value-comparator), and #f otherwise.

    (scheme hash-table) procedure (hash-table-mutable? (hash-table hash-table?) ) ⟹ boolean?

    Returns #t if the hash table is mutable. Implementations may or may not support immutable hash tables. (R6RS hashtable-mutable?)

    (scheme hash-table) procedure (hash-table-ref (hash-table hash-table?) key ) ⟹ *

    (scheme hash-table) procedure (hash-table-ref (hash-table hash-table?) key (failure procedure?) ) ⟹ *

    (scheme hash-table) procedure (hash-table-ref (hash-table hash-table?) key (failure procedure?) (success procedure?) ) ⟹ *

    (failure ) ⟹ *

    (success value ) ⟹ *

    Extracts the value associated to key in hash-table, invokes the procedure success on it, and returns its result; if success is not provided, then the value itself is returned. If key is not contained in hash-table and failure is supplied, then failure is invoked on no arguments and its result is returned. Otherwise, it is an error. Must execute in expected amortized constant time, not counting the time to call the procedures. SRFI 69 does not support the success procedure.

    (scheme hash-table) procedure (hash-table-ref/default (hash-table hash-table?) key default ) ⟹ *

    Semantically equivalent to, but may be more efficient than, the following code:

    (hash-table-ref hash-table key (lambda () default))

    (R6RS hashtable-ref; Common Lisp gethash)

    (scheme hash-table) procedure (hash-table-set! (hash-table hash-table?) key1 value1 ... ) ⟹ undefined

    Repeatedly mutates hash-table, creating new associations in it by processing the arguments from left to right. The args alternate between keys and values. Whenever there is a previous association for a key, it is deleted. It is an error if the type check procedure of the comparator of hash-table, when invoked on a key, does not return #t. Likewise, it is an error if a key is not a valid argument to the equality predicate of hash-table. Returns an unspecified value. Must execute in expected amortized constant time per key. SRFI 69, R6RS hashtable-set! and Common Lisp (setf gethash) do not handle multiple associations.

    (scheme hash-table) procedure (hash-table-delete! (hash-table hash-table?) key ... ) ⟹ undefined

    Deletes any association to each key in hash-table and returns the number of keys that had associations. Must execute in expected amortized constant time per key. SRFI 69, R6RS hashtable-delete!, and Common Lisp remhash do not handle multiple associations.

    (scheme hash-table) procedure (hash-table-intern! (hash-table hash-table?) key (failure procedure?) ) ⟹ undefined

    (failure ) ⟹ *

    Effectively invokes hash-table-ref with the given arguments and returns what it returns. If key was not found in hash-table, its value is set to the result of calling failure. Must execute in expected amortized constant time.

    (scheme hash-table) procedure (hash-table-update! (hash-table hash-table?) key (updater procedure?) ) ⟹ undefined

    (scheme hash-table) procedure (hash-table-update! (hash-table hash-table?) key (updater procedure?) (failure procedure?) ) ⟹ undefined

    (scheme hash-table) procedure (hash-table-update! (hash-table hash-table?) key (updater procedure?) (failure procedure?) (success procedure?) ) ⟹ undefined

    (updater value ) ⟹ *

    (failure ) ⟹ *

    (success value ) ⟹ *

    Semantically equivalent to, but may be more efficient than, the following code:

    (hash-table-set! hash-table key (updater (hash-table-ref hash-table key failure success)))

    Must execute in expected amortized constant time. Returns an unspecified value. (SRFI 69 and R6RS hashtable-update! do not support the success procedure)

    (scheme hash-table) procedure (hash-table-update!/default (hash-table hash-table?) key (updater procedure?) default ) ⟹ undefined

    (updated value ) ⟹ *

    Semantically equivalent to, but may be more efficient than, the following code:

    (hash-table-set! hash-table key (updater (hash-table-ref/default hash-table key default)))

    Must execute in expected amortized constant time. Returns an unspecified value.

    (scheme hash-table) procedure (hash-table-pop! (hash-table hash-table?) ) ⟹ (values **)

    Chooses an arbitrary association from hash-table and removes it, returning the key and value as two values.

    It is an error if hash-table is empty.

    (scheme hash-table) procedure (hash-table-clear! (hash-table hash-table?) ) ⟹ undefined

    Delete all the associations from hash-table. (R6RS hashtable-clear!; Common Lisp clrhash)

    (scheme hash-table) procedure (hash-table-size (hash-table hash-table?) ) ⟹ integer?

    Returns the number of associations in hash-table as an exact integer. Should execute in constant time. (R6RS hashtable-size; Common Lisp hash-table-count.)

    (scheme hash-table) procedure (hash-table-keys (hash-table hash-table?) ) ⟹ list?

    Returns a newly allocated list of all the keys in hash-table. R6RS hashtable-keys returns a vector.

    (scheme hash-table) procedure (hash-table-values (hash-table hash-table?) ) ⟹ list?

    Returns a newly allocated list of all the keys in hash-table.

    (scheme hash-table) procedure (hash-table-entries (hash-table hash-table?) ) ⟹ (values list?list?)

    Returns two values, a newly allocated list of all the keys in hash-table and a newly allocated list of all the values in hash-table in the corresponding order. R6RS hash-table-entries returns vectors.

    (scheme hash-table) procedure (hash-table-find (proc procedure?) (hash-table hash-table?) (failure procedure?) ) ⟹ *

    (proc key value ) ⟹ *

    (failure ) ⟹ *

    For each association of hash-table, invoke proc on its key and value. If proc returns true, then hash-table-find returns what proc returns. If all the calls to proc return #f, return the result of invoking the thunk failure.

    (scheme hash-table) procedure (hash-table-count (pred procedure?) (hash-table hash-table?) ) ⟹ integer?

    (pred key value ) ⟹ boolean?

    For each association of hash-table, invoke pred on its key and value. Return the number of calls to pred which returned true.

    (scheme hash-table) procedure (hash-table-map (proc procedure?) (comparator comparator?) (hash-table hash-table?) ) ⟹ hash-table?

    (proc value ) ⟹ *

    Returns a newly allocated hash table as if by (make-hash-table comparator). Calls proc for every association in hash-table with the value of the association. The key of the association and the result of invoking proc are entered into the new hash table. Note that this is not the result of lifting mapping over the domain of hash tables, but it is considered more useful.

    If comparator recognizes multiple keys in the hash-table as equivalent, any one of such associations is taken.

    (scheme hash-table) procedure (hash-table-for-each (proc procedure?) (hash-table hash-table?) ) ⟹ undefined

    (proc key value ) ⟹ undefined

    Calls proc for every association in hash-table with two arguments: the key of the association and the value of the association. The value returned by proc is discarded. Returns an unspecified value. (Common Lisp maphash)

    (scheme hash-table) procedure (hash-table-walk (hash-table hash-table?) (proc procedure?) ) ⟹ undefined

    (proc key value ) ⟹ undefined

    Calls proc for every association in hash-table with two arguments: the key of the association and the value of the association. The value returned by proc is discarded. Returns an unspecified value. The hash-table-walk procedure is equivalent to hash-table-for-each with the arguments reversed, is provided for backward compatibility with SRFI 69, and is deprecated. (Common Lisp maphash)

    (scheme hash-table) procedure (hash-table-map! (proc procedure?) (comparator comparator?) (hash-table hash-table?) ) ⟹ undefined

    (proc key value ) ⟹ *

    Calls proc for every association in hash-table with two arguments: the key of the association and the value of the association. The value returned by proc is used to update the value of the association. Returns an unspecified value.

    (scheme hash-table) procedure (hash-table-map->list (proc procedure?) (hash-table hash-table?) ) ⟹ list?

    (proc key value ) ⟹ *

    Calls proc for every association in hash-table with two arguments: the key of the association and the value of the association. The values returned by the invocations of proc are accumulated into a list, which is returned.

    (scheme hash-table) procedure (hash-table-fold (proc procedure?) seed (hash-table hash-table?) ) ⟹ *

    (scheme hash-table) procedure (hash-table-fold (hash-table hash-table?) (proc procedure?) seed ) ⟹ *

    (proc key value state ) ⟹ *

    Calls proc for every association in hash-table with three arguments: the key of the association, the value of the association, and an accumulated value val. Val is seed for the first invocation of procedure, and for subsequent invocations of proc, the returned value of the previous invocation. The value returned by hash-table-fold is the return value of the last invocation of proc. The order of arguments with hash-table as the first argument is provided for SRFI 69 compatibility, and is deprecated.

    (scheme hash-table) procedure (hash-table-prune! (proc procedure?) (hash-table hash-table?) ) ⟹ undefined

    (proc key value ) ⟹ boolean?

    Calls proc for every association in hash-table with two arguments, the key and the value of the association, and removes all associations from hash-table for which proc returns true. Returns an unspecified value.

    (scheme hash-table) procedure (hash-table-copy (hash-table hash-table?) ) ⟹ hash-table?

    (scheme hash-table) procedure (hash-table-copy (hash-table hash-table?) (mutable boolean?) ) ⟹ hash-table?

    Returns a newly allocated hash table with the same properties and associations as hash-table. If the second argument is present and is true, the new hash table is mutable. Otherwise it is immutable provided that the implementation supports immutable hash tables. SRFI 69 hash-table-copy does not support a second argument. (R6RS hashtable-copy)

    (scheme hash-table) procedure (hash-table-empty-copy (hash-table hash-table?) ) ⟹ hash-table?

    Returns a newly allocated mutable hash table with the same properties as hash-table, but with no associations.

    (scheme hash-table) procedure (hash-table->alist (hash-table hash-table?) ) ⟹ list?

    Returns an alist with the same associations as hash-table in an unspecified order.

    (scheme hash-table) procedure (hash-table-union! (hash-table1 hash-table?) (hash-table2 hash-table?) ) ⟹ hash-table?

    Adds the associations of hash-table2 to hash-table1 and returns hash-table1. If a key appears in both hash tables, its value is set to the value appearing in hash-table1. Returns hash-table1.

    (scheme hash-table) procedure (hash-table-merge! (hash-table1 hash-table?) (hash-table2 hash-table?) ) ⟹ hash-table?

    Adds the associations of hash-table2 to hash-table1 and returns hash-table1. If a key appears in both hash tables, its value is set to the value appearing in hash-table1. Returns hash-table1. The hash-table-merge! procedure is the same as hash-table-union!, is provided for compatibility with SRFI 69, and is deprecated.

    (scheme hash-table) procedure (hash-table-intersection! (hash-table1 hash-table?) (hash-table2 hash-table?) ) ⟹ hash-table?

    Deletes the associations from hash-table1 whose keys don't also appear in hash-table2 and returns hash-table1.

    (scheme hash-table) procedure (hash-table-difference! (hash-table1 hash-table?) (hash-table2 hash-table?) ) ⟹ hash-table?

    Deletes the associations of hash-table1 whose keys are also present in hash-table2 and returns hash-table1.

    (scheme hash-table) procedure (hash-table-xor! (hash-table1 hash-table?) (hash-table2 hash-table?) ) ⟹ hash-table?

    Deletes the associations of hash-table1 whose keys are also present in hash-table2, and then adds the associations of hash-table2 whose keys are not present in hash-table1 to hash-table1. Returns hash-table1.

    (scheme hash-table) procedure (hash obj ) ⟹ integer?

    (scheme hash-table) procedure (hash obj arg ) ⟹ integer?

    The same as SRFI 128's default-hash procedure, except that it must accept (and should ignore) an optional second argument.

    (scheme hash-table) procedure (string-hash (str string?) ) ⟹ integer?

    (scheme hash-table) procedure (string-hash (str string?) arg ) ⟹ integer?

    Similar to SRFI 128's string-hash procedure, except that it must accept (and should ignore) an optional second argument. It is incompatible with the procedure of the same name exported by SRFI 128 and SRFI 126.

    (scheme hash-table) procedure (string-ci-hash (str string?) ) ⟹ integer?

    (scheme hash-table) procedure (string-ci-hash (str string?) arg ) ⟹ integer?

    Similar to SRFI 128's string-ci-hash procedure, except that it must accept (and should ignore) an optional second argument. It is incompatible with the procedure of the same name exported by SRFI 128 and SRFI 126.

    (scheme hash-table) procedure (hash-by-identity obj ) ⟹ integer?

    (scheme hash-table) procedure (hash-by-identity obj arg ) ⟹ integer?

    The same as SRFI 128's default-hash procedure, except that it must accept (and should ignore) an optional second argument. However, if the implementation replaces the hash function associated with the eq? predicate with an implementation-dependent alternative, it is an error to call this procedure at all.

    (scheme hash-table) procedure (hash-table-equivalence-function (hash-table hash-table?) ) ⟹ procedure?

    (return a b ) ⟹ boolean?

    Returns the equivalence procedure used to create hash-table.

    (scheme hash-table) procedure (hash-table-hash-function (hash-table hash-table?) ) ⟹ procedure?

    (return obj ) ⟹ integer?

    Returns the hash function used to create hash-table. However, if the implementation has replaced the user-specified hash function with an implementation-specific alternative, the implementation may return #f instead.

    library (scheme ideque)

    (scheme ideque) procedure (ideque element ... ) ⟹ ideque?

    Returns an ideque containing the elements. The first element (if any) will be at the front of the ideque and the last element (if any) will be at the back. Takes O(n) time, where n is the number of elements.

    (scheme ideque) procedure (ideque-tabulate (n integer?) (proc procedure?) ) ⟹ ideque?

    (proc (k integer?) ) ⟹ *

    Invokes the predicate proc on every exact integer from 0 (inclusive) to n (exclusive). Returns an ideque containing the results in order of generation. Takes O(n) time.

    (scheme ideque) procedure (ideque-unfold (stop? procedure?) (mapper procedure?) (successor procedure?) seed ) ⟹ ideque?

    (stop? seed ) ⟹ boolean?

    (mapper seed ) ⟹ *

    (successor seed ) ⟹ *

    Invokes the predicate stop? on seed. If it returns false, generate the next result by applying mapper to seed, generate the next seed by applying successor to seed, and repeat this algorithm with the new seed. If stop? returns true, return an ideque containing the results in order of accumulation. Takes O(n) time.

    (scheme ideque) procedure (ideque-unfold-right (stop? procedure?) (mapper procedure?) (successor procedure?) seed ) ⟹ ideque?

    (stop? seed ) ⟹ boolean?

    (mapper seed ) ⟹ *

    (successor seed ) ⟹ *

    Invokes the predicate stop? on seed. If it returns false, generate the next result by applying mapper to seed, generate the next seed by applying successor to seed, and repeat the algorithm with the new seed. If stop? returns true, return an ideque containing the results in reverse order of accumulation. Takes O(n) time.

    (scheme ideque) procedure (ideque? x ) ⟹ boolean?

    Returns #t if x is an ideque, and #f otherwise. Takes O(1) time.

    (scheme ideque) procedure (ideque-empty? (ideque ideque?) ) ⟹ boolean?

    Returns #t if ideque contains zero elements, and #f otherwise. Takes O(1) time.

    (scheme ideque) procedure (ideque= (elt= procedure?) (ideque ideque?) ... ) ⟹ boolean?

    (elt= a b ) ⟹ boolean?

    Determines ideque equality, given an element-equality procedure. Ideque A equals ideque B if they are of the same length, and their corresponding elements are equal, as determined by elt=. If the element-comparison procedure's first argument is from idequei, then its second argument is from idequei+1, i.e. it is always called as (elt= a b) for a an element of ideque A, and b an element of ideque B.

    In the n-ary case, every idequei is compared to idequei+1 (as opposed, for example, to comparing ideque1 to every idequei, for i > 1). If there are zero or one ideque arguments, ideque= simply returns true. The name does not end in a question mark for compatibility with the SRFI-1 procedure list=.

    Note that the dynamic order in which the elt= procedure is applied to pairs of elements is not specified. For example, if ideque= is applied to three ideques, A, B, and C, it may first completely compare A to B, then compare B to C, or it may compare the first elements of A and B, then the first elements of B and C, then the second elements of A and B, and so forth.

    The equality procedure must be consistent with eq?. Note that this implies that two ideques which are eq? are always ideque=, as well; implementations may exploit this fact to "short-cut" the element-by-element comparisons.

    (scheme ideque) procedure (ideque-any (pred procedure?) (ideque ideque?) ) ⟹ *

    (pred element ) ⟹ *

    Invokes pred on the elements of the ideque in order until one call returns a true value, which is then returned. If there are no elements, returns #f. Takes O(n) time.

    (scheme ideque) procedure (ideque-every (pred procedure?) (ideque ideque?) ) ⟹ *

    (pred element ) ⟹ *

    Invokes pred on the elements of the ideque in order until one call returns a false value, which is then returned. If there are no elements, returns #t. Takes O(n) time.

    (scheme ideque) procedure (ideque-front (ideque ideque?) ) ⟹ *

    Returns the front element of ideque. It is an error for ideque to be empty. Takes O(1) time.

    (scheme ideque) procedure (ideque-back (ideque ideque?) ) ⟹ *

    Returns the back element of ideque. It is an error for ideque to be empty. Takes O(1) time.

    (scheme ideque) procedure (ideque-remove-front (ideque ideque?) ) ⟹ ideque?

    Returns an ideque with the front element of ideque removed. It is an error for ideque to be empty. Takes O(1) time.

    (scheme ideque) procedure (ideque-remove-back (ideque ideque?) ) ⟹ ideque?

    Returns an ideque with the back element of ideque removed. It is an error for ideque to be empty. Takes O(1) time.

    (scheme ideque) procedure (ideque-add-front (ideque ideque?) obj ) ⟹ ideque?

    Returns an ideque with obj pushed to the front of ideque. Takes O(1) time.

    (scheme ideque) procedure (ideque-add-back (ideque ideque?) obj ) ⟹ ideque?

    Returns an ideque with obj pushed to the back of ideque. Takes O(1) time.

    (scheme ideque) procedure (ideque-ref (ideque ideque?) (n integer?) ) ⟹ *

    Returns the nth element of ideque. It is an error unless n is less than the length of ideque. Takes O(n) time.

    (scheme ideque) procedure (ideque-take (ideque ideque?) (n integer?) ) ⟹ ideque?

    Returns an ideque containing the first n elements of ideque. It is an error if n is greater than the length of ideque. Takes O(n) time.

    (scheme ideque) procedure (ideque-take-right (ideque ideque?) (n integer?) ) ⟹ ideque?

    Returns an ideque containing the last n elements of ideque. It is an error if n is greater than the length of ideque. Takes O(n) time.

    (scheme ideque) procedure (ideque-drop (ideque ideque?) (n integer?) ) ⟹ ideque?

    Returns an ideque containing all but the first n elements of ideque. It is an error if n is greater than the length of ideque. Takes O(n) time.

    (scheme ideque) procedure (ideque-drop-right (ideque ideque?) (n integer?) ) ⟹ ideque?

    Returns an ideque containing all but the last n elements of ideque. It is an error if n is greater than the length of ideque. Takes O(n) time.

    (scheme ideque) procedure (ideque-split-at (ideque ideque?) (n integer?) ) ⟹ (values ideque?ideque?)

    Returns two values, the results of (ideque-take ideque n) and (ideque-drop ideque n) respectively, but may be more efficient. Takes O(n) time.

    (scheme ideque) procedure (ideque-length (ideque ideque?) ) ⟹ integer?

    Returns the length of ideque as an exact integer. May take O(n) time, though O(1) is optimal.

    (scheme ideque) procedure (ideque-append (ideque ideque?) ... ) ⟹ ideque?

    Returns an ideque with the contents of the ideque followed by the others, or an empty ideque if there are none. Takes O(kn) time, where k is the number of ideques and n is the number of elements involved, though O(k log n) is possible.

    (scheme ideque) procedure (ideque-reverse (ideque ideque?) ) ⟹ ideque?

    Returns an ideque containing the elements of ideque in reverse order. Takes O(1) time.

    (scheme ideque) procedure (ideque-count (pred procedure?) (ideque ideque?) ) ⟹ integer?

    (pred element ) ⟹ boolean?

    Pred is a procedure taking a single value and returning a single value. It is applied element-wise to the elements of ideque, and a count is tallied of the number of elements that produce a true value. This count is returned. Takes O(n) time. The dynamic order of calls to pred is unspecified.

    (scheme ideque) procedure (ideque-zip (ideque1 ideque?) (ideque2 ideque?) ... ) ⟹ ideque?

    Returns an ideque of lists (not ideques) each of which contains the corresponding elements of ideques in the order specified. Terminates when all the elements of any of the ideques have been processed. Takes O(kn) time, where k is the number of ideques and n is the number of elements in the shortest ideque.

    (scheme ideque) procedure (ideque-map (proc procedure?) (ideque ideque?) ) ⟹ ideque?

    (proc element ) ⟹ *

    Applies proc to the elements of ideque and returns an ideque containing the results in order. The dynamic order of calls to proc is unspecified. Takes O(n) time.

    (scheme ideque) procedure (ideque-filter-map (proc procedure?) (ideque ideque?) ) ⟹ ideque?

    (proc element ) ⟹ *

    Applies proc to the elements of ideque and returns an ideque containing the true (i.e. non-#f) results in order. The dynamic order of calls to proc is unspecified. Takes O(n) time.

    (scheme ideque) procedure (ideque-for-each (proc procedure?) (ideque ideque?) ) ⟹ undefined

    (proc element ) ⟹ undefined

    Applies proc to the elements of ideque in forward order and returns an unspecified result. Takes O(n) time.

    (scheme ideque) procedure (ideque-for-each-right (proc procedure?) (ideque ideque?) ) ⟹ undefined

    (proc element ) ⟹ undefined

    Applies proc to the elements of ideque in reverse order and returns an unspecified result. Takes O(n) time.

    (scheme ideque) procedure (ideque-fold (proc procedure?) nil (ideque ideque?) ) ⟹ *

    (proc element state ) ⟹ *

    Invokes proc on the elements of ideque in forward order, passing the result of the previous invocation as a second argument. For the first invocation, nil is used as the second argument. Returns the result of the last invocation, or nil if there was no invocation. Takes O(n) time.

    (scheme ideque) procedure (ideque-fold-right (proc procedure?) nil (ideque ideque?) ) ⟹ *

    (proc element state ) ⟹ *

    Invokes proc on the elements of ideque in reverse order, passing the result of the previous invocation as a second argument. For the first invocation, nil is used as the second argument. Returns the result of the last invocation, or nil if there was no invocation. Takes O(n) time.

    (scheme ideque) procedure (ideque-append-map (proc procedure?) (ideque ideque?) ) ⟹ ideque?

    (proc element ) ⟹ list?

    Applies proc to the elements of ideque. It is an error if the result is not a list. Returns an ideque containing the elements of the lists in order. Takes O(n) time, where n is the number of elements in all the lists returned.

    (scheme ideque) procedure (ideque-filter (pred procedure?) (ideque ideque?) ) ⟹ ideque?

    (pred element ) ⟹ boolean?

    Returns an ideque containing the elements of ideque that do satisfy pred. Takes O(n) time.

    (scheme ideque) procedure (ideque-remove (pred procedure?) (ideque ideque?) ) ⟹ ideque?

    (pred element ) ⟹ boolean?

    Returns an ideque containing the elements of ideque that do not satisfy pred. Takes O(n) time.

    (scheme ideque) procedure (ideque-partition (pred procedure?) (ideque ideque?) ) ⟹ (values ideque?ideque?)

    (pred element ) ⟹ boolean?

    Returns two values, the results of (ideque-filter pred ideque) and (ideque-remove pred ideque) respectively, but may be more efficient. Takes O(n) time.

    (scheme ideque) procedure (ideque-find (pred procedure?) (ideque ideque?) ) ⟹ *

    (scheme ideque) procedure (ideque-find (pred procedure?) (ideque ideque?) (failure procedure?) ) ⟹ *

    (pred element ) ⟹ boolean?

    (failure ) ⟹ *

    Returns the first element of ideque that satisfies pred. If there is no such element, returns the result of invoking the thunk failure; the default thunk is (lambda () #f). Takes O(n) time.

    (scheme ideque) procedure (ideque-find-right (pred procedure?) (ideque ideque?) ) ⟹ *

    (scheme ideque) procedure (ideque-find-right (pred procedure?) (ideque ideque?) (failure procedure?) ) ⟹ *

    (pred element ) ⟹ boolean?

    (failure ) ⟹ *

    Returns the last element of ideque that satisfies pred. If there is no such element, returns the result of invoking the thunk failure; the default thunk is (lambda () #f). Takes O(n) time.

    (scheme ideque) procedure (ideque-take-while (pred procedure?) (ideque ideque?) ) ⟹ ideque?

    (pred element ) ⟹ boolean?

    Returns an ideque containing the longest initial prefix of elements in ideque all of which satisfy pred. Takes O(n) time.

    (scheme ideque) procedure (ideque-take-while-right (pred procedure?) (ideque ideque?) ) ⟹ ideque?

    (pred element ) ⟹ boolean?

    Returns an ideque containing the longest final prefix of elements in ideque all of which satisfy pred. Takes O(n) time.

    (scheme ideque) procedure (ideque-drop-while (pred procedure?) (ideque ideque?) ) ⟹ ideque?

    (pred element ) ⟹ boolean?

    Returns an ideque which omits the longest initial prefix of elements in ideque all of which satisfy pred, but includes all other elements of ideque. Takes O(n) time.

    (scheme ideque) procedure (ideque-drop-while-right (pred procedure?) (ideque ideque?) ) ⟹ ideque?

    (pred element ) ⟹ boolean?

    Returns an ideque which omits the longest final prefix of elements in ideque all of which satisfy pred, but includes all other elements of ideque. Takes O(n) time.

    (scheme ideque) procedure (ideque-span (pred procedure?) (ideque ideque?) ) ⟹ (values ideque?ideque?)

    (pred element ) ⟹ boolean?

    Returns two values, the initial prefix of the elements of ideque which do satisfy pred, and the remaining elements. Takes O(n) time.

    (scheme ideque) procedure (ideque-break (pred procedure?) (ideque ideque?) ) ⟹ (values ideque?ideque?)

    (pred element ) ⟹ boolean?

    Returns two values, the initial prefix of the elements of ideque which do not satisfy pred, and the remaining elements. Takes O(n) time.

    (scheme ideque) procedure (list->ideque (list list?) ) ⟹ ideque?

    (shared description for list->ideque, ideque->list) Conversion between ideque and list structures. FIFO order is preserved, so the front of a list corresponds to the front of an ideque. Each operation takes O(n) time.

    (scheme ideque) procedure (ideque->list (ideque ideque?) ) ⟹ list?

    (shared description for list->ideque, ideque->list) Conversion between ideque and list structures. FIFO order is preserved, so the front of a list corresponds to the front of an ideque. Each operation takes O(n) time.

    (scheme ideque) procedure (generator->ideque (generator procedure?) ) ⟹ ideque?

    (generator ) ⟹ *

    (shared description for generator->ideque, ideque->generator) Conversion between SRFI 121 generators and ideques. Each operation takes O(n) time. A generator is a procedure that is called repeatedly with no arguments to generate consecutive values, and returns an end-of-file object when it has no more values to return.

    (scheme ideque) procedure (ideque->generator (ideque ideque?) ) ⟹ procedure?

    (return ) ⟹ *

    (shared description for generator->ideque, ideque->generator) Conversion between SRFI 121 generators and ideques. Each operation takes O(n) time. A generator is a procedure that is called repeatedly with no arguments to generate consecutive values, and returns an end-of-file object when it has no more values to return.

    library (scheme ilist)

    (scheme ilist) syntax (iq () ((_ datum ...) ilist?) )

    iq is partly analogous to quote, taking an arbitrary number of literals and constructing an ilist from them, with any pairs in the literals converted to ipairs. It is useful for providing constant ipair-based objects. Note that pairs within literal vectors or other implementation-dependent literals will not be converted. Unfortunately, there is no ilist analogue of ', so we save keystrokes by using iq rather than iquote and omitting the top-level parentheses.

    (scheme ilist) procedure (ipair a d ) ⟹ ipair?

    The primitive constructor. Returns a newly allocated ipair whose icar is a and whose icdr is d. The ipair is guaranteed to be different (in the sense of eqv?) from every existing object.

    (scheme ilist) procedure (ilist object ... ) ⟹ ilist?

    Returns a newly allocated ilist of its arguments.

    (scheme ilist) procedure (xipair d a ) ⟹ ipair?

    (lambda (d a) (ipair a d))

    Of utility only as a value to be conveniently passed to higher-order procedures.

    (scheme ilist) procedure (ipair* elt1 elt2 ... ) ⟹ *

    Like ilist, but the last argument provides the tail of the constructed ilist

    (scheme ilist) procedure (make-ilist (n integer?) ) ⟹ ilist?

    (scheme ilist) procedure (make-ilist (n integer?) fill ) ⟹ ilist?

    Returns an n-element ilist, whose elements are all the value fill. If the fill argument is not given, the elements of the ilist may be arbitrary values.

    (scheme ilist) procedure (ilist-tabulate (n integer?) (init-proc procedure?) ) ⟹ ilist?

    (init-proc (i integer?) ) ⟹ *

    Returns an n-element ilist. Element i of the ilist, 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.

    (scheme ilist) procedure (ilist-copy (dilist ilist?) ) ⟹ ilist?

    (scheme ilist) procedure (ilist-copy (dilist dotted-ilist?) ) ⟹ dotted-ilist?

    Copies the spine of the argument, including the ilist tail.

    (scheme ilist) procedure (iiota (count integer?) ) ⟹ ilist?

    (scheme ilist) procedure (iiota (count integer?) (start number?) ) ⟹ ilist?

    (scheme ilist) procedure (iiota (count integer?) (start number?) (step number?) ) ⟹ ilist?

    Returns an ilist 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.

    (scheme ilist) procedure (proper-ilist? obj ) ⟹ boolean?

    (scheme ilist) procedure (ilist? obj ) ⟹ boolean?

    These identifiers are bound either to the same procedure, or to procedures of equivalent behavior. In either case, true is returned iff x is a proper ilist — a ()-terminated ilist.

    More carefully: The empty list is a proper ilist. An ipair whose icdr is a proper ilist is also a proper ilist. Everything else is a dotted ilist. This includes non-ipair, non-() values (e.g. symbols, numbers, mutable pairs), which are considered to be dotted ilists of length 0.

    (scheme ilist) procedure (dotted-ilist? obj ) ⟹ boolean?

    True if x is a finite, non-nil-terminated ilist. That is, there exists an n >= 0 such that icdrn(x) is neither an ipair nor (). This includes non-ipair, non-() values (e.g. symbols, numbers), which are considered to be dotted ilists of length 0.

    (scheme ilist) procedure (ipair? obj ) ⟹ boolean?

    Returns #t if object is an ipair; otherwise, #f.

    (scheme ilist) procedure (null-ilist? (lst ilist?) ) ⟹ boolean?

    Ilist is a proper ilist. This procedure returns true if the argument is the empty list (), and false otherwise. It is an error to pass this procedure a value which is not a proper ilist. This procedure is recommended as the termination condition for ilist-processing procedures that are not defined on dotted ilists.

    (scheme ilist) procedure (not-ipair? obj ) ⟹ boolean?

    (lambda (x) (not (ipair? x)))

    Provided as a procedure as it can be useful as the termination condition for ilist-processing procedures that wish to handle all ilists, both proper and dotted.

    (scheme ilist) procedure (ilist= (elt= procedure?) (ilist1 ilist?) ... ) ⟹ boolean?

    (elt= a b ) ⟹ *

    Determines ilist equality, given an element-equality procedure. Proper ilist A equals proper ilist B if they are of the same length, and their corresponding elements are equal, as determined by elt=. If the element-comparison procedure's first argument is from ilisti, then its second argument is from ilisti+1, i.e. it is always called as (elt= a b) for a an element of ilist A, and b an element of ilist B.

    In the n-ary case, every ilisti is compared to ilisti+1 (as opposed, for example, to comparing ilist1 to ilisti, for i>1). If there are no ilist arguments at all, ilist= simply returns true.

    It is an error to apply ilist= to anything except proper ilists. It cannot reasonably be extended to dotted ilists, as it provides no way to specify an equality procedure for comparing the ilist terminators.

    Note that the dynamic order in which the elt= procedure is applied to pairs of elements is not specified. For example, if ilist= is applied to three ilists, A, B, and C, it may first completely compare A to B, then compare B to C, or it may compare the first elements of A and B, then the first elements of B and C, then the second elements of A and B, and so forth.

    The equality procedure must be consistent with eq?. That is, it must be the case that

    (eq? x y) => (elt= x y).

    Note that this implies that two ilists which are eq? are always ilist=, as well; implementations may exploit this fact to "short-cut" the element-by-element comparisons.

    (scheme ilist) procedure (icar (ipair ipair?) ) ⟹ *

    (scheme ilist) procedure (icdr (ipair ipair?) ) ⟹ *

    These procedures return the contents of the icar and icdr field of their argument, respectively. Note that it is an error to apply them to the empty ilist.

    (scheme ilist) procedure (icaar (ipair ipair?) ) ⟹ *

    (scheme ilist) procedure (icadr (ipair ipair?) ) ⟹ *

    (scheme ilist) procedure (icdar (ipair ipair?) ) ⟹ *

    (scheme ilist) procedure (icddr (ipair ipair?) ) ⟹ *

    (scheme ilist) procedure (icaaaar (ipair ipair?) ) ⟹ *

    (scheme ilist) procedure (icaaadr (ipair ipair?) ) ⟹ *

    (scheme ilist) procedure (icaaar (ipair ipair?) ) ⟹ *

    (scheme ilist) procedure (icaadar (ipair ipair?) ) ⟹ *

    (scheme ilist) procedure (icaaddr (ipair ipair?) ) ⟹ *

    (scheme ilist) procedure (icaadr (ipair ipair?) ) ⟹ *

    (scheme ilist) procedure (icadaar (ipair ipair?) ) ⟹ *

    (scheme ilist) procedure (icadadr (ipair ipair?) ) ⟹ *

    (scheme ilist) procedure (icadar (ipair ipair?) ) ⟹ *

    (scheme ilist) procedure (icaddar (ipair ipair?) ) ⟹ *

    (scheme ilist) procedure (icadddr (ipair ipair?) ) ⟹ *

    (scheme ilist) procedure (icaddr (ipair ipair?) ) ⟹ *

    (scheme ilist) procedure (icdaaar (ipair ipair?) ) ⟹ *

    (scheme ilist) procedure (icdaadr (ipair ipair?) ) ⟹ *

    (scheme ilist) procedure (icdaar (ipair ipair?) ) ⟹ *

    (scheme ilist) procedure (icdadar (ipair ipair?) ) ⟹ *

    (scheme ilist) procedure (icdaddr (ipair ipair?) ) ⟹ *

    (scheme ilist) procedure (icdadr (ipair ipair?) ) ⟹ *

    (scheme ilist) procedure (icddaar (ipair ipair?) ) ⟹ *

    (scheme ilist) procedure (icddadr (ipair ipair?) ) ⟹ *

    (scheme ilist) procedure (icddar (ipair ipair?) ) ⟹ *

    (scheme ilist) procedure (icdddar (ipair ipair?) ) ⟹ *

    (scheme ilist) procedure (icddddr (ipair ipair?) ) ⟹ *

    (scheme ilist) procedure (icdddr (ipair ipair?) ) ⟹ *

    These procedures are compositions of icar and icdr, where for example icaddr could be defined by

    (define icaddr (lambda (x) (icar (icdr (icdr x))))).

    Arbitrary compositions, up to four deep, are provided. There are twenty-eight of these procedures in all.

    (scheme ilist) procedure (ilist-ref (ilist ilist?) (i integer?) ) ⟹ *

    Returns the ith element of ilist. (This is the same as the icar of (idrop ilist i).) It is an error if i >= n, where n is the length of ilist.

    (scheme ilist) procedure (ifirst (ipair ipair?) ) ⟹ *

    (scheme ilist) procedure (isecond (ipair ipair?) ) ⟹ *

    (scheme ilist) procedure (ithird (ipair ipair?) ) ⟹ *

    (scheme ilist) procedure (ifourth (ipair ipair?) ) ⟹ *

    (scheme ilist) procedure (ififth (ipair ipair?) ) ⟹ *

    (scheme ilist) procedure (isixth (ipair ipair?) ) ⟹ *

    (scheme ilist) procedure (iseventh (ipair ipair?) ) ⟹ *

    (scheme ilist) procedure (ieighth (ipair ipair?) ) ⟹ *

    (scheme ilist) procedure (ininth (ipair ipair?) ) ⟹ *

    (scheme ilist) procedure (itenth (ipair ipair?) ) ⟹ *

    Synonyms for car, cadr, caddr, ...

    (scheme ilist) procedure (icar+icdr (ipair ipair?) ) ⟹ (values **)

    The fundamental ipair deconstructor:

    (lambda (p) (values (icar p) (icdr p)))

    This can, of course, be implemented more efficiently by a compiler.

    (scheme ilist) procedure (itake (x ilist?) (i integer?) ) ⟹ ilist?

    (scheme ilist) procedure (itake (x dotted-ilist?) (i integer?) ) ⟹ ilist?

    itake returns the first i elements of ilist x.

    (scheme ilist) procedure (idrop (x ilist?) (i integer?) ) ⟹ ilist?

    (scheme ilist) procedure (idrop (x dotted-ilist?) (i integer?) ) ⟹ *

    (scheme ilist) procedure (ilist-tail (x ilist?) (i integer?) ) ⟹ ilist?

    (scheme ilist) procedure (ilist-tail (x dotted-ilist?) (i integer?) ) ⟹ *

    idrop / ilist-tail returns all but the first i elements of ilist x.

    (scheme ilist) procedure (itake-right (dilist ilist?) (i integer?) ) ⟹ ilist?

    (scheme ilist) procedure (itake-right (dilist dotted-ilist?) (i integer?) ) ⟹ *

    itake-right returns the last i elements of dilist.

    (scheme ilist) procedure (idrop-right (dilist ilist?) (i integer?) ) ⟹ ilist?

    (scheme ilist) procedure (idrop-right (dilist dotted-ilist?) (i integer?) ) ⟹ ilist?

    idrop-right returns all but the last i elements of dilist.

    (scheme ilist) procedure (isplit-at (x ilist?) (i integer?) ) ⟹ (values ilist?ilist?)

    (scheme ilist) procedure (isplit-at (x dotted-ilist?) (i integer?) ) ⟹ (values ilist?*)

    isplit-at splits the ilist x at index i, returning an ilist of the first i elements, and the remaining tail. It is equivalent to

    (values (itake x i) (idrop x i))

    (scheme ilist) procedure (ilast (ipair ilist?) ) ⟹ *

    Returns the last element of the non-empty, possibly dotted, ilist ipair.

    (scheme ilist) procedure (last-ipair (ipair ilist?) ) ⟹ ipair?

    last-ipair returns the last ipair in the non-empty ilist pair.

    (scheme ilist) procedure (ilength (ilist ilist?) ) ⟹ integer?

    Returns the length of its argument. It is an error to pass a value to ilength which is not a proper ilist (()-terminated).

    The length of a proper ilist is a non-negative integer n such that icdr applied n times to the ilist produces the empty list.

    (scheme ilist) procedure (iappend (ilist ilist?) ... ) ⟹ ilist?

    (scheme ilist) procedure (iappend (ilist ilist?) ... obj ) ⟹ *

    Returns an ilist consisting of the elements of ilist1 followed by the elements of the other ilist parameters.

    The resulting ilist is always newly allocated, except that it shares structure with the final ilisti argument. This last argument may be any value at all; an improper ilist results if it is not a proper ilist. All other arguments must be proper ilists.

    (scheme ilist) procedure (iconcatenate (ilist-of-ilists ilist?) ) ⟹ *

    Appends the elements of its argument together. That is, iconcatenate returns

    (iapply iappend ilist-of-ilists)

    or, equivalently,

    (ireduce-right iappend '() ilist-of-ilists)

    Note that some Scheme implementations do not support passing more than a certain number (e.g., 64) of arguments to an n-ary procedure. In these implementations, the (iapply iappend ...) idiom would fail when applied to long lists, but iconcatenate would continue to function properly.

    As with iappend, the last element of the input list may be any value at all.

    (scheme ilist) procedure (ireverse (ilist ilist?) ) ⟹ ilist?

    Returns a newly allocated ilist consisting of the elements of ilist in reverse order.

    (scheme ilist) procedure (iappend-reverse (rev-head ilist?) (tail ilist?) ) ⟹ ilist?

    (scheme ilist) procedure (iappend-reverse (rev-head ilist?) tail ) ⟹ *

    iappend-reverse returns (iappend (ireverse rev-head) tail). It is provided because it is a common operation — a common list-processing style calls for this exact operation to transfer values accumulated in reverse order onto the front of another ilist, and because the implementation is significantly more efficient than the simple composition it replaces. (But note that this pattern of iterative computation followed by a reverse can frequently be rewritten as a recursion, dispensing with the reverse and iappend-reverse steps, and shifting temporary, intermediate storage from the heap to the stack, which is typically a win for reasons of cache locality and eager storage reclamation.)

    (scheme ilist) procedure (izip (ilist1 ilist?) (ilist2 ilist?) ... ) ⟹ ilist?

    (lambda ilists (iapply imap ilist ilists))

    If izip is passed n ilists, it returns an ilist as long as the shortest of these ilists, each element of which is an n-element ilist comprised of the corresponding elements from the parameter ilists.

    (scheme ilist) procedure (iunzip1 (ilist ilist?) ) ⟹ ilist?

    (scheme ilist) procedure (iunzip2 (ilist ilist?) ) ⟹ (values ilist?ilist?)

    (scheme ilist) procedure (iunzip3 (ilist ilist?) ) ⟹ (values ilist?ilist?ilist?)

    (scheme ilist) procedure (iunzip4 (ilist ilist?) ) ⟹ (values ilist?ilist?ilist?ilist?)

    (scheme ilist) procedure (iunzip5 (ilist ilist?) ) ⟹ (values ilist?ilist?ilist?ilist?ilist?)

    iunzip1 takes an ilist of ilists, where every ilist must contain at least one element, and returns an ilist containing the initial element of each such ilist. That is, it returns (imap icar ilists). iunzip2 takes an ilist of ilists, where every ilist must contain at least two elements, and returns two values: an ilist of the first elements, and an ilist of the second elements. iunzip3 does the same for the first three elements of the ilists, and so forth.

    (scheme ilist) procedure (icount (pred procedure?) (ilist1 ilist?) (ilist2 ilist?) ... ) ⟹ integer?

    (pred obj ... ) ⟹ *

    pred is a procedure taking as many arguments as there are ilists and returning a single value. It is applied element-wise to the elements of the ilists, and a count is tallied of the number of elements that produce a true value. This count is returned. count is "iterative" in that it is guaranteed to apply pred to the ilist elements in a left-to-right order. The counting stops when the shortest ilist expires.

    (scheme ilist) procedure (ifold (kons procedure?) knil (ilist1 ilist?) (ilist2 ilist?) ... ) ⟹ *

    (kons obj1 obj2 ... fold-state ) ⟹ *

    The fundamental ilist iterator.

    First, consider the single ilist-parameter case. If ilist1 = (e1 e2 ... en), then this procedure returns

    (kons en ... (kons e2 (kons e1 knil)) ... )

    If n ilist arguments are provided, then the kons function must take n+1 parameters: one element from each ilist, and the "seed" or fold state, which is initially knil. The fold operation terminates when the shortest ilist runs out of values

    (scheme ilist) procedure (ifold-right (kons procedure?) knil (ilist1 ilist?) (ilist2 ilist?) ... ) ⟹ *

    (kons obj1 obj2 ... fold-state ) ⟹ *

    The fundamental ilist recursion operator.

    First, consider the single ilist-parameter case. If ilist1 = (e1 e2 ... en), then this procedure returns

    (kons e1 (kons e2 ... (kons en knil)))

    If n ilist arguments are provided, then the kons procedure must take n+1 parameters: one element from each ilist, and the "seed" or fold state, which is initially knil. The fold operation terminates when the shortest ilist runs out of values

    (scheme ilist) procedure (ipair-fold (kons procedure?) knil (ilist1 ilist?) (ilist2 ilist?) ... ) ⟹ *

    (kons (ipair1 ipair?) (ipair2 ipair?) ... fold-state ) ⟹ *

    Analogous to fold, but kons is applied to successive sub-ilists of the ilists, rather than successive elements — that is, kons is applied to the ipairs making up the lists.

    (scheme ilist) procedure (ipair-fold-right (kons procedure?) knil (ilist1 ilist?) (ilist2 ilist?) ... ) ⟹ *

    (kons (ipair1 ipair?) (ipair2 ipair?) ... fold-state ) ⟹ *

    Holds the same relationship with ifold-right that ipair-fold holds with ifold.

    (scheme ilist) procedure (ireduce (f procedure?) ridentity (ilist ilist?) ) ⟹ *

    (f obj fold-state ) ⟹ *

    ireduce is a variant of ifold.

    ridentity should be a "right identity" of the procedure f - that is, for any value x acceptable to f,

    (f x ridentity) = x

    ireduce has the following definition:

    If ilist = (), return ridentity;

    Otherwise, return (ifold f (icar ilist) (icdr ilist)).

    ...in other words, we compute (ifold f ridentity ilist).

    Note that ridentity is used only in the empty-list case. You typically use ireduce when applying f is expensive and you'd like to avoid the extra application incurred when ifold applies f to the head of ilist and the identity value, redundantly producing the same value passed in to f. For example, if f involves searching a file directory or performing a database query, this can be significant. In general, however, ifold is useful in many contexts where ireduce is not (consider the examples given in the ifold definition — only one of the five folds uses a function with a right identity. The other four may not be performed with ireduce).

    (scheme ilist) procedure (ireduce-right (f procedure?) ridentity (ilist ilist?) ) ⟹ *

    (f obj fold-state ) ⟹ *

    ireduce-right is the fold-right variant of ireduce. It obeys the following definition:

    (ireduce-right f ridentity '()) = ridentity

    (ireduce-right f ridentity (iq e1)) = (f e1 ridentity) = e1

    (ireduce-right f ridentity (iq e1 e2 ...)) =

    (f e1 (ireduce f ridentity (e2 ...)))

    ...in other words, we compute (ifold-right f ridentity ilist).

    (scheme ilist) procedure (iunfold (p procedure?) (f procedure?) (g procedure?) seed ) ⟹ ilist?

    (scheme ilist) procedure (iunfold (p procedure?) (f procedure?) (g procedure?) seed (tail-gen ilist?) ) ⟹ *

    (p seed ) ⟹ boolean?

    (f seed ) ⟹ *

    (g seed ) ⟹ *

    (tail-gen ) ⟹ *

    iunfold is best described by its basic recursion:

    (iunfold p f g seed) =

    (if (p seed) (tail-gen seed)

    (ipair (f seed)

    (iunfold p f g (g seed))))

    p: Determines when to stop unfolding.

    f: Maps each seed value to the corresponding ilist element.

    g: Maps each seed value to next seed value.

    seed: The "state" value for the unfold.

    tail-gen: Creates the tail of the ilist; defaults to (lambda (x) '())

    In other words, we use g to generate a sequence of seed values

    seed, g(seed), g^2(seed), g^3(seed), ...

    These seed values are mapped to ilist elements by f, producing the elements of the result ilist in a left-to-right order. P says when to stop.

    (scheme ilist) procedure (iunfold-right (p procedure?) (f procedure?) (g procedure?) seed ) ⟹ ilist?

    (scheme ilist) procedure (iunfold-right (p procedure?) (f procedure?) (g procedure?) seed (tail-gen ilist?) ) ⟹ *

    (p seed ) ⟹ boolean?

    (f seed ) ⟹ *

    (g seed ) ⟹ *

    (tail-gen ) ⟹ *

    iunfold-right constructs an ilist with the following loop:

    (let lp ((seed seed) (lis tail))

    (if (p seed) lis

    (lp (g seed)

    (ipair (f seed) lis))))

    p: Determines when to stop unfolding.

    f: Maps each seed value to the corresponding ilist element.

    g: Maps each seed value to next seed value.

    seed: The "state" value for the unfold.

    tail: ilist terminator; defaults to '().

    In other words, we use g to generate a sequence of seed values

    seed, g(seed), g2(seed), g3(seed), ...

    These seed values are mapped to ilist elements by f, producing the elements of the result ilist in a right-to-left order. P says when to stop.

    (scheme ilist) procedure (imap (proc procedure?) (ilist1 ilist?) (ilist2 ilist?) ... ) ⟹ ilist?

    (proc obj1 obj2 ... ) ⟹ *

    proc is a procedure taking as many arguments as there are ilist arguments and returning a single value. imap applies proc element-wise to the elements of the ilists and returns an ilist of the results, in order. The dynamic order in which proc is applied to the elements of the ilists is unspecified.

    (scheme ilist) procedure (ifor-each (proc procedure?) (ilist1 ilist?) (ilist2 ilist?) ... ) ⟹ undefined

    (proc obj1 obj2 ... ) ⟹ undefined

    The arguments to ifor-each are like the arguments to imap, but ifor-each calls proc for its side effects rather than for its values. Unlike imap, ifor-each is guaranteed to call proc on the elements of the ilists in order from the first element(s) to the last, and the value returned by ifor-each is unspecified.

    (scheme ilist) procedure (iappend-map (proc procedure?) (ilist1 ilist?) (ilist2 ilist?) ... ) ⟹ ilist?

    (proc obj1 obj2 ... ) ⟹ ilist?

    Equivalent to

    (iapply iappend (imap f ilist1 ilist2 ...))

    and

    (iapply iappend (imap f ilist1 ilist2 ...))

    Map f over the elements of the ilists, just as in the imap function. However, the results of the applications are appended together (using iappend) to make the final result.

    The dynamic order in which the various applications of f are made is not specified.

    (scheme ilist) procedure (imap-in-order (proc procedure?) (ilist1 ilist?) (ilist2 ilist?) ... ) ⟹ ilist?

    (proc obj1 obj2 ... ) ⟹ *

    A variant of the imap procedure that guarantees to apply f across the elements of the ilisti arguments in a left-to-right order. This is useful for mapping procedures that both have side effects and return useful values.

    (scheme ilist) procedure (ipair-for-each (proc procedure?) (ilist1 ilist?) (ilist2 ilist?) ... ) ⟹ undefined

    (proc (obj1 ipair?) (obj2 ipair?) ... ) ⟹ undefined

    Like ifor-each, but f is applied to successive sub-ilists of the argument ilists. That is, f is applied to the cells of the ilists, rather than the ilists' elements. These applications occur in left-to-right order.

    (scheme ilist) procedure (ifilter-map (proc procedure?) (ilist1 ilist?) (ilist2 ilist?) ... ) ⟹ ilist?

    (proc obj1 obj2 ... ) ⟹ *

    Like imap, but only true values are saved.

    (scheme ilist) procedure (ifilter (pred procedure?) (ilist ilist?) ) ⟹ ilist?

    (pred obj ) ⟹ *

    Return all the elements of ilist that satisfy predicate pred. The ilist is not disordered — elements that appear in the result ilist occur in the same order as they occur in the argument ilist. The returned ilist may share a common tail with the argument ilist. The dynamic order in which the various applications of pred are made is not specified.

    (scheme ilist) procedure (ipartition (pred procedure?) (ilist ilist?) ) ⟹ (values ilist?ilist?)

    (pred obj ) ⟹ *

    Partitions the elements of ilist with predicate pred, and returns two values: the ilist of in-elements and the ilist of out-elements. The ilist is not disordered — elements occur in the result ilists in the same order as they occur in the argument ilist. The dynamic order in which the various applications of pred are made is not specified. One of the returned ilists may share a common tail with the argument ilist.

    (scheme ilist) procedure (iremove (pred procedure?) (ilist ilist?) ) ⟹ ilist?

    (pred obj ) ⟹ *

    Returns ilist without the elements that satisfy predicate pred:

    (lambda (pred ilist) (ifilter (lambda (x) (not (pred x))) ilist))

    The ilist is not disordered — elements that appear in the result ilist occur in the same order as they occur in the argument ilist. The returned ilist may share a common tail with the argument ilist. The dynamic order in which the various applications of pred are made is not specified.

    (scheme ilist) procedure (ifind (pred procedure?) (ilist ilist?) ) ⟹ *

    (pred obj ) ⟹ *

    Return the first element of ilist that satisfies predicate pred; false if no element does.

    (ifind even? (iq 3 1 4 1 5 9)) => 4

    Note that ifind has an ambiguity in its lookup semantics — if ifind returns #f, you cannot tell (in general) if it found a #f element that satisfied pred, or if it did not find any element at all. In many situations, this ambiguity cannot arise — either the ilist being searched is known not to contain any #f elements, or the ilist is guaranteed to have an element satisfying pred. However, in cases where this ambiguity can arise, you should use ifind-tail instead of ifind — ifind-tail has no such ambiguity

    (scheme ilist) procedure (ifind-tail (pred procedure?) (ilist ilist?) ) ⟹ ipair? / #f /

    (pred obj ) ⟹ *

    Return the first ipair of ilist whose icar satisfies pred. If no ipair does, return false.

    ifind-tail can be viewed as a general-predicate variant of the imember function.

    Ifind-tail is essentially idrop-while, where the sense of the predicate is inverted: Ifind-tail searches until it finds an element satisfying the predicate; idrop-while searches until it finds an element that doesn't satisfy the predicate.

    (scheme ilist) procedure (itake-while (pred procedure?) (ilist ilist?) ) ⟹ ilist?

    (pred obj ) ⟹ *

    Returns the longest initial prefix of ilist whose elements all satisfy the predicate pred.

    (scheme ilist) procedure (idrop-while (pred procedure?) (ilist ilist?) ) ⟹ ilist?

    (pred obj ) ⟹ *

    idrops the longest initial prefix of ilist whose elements all satisfy the predicate pred, and returns the rest of the ilist.

    (scheme ilist) procedure (ispan (pred procedure?) (ilist ilist?) ) ⟹ (values ilist?ilist?)

    (pred obj ) ⟹ *

    (scheme ilist) procedure (ibreak (pred procedure?) (ilist ilist?) ) ⟹ (values ilist?ilist?)

    (pred obj ) ⟹ *

    ispan splits the ilist into the longest initial prefix whose elements all satisfy pred, and the remaining tail. ibreak inverts the sense of the predicate: the tail commences with the first element of the input ilist that satisfies the predicate.

    In other words: ispan finds the initial span of elements satisfying pred, and ibreak breaks the ilist at the first element satisfying pred.

    (scheme ilist) procedure (iany (pred procedure?) (ilist1 ilist?) (ilist2 ilist?) ... ) ⟹ *

    (pred obj1 obj2 ... ) ⟹ *

    Applies the predicate across the ilists, returning true if the predicate returns true on any application.

    If there are n ilist arguments ilist1 ... ilistn, then pred must be a procedure taking n arguments and returning a boolean result.

    iany applies pred to the first elements of the ilisti parameters. If this application returns a true value, iany immediately returns that value. Otherwise, it iterates, applying pred to the second elements of the ilisti parameters, then the third, and so forth. The iteration stops when a true value is produced or one of the ilists runs out of values; in the latter case, iany returns #f. The application of pred to the last element of the ilists is a tail call.

    Note the difference between ifind and iany — ifind returns the element that satisfied the predicate; iany returns the true value that the predicate produced.

    Like ievery, iany's name does not end with a question mark — this is to indicate that it does not return a simple boolean (#t or #f), but a general value.

    (scheme ilist) procedure (ievery (pred procedure?) (ilist1 ilist?) (ilist2 ilist?) ... ) ⟹ *

    (pred obj1 obj2 ... ) ⟹ *

    Applies the predicate across the ilists, returning true if the predicate returns true on every application.

    If there are n ilist arguments ilist1 ... ilistn, then pred must be a procedure taking n arguments and returning a boolean result.

    ievery applies pred to the first elements of the ilisti parameters. If this application returns false, ievery immediately returns false. Otherwise, it iterates, applying pred to the second elements of the ilisti parameters, then the third, and so forth. The iteration stops when a false value is produced or one of the ilists runs out of values. In the latter case, ievery returns the true value produced by its final application of pred. The application of pred to the last element of the ilists is a tail call.

    If one of the ilisti has no elements, ievery simply returns #t.

    Like iany, ievery's name does not end with a question mark — this is to indicate that it does not return a simple boolean (#t or #f), but a general value.

    (scheme ilist) procedure (ilist-index (pred procedure?) (ilist1 ilist?) (ilist2 ilist?) ... ) ⟹ integer? / #f /

    (pred obj1 obj2 ... ) ⟹ *

    Return the index of the leftmost element that satisfies pred.

    If there are n ilist arguments ilist1 ... ilistn, then pred must be a function taking n arguments and returning a boolean result.

    ilist-index applies pred to the first elements of the ilisti parameters. If this application returns true, ilist-index immediately returns zero. Otherwise, it iterates, applying pred to the second elements of the ilisti parameters, then the third, and so forth. When it finds a tuple of ilist elements that cause pred to return true, it stops and returns the zero-based index of that position in the ilists.

    The iteration stops when one of the ilists runs out of values; in this case, ilist-index returns #f.

    (scheme ilist) procedure (imember obj (ilist ilist?) ) ⟹ #f / ilist? /

    (scheme ilist) procedure (imember obj (ilist ilist?) (= procedure?) ) ⟹ #f / ilist? /

    (= obj1 obj2 ) ⟹ *

    (scheme ilist) procedure (imemq obj (ilist ilist?) ) ⟹ #f / ilist? /

    (scheme ilist) procedure (imemv obj (ilist ilist?) ) ⟹ #f / ilist? /

    These procedures return the first sub-ilist of ilist whose icar is x, where the sub-ilists of ilist are the non-empty ilists returned by (idrop ilist i) for i less than the length of ilist. If x does not occur in ilist, then #f is returned. imemq uses eq? to compare x with the elements of ilist, while imemv uses eqv?, and imember uses equal?.

    The comparison procedure is used to compare the elements ei of ilist to the key x in this way:

    (= x ei) ; ilist is (E1 ... En)

    That is, the first argument is always x, and the second argument is one of the ilist elements.

    (scheme ilist) procedure (idelete obj (ilist ilist?) ) ⟹ ilist?

    (scheme ilist) procedure (idelete obj (ilist ilist?) (= procedure?) ) ⟹ ilist?

    (= obj1 obj2 ) ⟹ *

    idelete uses the comparison procedure =, which defaults to equal?, to find all elements of ilist that are equal to x, and deletes them from ilist. The dynamic order in which the various applications of = are made is not specified.

    The ilist is not disordered — elements that appear in the result ilist occur in the same order as they occur in the argument ilist. The result may share a common tail with the argument ilist.

    The comparison procedure is used in this way: (= x ei). That is, x is always the first argument, and an ilist element is always the second argument. The comparison procedure will be used to compare each element of ilist exactly once; the order in which it is applied to the various ei is not specified.

    (scheme ilist) procedure (idelete-duplicates (ilist ilist?) ) ⟹ ilist?

    (scheme ilist) procedure (idelete-duplicates (ilist ilist?) (= procedure?) ) ⟹ ilist?

    (= obj1 obj2 ) ⟹ *

    idelete-duplicates removes duplicate elements from the ilist argument. If there are multiple equal elements in the argument ilist, the result ilist only contains the first or leftmost of these elements in the result. The order of these surviving elements is the same as in the original ilist — idelete-duplicates does not disorder the ilist (hence it is useful for "cleaning up" immutable association lists).

    The = parameter is used to compare the elements of the ilist; it defaults to equal?. If x comes before y in ilist, then the comparison is performed (= x y). The comparison procedure will be used to compare each pair of elements in ilist no more than once; the order in which it is applied to the various pairs is not specified.

    Implementations of idelete-duplicates are allowed to share common tails between argument and result ilists — for example, if the ilist argument contains only unique elements, it may simply return exactly this ilist.

    Be aware that, in general, idelete-duplicates runs in time O(n2) for n-element ilists. Uniquifying long ilists can be accomplished in O(n lg n) time by sorting the ilist to bring equal elements together, then using a linear-time algorithm to remove equal elements. Alternatively, one can use algorithms based on element-marking, with linear-time results.

    (scheme ilist) procedure (iassoc obj (ialist ilist?) ) ⟹ ilist? / #f /

    (scheme ilist) procedure (iassoc obj (ialist ilist?) (= procedure?) ) ⟹ ipair? / #f /

    (= a b ) ⟹ *

    (scheme ilist) procedure (iassq obj (ialist ilist?) ) ⟹ ipair? / #f /

    (scheme ilist) procedure (iassv obj (ialist ilist?) ) ⟹ ipair? / #f /

    ialist must be an immutable association list — an ilist of ipairs. These procedures find the first ipair in ialist whose icar field is key, and returns that ipair. If no ipair in ialist has key as its icar, then #f is returned. iassq uses eq? to compare key with the icar fields of the ipairs in ialist, while iassv uses eqv? and iassoc uses equal?.

    The comparison procedure is used to compare the elements ei of ilist to the key parameter in this way:

    (= key (icar ei)) ; ilist is (E1 ... En)

    That is, the first argument is always key, and the second argument is one of the ilist elements.

    (scheme ilist) procedure (ialist-cons key datum (ialist ilist?) ) ⟹ ilist?

    (lambda (key datum ialist) (ipair (ipair key datum) ialist))

    Construct a new ialist entry mapping key -> datum onto ialist.

    (scheme ilist) procedure (ialist-delete key (ialist ilist?) ) ⟹ ilist?

    (scheme ilist) procedure (ialist-delete key (ialist ilist?) (= procedure?) ) ⟹ ilist?

    (= a b ) ⟹ *

    ialist-delete deletes all associations from ialist with the given key, using key-comparison procedure =, which defaults to equal?. The dynamic order in which the various applications of = are made is not specified.

    Return values may share common tails with the ialist argument. The ialist is not disordered — elements that appear in the result ialist occur in the same order as they occur in the argument ialist.

    The comparison procedure is used to compare the element keys ki of ialist's entries to the key parameter in this way: (= key ki)

    (scheme ilist) procedure (replace-icar (ipair ipair?) object ) ⟹ ipair?

    This procedure returns an ipair with object in the icar field and the icdr of ipair in the icdr field.

    (scheme ilist) procedure (replace-icdr (ipair ipair?) object ) ⟹ ipair?

    This procedure returns an ipair with object in the icdr field and the icar of ipair in the icar field.

    (scheme ilist) procedure (pair->ipair (pair pair?) ) ⟹ ipair?

    (scheme ilist) procedure (ipair->pair (ipair ipair?) ) ⟹ pair?

    These procedures, which are inverses, return an ipair and a pair respectively that have the same (i)car and (i)cdr fields as the argument.

    (scheme ilist) procedure (list->ilist (flist list?) ) ⟹ ilist?

    (scheme ilist) procedure (list->ilist (flist dotted-list?) ) ⟹ dotted-ilist?

    (scheme ilist) procedure (ilist->list (flist ilist?) ) ⟹ list?

    (scheme ilist) procedure (ilist->list (flist dotted-ilist?) ) ⟹ dotted-list?

    These procedures return an ilist and a list respectively that have the same elements as the argument. The tails of dotted (i)lists are preserved in the result, which makes the procedures not inverses when the tail of a dotted ilist is a list or vice versa. The empty list is converted to itself.

    It is an error to apply list->ilist to a circular list.

    (scheme ilist) procedure (tree->itree (pair pair?) ) ⟹ ipair?

    (scheme ilist) procedure (tree->itree object ) ⟹ *

    (scheme ilist) procedure (itree->tree (ipair ipair?) ) ⟹ pair?

    (scheme ilist) procedure (itree->tree object ) ⟹ *

    These procedures walk a tree of pairs or ipairs respectively and make a deep copy of it, returning an isomorphic tree containing ipairs or pairs respectively. The result may share structure with the argument. If the argument is not of the expected type, it is returned.

    These procedures are not inverses in the general case. For example, a pair of ipairs would be converted by tree->itree to an ipair of ipairs, which if converted by itree->tree would produce a pair of pairs.

    (scheme ilist) procedure (gtree->itree (pair pair?) ) ⟹ ipair?

    (scheme ilist) procedure (gtree->itree object ) ⟹ *

    (scheme ilist) procedure (gtree->tree (ipair ipair?) ) ⟹ pair?

    (scheme ilist) procedure (gtree->tree object ) ⟹ *

    These procedures walk a generalized tree consisting of pairs, ipairs, or a combination of both, and make a deep copy of it, returning an isomorphic tree containing only ipairs or pairs respectively. The result may share structure with the argument. If the argument is neither a pair nor an ipair, it is returned.

    (scheme ilist) procedure (iapply (proc procedure?) arg1 ... (args ilist?) ) ⟹ *

    The iapply procedure is an analogue of apply whose last argument is an ilist rather than a list. It is equivalent to (apply procedure object ... (ilist->list ilist)), but may be implemented more efficiently.

    ipair-comparatorcomparator?

    The ipair-comparator object is a SRFI-114 comparator suitable for comparing ipairs. Note that it is not a procedure. It compares pairs using default-comparator on their cars. If the cars are not equal, that value is returned. If they are equal, default-comparator is used on their cdrs and that value is returned.

    ilist-comparatorcomparator?

    The ilist-comparator object is a SRFI-114 comparator suitable for comparing ilists. Note that it is not a procedure. It compares ilists lexicographically, as follows:

  • The empty ilist compares equal to itself.
  • The empty ilist compares less than any non-empty ilist.
  • Two non-empty ilists are compared by comparing their icars. If the icars are not equal when compared using default-comparator, then the result is the result of that comparison. Otherwise, the icdrs are compared using ilist-comparator.
  • (scheme ilist) procedure (make-ilist-comparator (element-comparator comparator?) ) ⟹ comparator?

    The make-ilist-comparator procedure returns a comparator suitable for comparing ilists using element-comparator to compare the elements.

    (scheme ilist) procedure (make-improper-ilist-comparator (element-comparator comparator?) ) ⟹ comparator?

    The make-improper-ilist-comparator procedure returns a comparator that compares arbitrary objects as follows: the empty list precedes all ipairs, which precede all other objects. Ipairs are compared as if with (make-ipair-comparator comparator comparator). All other objects are compared using comparator.

    (scheme ilist) procedure (make-ipair-comparator (car-comparator comparator?) (cdr-comparator comparator?) ) ⟹ comparator?

    Returns a comparator that compares ipairs first on their icars using icar-comparator. If the icars are equal, it compares the icdrs using icdr-comparator.

    (scheme ilist) procedure (make-icar-comparator (comparator comparator?) ) ⟹ comparator?

    The make-icar-comparator procedure returns a comparator that compares ipairs on their icars alone using comparator.

    (scheme ilist) procedure (make-icdr-comparator (comparator comparator?) ) ⟹ comparator?

    The make-icdr-comparator procedure returns a comparator that compares ipairs on their icdrs alone using comparator.

    library (scheme list)

    (scheme list) procedure (cons a d ) ⟹ pair?

    The primitive constructor. Returns a newly allocated pair whose car is a and whose cdr is d. The pair is guaranteed to be different (in the sense of eqv?) from every existing object.

    (scheme list) procedure (list object ... ) ⟹ list?

    Returns a newly allocated list of its arguments.

    (scheme list) procedure (xcons d a ) ⟹ pair?

    (lambda (d a) (cons a d)) Of utility only as a value to be conveniently passed to higher-order procedures.

    (scheme list) procedure (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.

    (scheme list) procedure (make-list (n integer?) ) ⟹ list?

    (scheme list) procedure (make-list (n integer?) fill ) ⟹ list?

    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.

    (scheme list) procedure (list-tabulate (n integer?) (init-proc procedure?) ) ⟹ list?

    (init-proc (i integer?) ) ⟹ *

    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.

    (scheme list) procedure (list-copy (flist list?) ) ⟹ list?

    (scheme list) procedure (list-copy (flist dotted-list?) ) ⟹ dotted-list?

    Copies the spine of the argument.

    (scheme list) procedure (circular-list elt1 elt2 ... ) ⟹ circular-list?

    Constructs a circular list of the elements.

    (scheme list) procedure (iota (count integer?) ) ⟹ list?

    (scheme list) procedure (iota (count integer?) (start number?) ) ⟹ list?

    (scheme list) procedure (iota (count integer?) (start number?) (step number?) ) ⟹ list?

    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.

    (scheme list) procedure (proper-list? obj ) ⟹ boolean?

    Returns true iff x is a proper list -- a finite, nil-terminated list. More carefully: The empty list is a proper list. A pair whose cdr is a proper list is also a proper list: <proper-list> ::= () | (cons <x> <proper-list>). Note that this definition rules out circular lists. This function is required to detect this case and return false. Nil-terminated lists are called "proper" lists by R5RS and Common Lisp. The opposite of proper is improper.

    (scheme list) procedure (circular-list? obj ) ⟹ boolean?

    True if x is a circular list. A circular list is a value such that for every n >= 0, cdrn(x) is a pair. Terminology: The opposite of circular is finite.

    (scheme list) procedure (dotted-list? obj ) ⟹ boolean?

    True if x is a finite, non-nil-terminated list. That is, there exists an n >= 0 such that cdrn(x) is neither a pair nor (). This includes non-pair, non-() values (e.g. symbols, numbers), which are considered to be dotted lists of length 0.

    (scheme list) procedure (pair? obj ) ⟹ boolean?

    Returns #t if object is a pair; otherwise, #f.

    (scheme list) procedure (null? obj ) ⟹ boolean?

    Returns #t if object is the empty list; otherwise, #f.

    (scheme list) procedure (null-list? (lst list?) ) ⟹ boolean?

    (scheme list) procedure (null-list? (lst circular-list?) ) ⟹ boolean?

    List is a proper or circular list. This procedure returns true if the argument is the empty list (), and false otherwise. It is an error to pass this procedure a value which is not a proper or circular list. This procedure is recommended as the termination condition for list-processing procedures that are not defined on dotted lists.

    (scheme list) procedure (not-pair? obj ) ⟹ boolean?

    (lambda (x) (not (pair? x))). Provided as a procedure as it can be useful as the termination condition for list-processing procedures that wish to handle all finite lists, both proper and dotted.

    (scheme list) procedure (list= (elt= procedure?) (list1 list?) ... ) ⟹ boolean?

    (elt= a b ) ⟹ *

    Determines list equality, given an element-equality procedure. Proper list A equals proper list B if they are of the same length, and their corresponding elements are equal, as determined by elt=. If the element-comparison procedure's first argument is from listi, then its second argument is from listi+1, i.e. it is always called as (elt= a b) for a an element of list A, and b an element of list B. In the n-ary case, every listi is compared to listi+1 (as opposed, for example, to comparing list1 to every listi, for i>1). If there are no list arguments at all, list= simply returns true. It is an error to apply list= to anything except proper lists. While implementations may choose to extend it to circular lists, note that it cannot reasonably be extended to dotted lists, as it provides no way to specify an equality procedure for comparing the list terminators. Note that the dynamic order in which the elt= procedure is applied to pairs of elements is not specified. For example, if list= is applied to three lists, A, B, and C, it may first completely compare A to B, then compare B to C, or it may compare the first elements of A and B, then the first elements of B and C, then the second elements of A and B, and so forth. The equality procedure must be consistent with eq?. That is, it must be the case that (eq? x y) => (elt= x y). Note that this implies that two lists which are eq? are always list=, as well; implementations may exploit this fact to "short-cut" the element-by-element comparisons.

    (scheme list) procedure (caar (pair pair?) ) ⟹ *

    caar, cadr, ..., cddddr These procedures are compositions of car and cdr, where for example caddr could be defined by (define caddr (lambda (x) (car (cdr (cdr x))))).

    (scheme list) procedure (cadr (pair pair?) ) ⟹ *

    caar, cadr, ..., cddddr These procedures are compositions of car and cdr, where for example caddr could be defined by (define caddr (lambda (x) (car (cdr (cdr x))))).

    (scheme list) procedure (car (pair pair?) ) ⟹ *

    car, cdr These functions return the contents of the car and cdr field of their argument, respectively. Note that it is an error to apply them to the empty list.

    (scheme list) procedure (cdar (pair pair?) ) ⟹ *

    caar, cadr, ..., cddddr These procedures are compositions of car and cdr, where for example caddr could be defined by (define caddr (lambda (x) (car (cdr (cdr x))))).

    (scheme list) procedure (cddr (pair pair?) ) ⟹ *

    caar, cadr, ..., cddddr These procedures are compositions of car and cdr, where for example caddr could be defined by (define caddr (lambda (x) (car (cdr (cdr x))))).

    (scheme list) procedure (cdr (pair pair?) ) ⟹ *

    car, cdr These functions return the contents of the car and cdr field of their argument, respectively. Note that it is an error to apply them to the empty list.

    (scheme list) procedure (caaaar (pair pair?) ) ⟹ *

    caar, cadr, ..., cddddr These procedures are compositions of car and cdr, where for example caddr could be defined by (define caddr (lambda (x) (car (cdr (cdr x))))).

    (scheme list) procedure (caaadr (pair pair?) ) ⟹ *

    caar, cadr, ..., cddddr These procedures are compositions of car and cdr, where for example caddr could be defined by (define caddr (lambda (x) (car (cdr (cdr x))))).

    (scheme list) procedure (caaar (pair pair?) ) ⟹ *

    caar, cadr, ..., cddddr These procedures are compositions of car and cdr, where for example caddr could be defined by (define caddr (lambda (x) (car (cdr (cdr x))))).

    (scheme list) procedure (caadar (pair pair?) ) ⟹ *

    caar, cadr, ..., cddddr These procedures are compositions of car and cdr, where for example caddr could be defined by (define caddr (lambda (x) (car (cdr (cdr x))))).

    (scheme list) procedure (caaddr (pair pair?) ) ⟹ *

    caar, cadr, ..., cddddr These procedures are compositions of car and cdr, where for example caddr could be defined by (define caddr (lambda (x) (car (cdr (cdr x))))).

    (scheme list) procedure (caadr (pair pair?) ) ⟹ *

    caar, cadr, ..., cddddr These procedures are compositions of car and cdr, where for example caddr could be defined by (define caddr (lambda (x) (car (cdr (cdr x))))).

    (scheme list) procedure (cadaar (pair pair?) ) ⟹ *

    caar, cadr, ..., cddddr These procedures are compositions of car and cdr, where for example caddr could be defined by (define caddr (lambda (x) (car (cdr (cdr x))))).

    (scheme list) procedure (cadadr (pair pair?) ) ⟹ *

    caar, cadr, ..., cddddr These procedures are compositions of car and cdr, where for example caddr could be defined by (define caddr (lambda (x) (car (cdr (cdr x))))).

    (scheme list) procedure (cadar (pair pair?) ) ⟹ *

    caar, cadr, ..., cddddr These procedures are compositions of car and cdr, where for example caddr could be defined by (define caddr (lambda (x) (car (cdr (cdr x))))).

    (scheme list) procedure (caddar (pair pair?) ) ⟹ *

    caar, cadr, ..., cddddr These procedures are compositions of car and cdr, where for example caddr could be defined by (define caddr (lambda (x) (car (cdr (cdr x))))).

    (scheme list) procedure (cadddr (pair pair?) ) ⟹ *

    caar, cadr, ..., cddddr These procedures are compositions of car and cdr, where for example caddr could be defined by (define caddr (lambda (x) (car (cdr (cdr x))))).

    (scheme list) procedure (caddr (pair pair?) ) ⟹ *

    caar, cadr, ..., cddddr These procedures are compositions of car and cdr, where for example caddr could be defined by (define caddr (lambda (x) (car (cdr (cdr x))))).

    (scheme list) procedure (cdaaar (pair pair?) ) ⟹ *

    caar, cadr, ..., cddddr These procedures are compositions of car and cdr, where for example caddr could be defined by (define caddr (lambda (x) (car (cdr (cdr x))))).

    (scheme list) procedure (cdaadr (pair pair?) ) ⟹ *

    caar, cadr, ..., cddddr These procedures are compositions of car and cdr, where for example caddr could be defined by (define caddr (lambda (x) (car (cdr (cdr x))))).

    (scheme list) procedure (cdaar (pair pair?) ) ⟹ *

    caar, cadr, ..., cddddr These procedures are compositions of car and cdr, where for example caddr could be defined by (define caddr (lambda (x) (car (cdr (cdr x))))).

    (scheme list) procedure (cdadar (pair pair?) ) ⟹ *

    caar, cadr, ..., cddddr These procedures are compositions of car and cdr, where for example caddr could be defined by (define caddr (lambda (x) (car (cdr (cdr x))))).

    (scheme list) procedure (cdaddr (pair pair?) ) ⟹ *

    caar, cadr, ..., cddddr These procedures are compositions of car and cdr, where for example caddr could be defined by (define caddr (lambda (x) (car (cdr (cdr x))))).

    (scheme list) procedure (cdadr (pair pair?) ) ⟹ *

    caar, cadr, ..., cddddr These procedures are compositions of car and cdr, where for example caddr could be defined by (define caddr (lambda (x) (car (cdr (cdr x))))).

    (scheme list) procedure (cddaar (pair pair?) ) ⟹ *

    caar, cadr, ..., cddddr These procedures are compositions of car and cdr, where for example caddr could be defined by (define caddr (lambda (x) (car (cdr (cdr x))))).

    (scheme list) procedure (cddadr (pair pair?) ) ⟹ *

    caar, cadr, ..., cddddr These procedures are compositions of car and cdr, where for example caddr could be defined by (define caddr (lambda (x) (car (cdr (cdr x))))).

    (scheme list) procedure (cddar (pair pair?) ) ⟹ *

    caar, cadr, ..., cddddr These procedures are compositions of car and cdr, where for example caddr could be defined by (define caddr (lambda (x) (car (cdr (cdr x))))).

    (scheme list) procedure (cdddar (pair pair?) ) ⟹ *

    caar, cadr, ..., cddddr These procedures are compositions of car and cdr, where for example caddr could be defined by (define caddr (lambda (x) (car (cdr (cdr x))))).

    (scheme list) procedure (cddddr (pair pair?) ) ⟹ *

    caar, cadr, ..., cddddr These procedures are compositions of car and cdr, where for example caddr could be defined by (define caddr (lambda (x) (car (cdr (cdr x))))).

    (scheme list) procedure (cdddr (pair pair?) ) ⟹ *

    caar, cadr, ..., cddddr These procedures are compositions of car and cdr, where for example caddr could be defined by (define caddr (lambda (x) (car (cdr (cdr x))))).

    (scheme list) procedure (list-ref (clist list?) (i integer?) ) ⟹ *

    (scheme list) procedure (list-ref (clist circular-list?) (i integer?) ) ⟹ *

    Returns the ith element of clist. (This is the same as the car of (drop clist i).) It is an error if i >= n, where n is the length of clist.

    (scheme list) procedure (first (pair pair?) ) ⟹ *

    (scheme list) procedure (second (pair pair?) ) ⟹ *

    (scheme list) procedure (third (pair pair?) ) ⟹ *

    (scheme list) procedure (fourth (pair pair?) ) ⟹ *

    (scheme list) procedure (fifth (pair pair?) ) ⟹ *

    (scheme list) procedure (sixth (pair pair?) ) ⟹ *

    (scheme list) procedure (seventh (pair pair?) ) ⟹ *

    (scheme list) procedure (eighth (pair pair?) ) ⟹ *

    (scheme list) procedure (ninth (pair pair?) ) ⟹ *

    (scheme list) procedure (tenth (pair pair?) ) ⟹ *

    Synonyms for car, cadr, caddr, ...

    (scheme list) procedure (car+cdr (pair pair?) ) ⟹ (values **)

    The fundamental pair deconstructor: (lambda (p) (values (car p) (cdr p)))

    (scheme list) procedure (take (x list?) (i integer?) ) ⟹ list?

    (scheme list) procedure (take (x circular-list?) (i integer?) ) ⟹ list?

    (scheme list) procedure (take (x dotted-list?) (i integer?) ) ⟹ list?

    take, drop take returns the first i elements of list x. drop returns all but the first i elements of list x. x may be any value -- a proper, circular, or dotted list. For a legal i, take and drop partition the list in a manner which can be inverted with append: (append (take x i) (drop x i)) = x. drop is exactly equivalent to performing i cdr operations on x; the returned value shares a common tail with x. If the argument is a list of non-zero length, take is guaranteed to return a freshly-allocated list, even in the case where the entire list is taken, e.g. (take lis (length lis)).

    (scheme list) procedure (drop (x list?) (i integer?) ) ⟹ list?

    (scheme list) procedure (drop (x circular-list?) (i integer?) ) ⟹ circular-list?

    (scheme list) procedure (drop (x dotted-list?) (i integer?) ) ⟹ *

    take, drop take returns the first i elements of list x. drop returns all but the first i elements of list x. x may be any value -- a proper, circular, or dotted list. For a legal i, take and drop partition the list in a manner which can be inverted with append: (append (take x i) (drop x i)) = x. drop is exactly equivalent to performing i cdr operations on x; the returned value shares a common tail with x. If the argument is a list of non-zero length, take is guaranteed to return a freshly-allocated list, even in the case where the entire list is taken, e.g. (take lis (length lis)).

    (scheme list) procedure (take-right (flist list?) (i integer?) ) ⟹ list?

    (scheme list) procedure (take-right (flist dotted-list?) (i integer?) ) ⟹ *

    take-right, drop right take-right returns the last i elements of flist. drop-right returns all but the last i elements of flist. The returned list may share a common tail with the argument list. flist may be any finite list, either proper or dotted. For a legal i, take-right and drop-right partition the list in a manner which can be inverted with append: (append (take flist i) (drop flist i)) = flist. take-right's return value is guaranteed to share a common tail with flist. If the argument is a list of non-zero length, drop-right is guaranteed to return a freshly-allocated list, even in the case where nothing is dropped, e.g. (drop-right lis 0).

    (scheme list) procedure (drop-right (flist list?) (i integer?) ) ⟹ list?

    (scheme list) procedure (drop-right (flist dotted-list?) (i integer?) ) ⟹ list?

    take-right, drop right take-right returns the last i elements of flist. drop-right returns all but the last i elements of flist. The returned list may share a common tail with the argument list. flist may be any finite list, either proper or dotted. For a legal i, take-right and drop-right partition the list in a manner which can be inverted with append: (append (take flist i) (drop flist i)) = flist. take-right's return value is guaranteed to share a common tail with flist. If the argument is a list of non-zero length, drop-right is guaranteed to return a freshly-allocated list, even in the case where nothing is dropped, e.g. (drop-right lis 0).

    (scheme list) procedure (take! (x list?) (i integer?) ) ⟹ list?

    (scheme list) procedure (take! (x circular-list?) (i integer?) ) ⟹ list?

    (scheme list) procedure (take! (x dotted-list?) (i integer?) ) ⟹ list?

    take!, drop-right! take! and drop-right! are "linear-update" variants of take and drop-right: the procedure is allowed, but not required, to alter the argument list to produce the result. If x is circular, take! may return a shorter-than-expected list

    (scheme list) procedure (drop-right! (flist list?) (i integer?) ) ⟹ list?

    (scheme list) procedure (drop-right! (flist dotted-list?) (i integer?) ) ⟹ list?

    take!, drop-right! take! and drop-right! are "linear-update" variants of take and drop-right: the procedure is allowed, but not required, to alter the argument list to produce the result. If x is circular, take! may return a shorter-than-expected list

    (scheme list) procedure (split-at (x list?) (i integer?) ) ⟹ (values list?list?)

    (scheme list) procedure (split-at (x circular-list?) (i integer?) ) ⟹ (values list?circular-list?)

    (scheme list) procedure (split-at (x dotted-list?) (i integer?) ) ⟹ (values list?*)

    split-at, split-at! split-at splits the list x at index i, returning a list of the first i elements, and the remaining tail. It is equivalent to (values (take x i) (drop x i)). split-at! is the linear-update variant. It is allowed, but not required, to alter the argument list to produce the result.

    (scheme list) procedure (split-at! (x list?) (i integer?) ) ⟹ (values list?list?)

    (scheme list) procedure (split-at! (x circular-list?) (i integer?) ) ⟹ (values list?circular-list?)

    (scheme list) procedure (split-at! (x dotted-list?) (i integer?) ) ⟹ (values list?*)

    split-at, split-at! split-at splits the list x at index i, returning a list of the first i elements, and the remaining tail. It is equivalent to (values (take x i) (drop x i)). split-at! is the linear-update variant. It is allowed, but not required, to alter the argument list to produce the result.

    (scheme list) procedure (last (pair list?) ) ⟹ *

    last, last-pair last returns the last element of the non-empty, finite list pair. last-pair returns the last pair in the non-empty, finite list pair.

    (scheme list) procedure (last-pair (pair list?) ) ⟹ pair?

    last, last-pair last returns the last element of the non-empty, finite list pair. last-pair returns the last pair in the non-empty, finite list pair.

    (scheme list) procedure (length (list list?) ) ⟹ integer?

    length, length+ Both length and length+ return the length of the argument. It is an error to pass a value to length which is not a proper list (finite and nil-terminated). In particular, this means an implementation may diverge or signal an error when length is applied to a circular list. length+, on the other hand, returns #F when applied to a circular list. The length of a proper list is a non-negative integer n such that cdr applied n times to the list produces the empty list.

    (scheme list) procedure (length+ (clist list?) ) ⟹ integer?

    (scheme list) procedure (length+ (clist circular-list?) ) ⟹ boolean?

    length, length+ Both length and length+ return the length of the argument. It is an error to pass a value to length which is not a proper list (finite and nil-terminated). In particular, this means an implementation may diverge or signal an error when length is applied to a circular list. length+, on the other hand, returns #F when applied to a circular list. The length of a proper list is a non-negative integer n such that cdr applied n times to the list produces the empty list.

    (scheme list) procedure (append (list list?) ... ) ⟹ list?

    (scheme list) procedure (append (list list?) ... obj ) ⟹ *

    append, append! append returns a list consisting of the elements of list1 followed by the elements of the other list parameters. The resulting list is always newly allocated, except that it shares structure with the final listi argument. This last argument may be any value at all; an improper list results if it is not a proper list. All other arguments must be proper lists. append! is the "linear-update" variant of append -- it is allowed, but not required, to alter cons cells in the argument lists to construct the result list. The last argument is never altered; the result list shares structure with this parameter.

    (scheme list) procedure (append! (list list?) ... ) ⟹ list?

    (scheme list) procedure (append! (list list?) ... obj ) ⟹ *

    append, append! append returns a list consisting of the elements of list1 followed by the elements of the other list parameters. The resulting list is always newly allocated, except that it shares structure with the final listi argument. This last argument may be any value at all; an improper list results if it is not a proper list. All other arguments must be proper lists. append! is the "linear-update" variant of append -- it is allowed, but not required, to alter cons cells in the argument lists to construct the result list. The last argument is never altered; the result list shares structure with this parameter.

    (scheme list) procedure (concatenate (list-of-lists list?) ) ⟹ *

    list-of-lists ⟹ (list (lst list?))

    concatenate, concatenate! These functions append the elements of their argument together. That is, concatenate returns (apply append list-of-lists) or, equivalently, (reduce-right append '() list-of-lists). concatenate! is the linear-update variant, defined in terms of append! instead of append. Note that some Scheme implementations do not support passing more than a certain number (e.g., 64) of arguments to an n-ary procedure. In these implementations, the (apply append ...) idiom would fail when applied to long lists, but concatenate would continue to function properly. As with append and append!, the last element of the input list may be any value at all.

    (scheme list) procedure (concatenate! (list-of-lists list?) ) ⟹ *

    list-of-lists ⟹ (list (lst list?))

    concatenate, concatenate! These functions append the elements of their argument together. That is, concatenate returns (apply append list-of-lists) or, equivalently, (reduce-right append '() list-of-lists). concatenate! is the linear-update variant, defined in terms of append! instead of append. Note that some Scheme implementations do not support passing more than a certain number (e.g., 64) of arguments to an n-ary procedure. In these implementations, the (apply append ...) idiom would fail when applied to long lists, but concatenate would continue to function properly. As with append and append!, the last element of the input list may be any value at all.

    (scheme list) procedure (reverse (list list?) ) ⟹ list?

    reverse, reverse! reverse returns a newly allocated list consisting of the elements of list in reverse order. reverse! is the linear-update variant of reverse. It is permitted, but not required, to alter the argument's cons cells to produce the reversed list.

    (scheme list) procedure (reverse! (list list?) ) ⟹ list?

    reverse, reverse! reverse returns a newly allocated list consisting of the elements of list in reverse order. reverse! is the linear-update variant of reverse. It is permitted, but not required, to alter the argument's cons cells to produce the reversed list.

    (scheme list) procedure (append-reverse (rev-head list?) (tail list?) ) ⟹ list?

    (scheme list) procedure (append-reverse (rev-head list?) tail ) ⟹ *

    append-reverse, append-reverse! append-reverse returns (append (reverse rev-head) tail). It is provided because it is a common operation -- a common list-processing style calls for this exact operation to transfer values accumulated in reverse order onto the front of another list, and because the implementation is significantly more efficient than the simple composition it replaces. (But note that this pattern of iterative computation followed by a reverse can frequently be rewritten as a recursion, dispensing with the reverse and append-reverse steps, and shifting temporary, intermediate storage from the heap to the stack, which is typically a win for reasons of cache locality and eager storage reclamation.) append-reverse! is just the linear-update variant -- it is allowed, but not required, to alter rev-head's cons cells to construct the result.

    (scheme list) procedure (append-reverse! (rev-head list?) (tail list?) ) ⟹ list?

    (scheme list) procedure (append-reverse! (rev-head list?) tail ) ⟹ *

    append-reverse, append-reverse! append-reverse returns (append (reverse rev-head) tail). It is provided because it is a common operation -- a common list-processing style calls for this exact operation to transfer values accumulated in reverse order onto the front of another list, and because the implementation is significantly more efficient than the simple composition it replaces. (But note that this pattern of iterative computation followed by a reverse can frequently be rewritten as a recursion, dispensing with the reverse and append-reverse steps, and shifting temporary, intermediate storage from the heap to the stack, which is typically a win for reasons of cache locality and eager storage reclamation.) append-reverse! is just the linear-update variant -- it is allowed, but not required, to alter rev-head's cons cells to construct the result.

    (scheme list) procedure (zip (clist1 list?) (clist2 list?) ... ) ⟹ list?

    (lambda lists (apply map list lists)). If zip is passed n lists, it returns a list as long as the shortest of these lists, each element of which is an n-element list comprised of the corresponding elements from the parameter lists. At least one of the argument lists must be finite.

    (scheme list) procedure (unzip1 (list list?) ) ⟹ list?

    unzip1 takes a list of lists, where every list must contain at least one element, and returns a list containing the initial element of each such list. That is, it returns (map car lists). unzip2 takes a list of lists, where every list must contain at least two elements, and returns two values: a list of the first elements, and a list of the second elements. unzip3 does the same for the first three elements of the lists, and so forth.

    (scheme list) procedure (unzip2 (list list?) ) ⟹ (values list?list?)

    unzip1 takes a list of lists, where every list must contain at least one element, and returns a list containing the initial element of each such list. That is, it returns (map car lists). unzip2 takes a list of lists, where every list must contain at least two elements, and returns two values: a list of the first elements, and a list of the second elements. unzip3 does the same for the first three elements of the lists, and so forth.

    (scheme list) procedure (unzip3 (list list?) ) ⟹ (values list?list?list?)

    unzip1 takes a list of lists, where every list must contain at least one element, and returns a list containing the initial element of each such list. That is, it returns (map car lists). unzip2 takes a list of lists, where every list must contain at least two elements, and returns two values: a list of the first elements, and a list of the second elements. unzip3 does the same for the first three elements of the lists, and so forth.

    (scheme list) procedure (unzip4 (list list?) ) ⟹ (values list?list?list?list?)

    unzip1 takes a list of lists, where every list must contain at least one element, and returns a list containing the initial element of each such list. That is, it returns (map car lists). unzip2 takes a list of lists, where every list must contain at least two elements, and returns two values: a list of the first elements, and a list of the second elements. unzip3 does the same for the first three elements of the lists, and so forth.

    (scheme list) procedure (unzip5 (list list?) ) ⟹ (values list?list?list?list?list?)

    unzip1 takes a list of lists, where every list must contain at least one element, and returns a list containing the initial element of each such list. That is, it returns (map car lists). unzip2 takes a list of lists, where every list must contain at least two elements, and returns two values: a list of the first elements, and a list of the second elements. unzip3 does the same for the first three elements of the lists, and so forth.

    (scheme list) procedure (count (pred procedure?) (clist1 list?) (clist2 list?) ... ) ⟹ integer?

    (pred obj ... ) ⟹ *

    pred is a procedure taking as many arguments as there are lists and returning a single value. It is applied element-wise to the elements of the lists, and a count is tallied of the number of elements that produce a true value. This count is returned. count is "iterative" in that it is guaranteed to apply pred to the list elements in a left-to-right order. The counting stops when the shortest list expires. At least one of the argument lists must be finite.

    (scheme list) procedure (fold (kons procedure?) knil (clist1 list?) (clist2 list?) ... ) ⟹ *

    (kons obj1 obj2 ... fold-state ) ⟹ *

    The fundamental list iterator. First, consider the single list-parameter case. If clist1 = (e1 e2 ... en), then this procedure returns (kons en ... (kons e2 (kons e1 knil)) ... ). If n list arguments are provided, then the kons function must take n+1 parameters: one element from each list, and the "seed" or fold state, which is initially knil. The fold operation terminates when the shortest list runs out of values. At least one of the list arguments must be finite.

    (scheme list) procedure (fold-right (kons procedure?) knil (clist1 list?) (clist2 list?) ... ) ⟹ *

    (kons obj1 obj2 ... fold-state ) ⟹ *

    The fundamental list recursion operator. First, consider the single list-parameter case. If clist1 = (e1 e2 ... en), then this procedure returns (kons e1 (kons e2 ... (kons en knil))). If n list arguments are provided, then the kons function must take n+1 parameters: one element from each list, and the "seed" or fold state, which is initially knil. The fold operation terminates when the shortest list runs out of values. At least one of the list arguments must be finite.

    (scheme list) procedure (pair-fold (kons procedure?) knil (clist1 list?) (clist2 list?) ... ) ⟹ *

    (kons (pair1 pair?) (pair2 pair?) ... fold-state ) ⟹ *

    Analogous to fold, but kons is applied to successive sublists of the lists, rather than successive elements -- that is, kons is applied to the pairs making up the lists. For finite lists, the kons function may reliably apply set-cdr! to the pairs it is given without altering the sequence of execution. At least one of the list arguments must be finite.

    (scheme list) procedure (pair-fold-right (kons procedure?) knil (clist1 list?) (clist2 list?) ... ) ⟹ *

    (kons (pair1 pair?) (pair2 pair?) ... fold-state ) ⟹ *

    Holds the same relationship with fold-right that pair-fold holds with fold. At least one of the list arguments must be finite.

    (scheme list) procedure (reduce (f procedure?) ridentity (list list?) ) ⟹ *

    (f obj fold-state ) ⟹ *

    reduce is a variant of fold. ridentity should be a "right identity" of the procedure f -- that is, for any value x acceptable to f, (f x ridentity) = x. reduce has the following definition: If list = (), return ridentity; Otherwise, return (fold f (car list) (cdr list)). ...in other words, we compute (fold f ridentity list). Note that ridentity is used only in the empty-list case. You typically use reduce when applying f is expensive and you'd like to avoid the extra application incurred when fold applies f to the head of list and the identity value, redundantly producing the same value passed in to f. For example, if f involves searching a file directory or performing a database query, this can be significant. In general, however, fold is useful in many contexts where reduce is not (consider the examples given in the fold definition -- only one of the five folds uses a function with a right identity. The other four may not be performed with reduce). Note: MIT Scheme and Haskell flip F's arg order for their reduce and fold functions.

    (scheme list) procedure (reduce-right (f procedure?) ridentity (list list?) ) ⟹ *

    (f obj fold-state ) ⟹ *

    reduce-right is the fold-right variant of reduce.

    (scheme list) procedure (unfold (p procedure?) (f procedure?) (g procedure?) seed ) ⟹ list?

    (scheme list) procedure (unfold (p procedure?) (f procedure?) (g procedure?) seed (tail-gen list?) ) ⟹ *

    (p seed ) ⟹ boolean?

    (f seed ) ⟹ *

    (g seed ) ⟹ *

    (tail-gen ) ⟹ *

    unfold is best described by its basic recursion: (unfold p f g seed) = (if (p seed) (tail-gen seed) (cons (f seed) (unfold p f g (g seed)))). p determines when to stop unfolding. f maps each seed value to the corresponding list element. g maps each seed value to next seed value. seed the "state" value for the unfold. tail-gen creates the tail of the list; defaults to (lambda (x) '()). In other words, we use g to generate a sequence of seed values seed, g(seed), g2(seed), g3(seed), ... These seed values are mapped to list elements by f, producing the elements of the result list in a left-to-right order. P says when to stop. unfold is the fundamental recursive list constructor, just as fold-right is the fundamental recursive list consumer.

    (scheme list) procedure (unfold-right (p procedure?) (f procedure?) (g procedure?) seed ) ⟹ list?

    (scheme list) procedure (unfold-right (p procedure?) (f procedure?) (g procedure?) seed (tail-gen list?) ) ⟹ *

    (p seed ) ⟹ boolean?

    (f seed ) ⟹ *

    (g seed ) ⟹ *

    (tail-gen ) ⟹ *

    unfold-right constructs a list with the following loop: (let lp ((seed seed) (lis tail)) (if (p seed) lis (lp (g seed) (cons (f seed) lis)))). p determines when to stop unfolding. f maps each seed value to the corresponding list element. g maps each seed value to next seed value. seed the "state" value for the unfold. tail list terminator; defaults to '(). In other words, we use g to generate a sequence of seed values seed, g(seed), g2(seed), g3(seed), ... These seed values are mapped to list elements by f, producing the elements of the result list in a right-to-left order. P says when to stop. unfold-right is the fundamental iterative list constructor, just as fold is the fundamental iterative list consumer.

    (scheme list) procedure (map (proc procedure?) (list1 list?) (list2 list?) ... ) ⟹ list?

    (proc obj1 obj2 ... ) ⟹ *

    proc is a procedure taking as many arguments as there are list arguments and returning a single value. map applies proc element-wise to the elements of the lists and returns a list of the results, in order. The dynamic order in which proc is applied to the elements of the lists is unspecified. his procedure is extended from its R5RS specification to allow the arguments to be of unequal length; it terminates when the shortest list runs out. At least one of the argument lists must be finite.

    (scheme list) procedure (for-each (proc procedure?) (list1 list?) (list2 list?) ... ) ⟹ undefined

    (proc obj1 obj2 ... ) ⟹ undefined

    The arguments to for-each are like the arguments to map, but for-each calls proc for its side effects rather than for its values. Unlike map, for-each is guaranteed to call proc on the elements of the lists in order from the first element(s) to the last, and the value returned by for-each is unspecified. This procedure is extended from its R5RS specification to allow the arguments to be of unequal length; it terminates when the shortest list runs out. At least one of the argument lists must be finite.

    (scheme list) procedure (append-map (proc procedure?) (list1 list?) (list2 list?) ... ) ⟹ list?

    (proc obj1 obj2 ... ) ⟹ list?

    append-map, append-map! Equivalent to (apply append (map f clist1 clist2 ...)) and (apply append! (map f clist1 clist2 ...)). Map f over the elements of the lists, just as in the map function. However, the results of the applications are appended together to make the final result. append-map uses append to append the results together; append-map! uses append!. The dynamic order in which the various applications of f are made is not specified.

    (scheme list) procedure (append-map! (proc procedure?) (list1 list?) (list2 list?) ... ) ⟹ list?

    (proc obj1 objs2 ... ) ⟹ list?

    append-map, append-map! Equivalent to (apply append (map f clist1 clist2 ...)) and (apply append! (map f clist1 clist2 ...)). Map f over the elements of the lists, just as in the map function. However, the results of the applications are appended together to make the final result. append-map uses append to append the results together; append-map! uses append!. The dynamic order in which the various applications of f are made is not specified.

    (scheme list) procedure (map! (proc procedure?) (list1 list?) (list2 list?) ... ) ⟹ list?

    (proc obj1 obj2 ... ) ⟹ *

    Linear-update variant of map -- map! is allowed, but not required, to alter the cons cells of list1 to construct the result list. The dynamic order in which the various applications of f are made is not specified. In the n-ary case, clist2, clist3, ... must have at least as many elements as list1.

    (scheme list) procedure (map-in-order (proc procedure?) (list1 list?) (list2 list?) ... ) ⟹ list?

    (proc obj1 obj2 ... ) ⟹ *

    A variant of the map procedure that guarantees to apply f across the elements of the listi arguments in a left-to-right order. This is useful for mapping procedures that both have side effects and return useful values. At least one of the list arguments must be finite.

    (scheme list) procedure (pair-for-each (proc procedure?) (list1 list?) (list2 list?) ... ) ⟹ undefined

    (proc (obj1 pair?) (obj2 pair?) ... ) ⟹ undefined

    Like for-each, but f is applied to successive sublists of the argument lists. That is, f is applied to the cons cells of the lists, rather than the lists' elements. These applications occur in left-to-right order. The f procedure may reliably apply set-cdr! to the pairs it is given without altering the sequence of execution.

    (scheme list) procedure (filter-map (proc procedure?) (list1 list?) (list2 list?) ... ) ⟹ list?

    (proc obj1 obj2 ... ) ⟹ *

    Like map, but only true values are saved. The dynamic order in which the various applications of f are made is not specified. At least one of the list arguments must be finite.

    (scheme list) procedure (filter (pred procedure?) (list list?) ) ⟹ list?

    (pred obj ) ⟹ *

    Return all the elements of list that satisfy predicate pred. The list is not disordered -- elements that appear in the result list occur in the same order as they occur in the argument list. The returned list may share a common tail with the argument list. The dynamic order in which the various applications of pred are made is not specified.

    (scheme list) procedure (filter! (pred procedure?) (list list?) ) ⟹ list?

    (pred obj ) ⟹ *

    filter!, partition!, remove! Linear-update variants of filter, partition and remove. These procedures are allowed, but not required, to alter the cons cells in the argument list to construct the result lists.

    (scheme list) procedure (partition (pred procedure?) (list list?) ) ⟹ (values list?list?)

    (pred obj ) ⟹ *

    Partitions the elements of list with predicate pred, and returns two values: the list of in-elements and the list of out-elements. The list is not disordered -- elements occur in the result lists in the same order as they occur in the argument list. The dynamic order in which the various applications of pred are made is not specified. One of the returned lists may share a common tail with the argument list.

    (scheme list) procedure (partition! (pred procedure?) (list list?) ) ⟹ (values list?list?)

    (pred obj ) ⟹ *

    filter!, partition!, remove! Linear-update variants of filter, partition and remove. These procedures are allowed, but not required, to alter the cons cells in the argument list to construct the result lists.

    (scheme list) procedure (remove (pred procedure?) (list list?) ) ⟹ list?

    (pred obj ) ⟹ *

    Returns list without the elements that satisfy predicate pred: (lambda (pred list) (filter (lambda (x) (not (pred x))) list)). The list is not disordered -- elements that appear in the result list occur in the same order as they occur in the argument list. The returned list may share a common tail with the argument list. The dynamic order in which the various applications of pred are made is not specified.

    (scheme list) procedure (remove! (pred procedure?) (list list?) ) ⟹ list?

    (pred obj ) ⟹ *

    filter!, partition!, remove! Linear-update variants of filter, partition and remove. These procedures are allowed, but not required, to alter the cons cells in the argument list to construct the result lists.

    (scheme list) procedure (find (pred procedure?) (list list?) ) ⟹ *

    (pred obj ) ⟹ *

    Return the first element of clist that satisfies predicate pred; false if no element does. Note that find has an ambiguity in its lookup semantics -- if find returns #f, you cannot tell (in general) if it found a #f element that satisfied pred, or if it did not find any element at all. In many situations, this ambiguity cannot arise -- either the list being searched is known not to contain any #f elements, or the list is guaranteed to have an element satisfying pred. However, in cases where this ambiguity can arise, you should use find-tail instead of find -- find-tail has no such ambiguity.

    (scheme list) procedure (find-tail (pred procedure?) (list list?) ) ⟹ pair? / #f /

    (pred obj ) ⟹ *

    Return the first pair of clist whose car satisfies pred. If no pair does, return false. find-tail can be viewed as a general-predicate variant of the member function. In the circular-list case, this procedure "rotates" the list. Find-tail is essentially drop-while, where the sense of the predicate is inverted: Find-tail searches until it finds an element satisfying the predicate; drop-while searches until it finds an element that doesn't satisfy the predicate.

    (scheme list) procedure (take-while (pred procedure?) (list list?) ) ⟹ list?

    (pred obj ) ⟹ *

    take-while, take-while! Returns the longest initial prefix of clist whose elements all satisfy the predicate pred. Take-while! is the linear-update variant. It is allowed, but not required, to alter the argument list to produce the result.

    (scheme list) procedure (take-while! (pred procedure?) (list list?) ) ⟹ list?

    (pred obj ) ⟹ *

    take-while, take-while! Returns the longest initial prefix of clist whose elements all satisfy the predicate pred. Take-while! is the linear-update variant. It is allowed, but not required, to alter the argument list to produce the result.

    (scheme list) procedure (drop-while (pred procedure?) (list list?) ) ⟹ list?

    (scheme list) procedure (drop-while (pred procedure?) (list circular-list?) ) ⟹ circular-list?

    (pred obj ) ⟹ *

    Drops the longest initial prefix of clist whose elements all satisfy the predicate pred, and returns the rest of the list. The circular-list case may be viewed as "rotating" the list.

    (scheme list) procedure (span (pred procedure?) (list list?) ) ⟹ (values list?list?)

    (scheme list) procedure (span (pred procedure?) (list circular-list?) ) ⟹ (values list?circular-list?)

    (pred obj ) ⟹ *

    span, span!, break, break! Span splits the list into the longest initial prefix whose elements all satisfy pred, and the remaining tail. Break inverts the sense of the predicate: the tail commences with the first element of the input list that satisfies the predicate. In other words: span finds the intial span of elements satisfying pred, and break breaks the list at the first element satisfying pred. Span is equivalent to (values (take-while pred clist) (drop-while pred clist)). Span! and break! are the linear-update variants. They are allowed, but not required, to alter the argument list to produce the result.

    (scheme list) procedure (span! (pred procedure?) (list list?) ) ⟹ (values list?list?)

    (pred obj ) ⟹ *

    span, span!, break, break! Span splits the list into the longest initial prefix whose elements all satisfy pred, and the remaining tail. Break inverts the sense of the predicate: the tail commences with the first element of the input list that satisfies the predicate. In other words: span finds the intial span of elements satisfying pred, and break breaks the list at the first element satisfying pred. Span is equivalent to (values (take-while pred clist) (drop-while pred clist)). Span! and break! are the linear-update variants. They are allowed, but not required, to alter the argument list to produce the result.

    (scheme list) procedure (break (pred procedure?) (list list?) ) ⟹ (values list?list?)

    (scheme list) procedure (break (pred procedure?) (list circular-list?) ) ⟹ (values list?circular-list?)

    (pred obj ) ⟹ *

    span, span!, break, break! Span splits the list into the longest initial prefix whose elements all satisfy pred, and the remaining tail. Break inverts the sense of the predicate: the tail commences with the first element of the input list that satisfies the predicate. In other words: span finds the intial span of elements satisfying pred, and break breaks the list at the first element satisfying pred. Span is equivalent to (values (take-while pred clist) (drop-while pred clist)). Span! and break! are the linear-update variants. They are allowed, but not required, to alter the argument list to produce the result.

    (scheme list) procedure (break! (pred procedure?) (list list?) ) ⟹ (values list?list?)

    (pred obj ) ⟹ *

    span, span!, break, break! Span splits the list into the longest initial prefix whose elements all satisfy pred, and the remaining tail. Break inverts the sense of the predicate: the tail commences with the first element of the input list that satisfies the predicate. In other words: span finds the intial span of elements satisfying pred, and break breaks the list at the first element satisfying pred. Span is equivalent to (values (take-while pred clist) (drop-while pred clist)). Span! and break! are the linear-update variants. They are allowed, but not required, to alter the argument list to produce the result.

    (scheme list) procedure (any (pred procedure?) (clist1 list?) (clist2 list?) ... ) ⟹ *

    (pred obj1 obj2 ... ) ⟹ *

    Applies the predicate across the lists, returning true if the predicate returns true on any application. If there are n list arguments clist1 ... clistn, then pred must be a procedure taking n arguments and returning a single value, interpreted as a boolean (that is, #f means false, and any other value means true). any applies pred to the first elements of the clisti parameters. If this application returns a true value, any immediately returns that value. Otherwise, it iterates, applying pred to the second elements of the clisti parameters, then the third, and so forth. The iteration stops when a true value is produced or one of the lists runs out of values; in the latter case, any returns #f. The application of pred to the last element of the lists is a tail call. Note the difference between find and any -- find returns the element that satisfied the predicate; any returns the true value that the predicate produced. Like every, any's name does not end with a question mark -- this is to indicate that it does not return a simple boolean (#t or #f), but a general value.

    (scheme list) procedure (every (pred procedure?) (clist1 list?) (clist2 list?) ... ) ⟹ *

    (pred obj1 obj2 ... ) ⟹ *

    Applies the predicate across the lists, returning true if the predicate returns true on every application. If there are n list arguments clist1 ... clistn, then pred must be a procedure taking n arguments and returning a single value, interpreted as a boolean (that is, #f means false, and any other value means true). every applies pred to the first elements of the clisti parameters. If this application returns false, every immediately returns false. Otherwise, it iterates, applying pred to the second elements of the clisti parameters, then the third, and so forth. The iteration stops when a false value is produced or one of the lists runs out of values. In the latter case, every returns the true value produced by its final application of pred. The application of pred to the last element of the lists is a tail call. If one of the clisti has no elements, every simply returns #t. Like any, every's name does not end with a question mark -- this is to indicate that it does not return a simple boolean (#t or #f), but a general value.

    (scheme list) procedure (list-index (pred procedure?) (clist1 list?) (clist2 list?) ... ) ⟹ integer? / #f /

    (pred obj1 obj2 ... ) ⟹ *

    Return the index of the leftmost element that satisfies pred. If there are n list arguments clist1 ... clistn, then pred must be a function taking n arguments and returning a single value, interpreted as a boolean (that is, #f means false, and any other value means true). list-index applies pred to the first elements of the clisti parameters. If this application returns true, list-index immediately returns zero. Otherwise, it iterates, applying pred to the second elements of the clisti parameters, then the third, and so forth. When it finds a tuple of list elements that cause pred to return true, it stops and returns the zero-based index of that position in the lists. The iteration stops when one of the lists runs out of values; in this case, list-index returns #f.

    (scheme list) procedure (member obj (list list?) ) ⟹ #f / list? /

    (scheme list) procedure (member obj (list list?) (= procedure?) ) ⟹ #f / list? /

    (= obj1 obj2 ) ⟹ *

    member, memq, memv These procedures return the first sublist of list whose car is x, where the sublists of list are the non-empty lists returned by (drop list i) for i less than the length of list. If x does not occur in list, then #f is returned. memq uses eq? to compare x with the elements of list, while memv uses eqv?, and member uses equal?. member is extended from its R5RS definition to allow the client to pass in an optional equality procedure = used to compare keys. The comparison procedure is used to compare the elements ei of list to the key x in this way: (= x ei) ; list is (E1 ... En). That is, the first argument is always x, and the second argument is one of the list elements. Thus one can reliably find the first element of list that is greater than five with (member 5 list <). Note that fully general list searching may be performed with the find-tail and find procedures.

    (scheme list) procedure (memq obj (list list?) ) ⟹ #f / list? /

    member, memq, memv These procedures return the first sublist of list whose car is x, where the sublists of list are the non-empty lists returned by (drop list i) for i less than the length of list. If x does not occur in list, then #f is returned. memq uses eq? to compare x with the elements of list, while memv uses eqv?, and member uses equal?. member is extended from its R5RS definition to allow the client to pass in an optional equality procedure = used to compare keys. The comparison procedure is used to compare the elements ei of list to the key x in this way: (= x ei) ; list is (E1 ... En). That is, the first argument is always x, and the second argument is one of the list elements. Thus one can reliably find the first element of list that is greater than five with (member 5 list <). Note that fully general list searching may be performed with the find-tail and find procedures.

    (scheme list) procedure (memv obj (list list?) ) ⟹ #f / list? /

    member, memq, memv These procedures return the first sublist of list whose car is x, where the sublists of list are the non-empty lists returned by (drop list i) for i less than the length of list. If x does not occur in list, then #f is returned. memq uses eq? to compare x with the elements of list, while memv uses eqv?, and member uses equal?. member is extended from its R5RS definition to allow the client to pass in an optional equality procedure = used to compare keys. The comparison procedure is used to compare the elements ei of list to the key x in this way: (= x ei) ; list is (E1 ... En). That is, the first argument is always x, and the second argument is one of the list elements. Thus one can reliably find the first element of list that is greater than five with (member 5 list <). Note that fully general list searching may be performed with the find-tail and find procedures.

    (scheme list) procedure (delete obj (list list?) ) ⟹ list?

    (scheme list) procedure (delete obj (list list?) (= procedure?) ) ⟹ list?

    (= obj1 obj2 ) ⟹ *

    delete, delete! delete uses the comparison procedure =, which defaults to equal?, to find all elements of list that are equal to x, and deletes them from list. The dynamic order in which the various applications of = are made is not specified. The list is not disordered -- elements that appear in the result list occur in the same order as they occur in the argument list. The result may share a common tail with the argument list. Note that fully general element deletion can be performed with the remove and remove! procedures. The comparison procedure is used in this way: (= x ei). That is, x is always the first argument, and a list element is always the second argument. The comparison procedure will be used to compare each element of list exactly once; the order in which it is applied to the various ei is not specified. Thus, one can reliably remove all the numbers greater than five from a list with (delete 5 list <). delete! is the linear-update variant of delete. It is allowed, but not required, to alter the cons cells in its argument list to construct the result.

    (scheme list) procedure (delete! obj (list list?) ) ⟹ list?

    (scheme list) procedure (delete! obj (list list?) (= procedure?) ) ⟹ list?

    (= obj1 obj2 ) ⟹ *

    delete, delete! delete uses the comparison procedure =, which defaults to equal?, to find all elements of list that are equal to x, and deletes them from list. The dynamic order in which the various applications of = are made is not specified. The list is not disordered -- elements that appear in the result list occur in the same order as they occur in the argument list. The result may share a common tail with the argument list. Note that fully general element deletion can be performed with the remove and remove! procedures. The comparison procedure is used in this way: (= x ei). That is, x is always the first argument, and a list element is always the second argument. The comparison procedure will be used to compare each element of list exactly once; the order in which it is applied to the various ei is not specified. Thus, one can reliably remove all the numbers greater than five from a list with (delete 5 list <). delete! is the linear-update variant of delete. It is allowed, but not required, to alter the cons cells in its argument list to construct the result.

    (scheme list) procedure (delete-duplicates (list list?) ) ⟹ list?

    (scheme list) procedure (delete-duplicates (list list?) (= procedure?) ) ⟹ list?

    (= obj1 obj2 ) ⟹ *

    delete-duplicates, delete-duplicates! delete-duplicates removes duplicate elements from the list argument. If there are multiple equal elements in the argument list, the result list only contains the first or leftmost of these elements in the result. The order of these surviving elements is the same as in the original list -- delete-duplicates does not disorder the list (hence it is useful for "cleaning up" association lists). The = parameter is used to compare the elements of the list; it defaults to equal?. If x comes before y in list, then the comparison is performed (= x y). The comparison procedure will be used to compare each pair of elements in list no more than once; the order in which it is applied to the various pairs is not specified. Implementations of delete-duplicates are allowed to share common tails between argument and result lists -- for example, if the list argument contains only unique elements, it may simply return exactly this list. Be aware that, in general, delete-duplicates runs in time O(n2) for n-element lists. Uniquifying long lists can be accomplished in O(n lg n) time by sorting the list to bring equal elements together, then using a linear-time algorithm to remove equal elements. Alternatively, one can use algorithms based on element-marking, with linear-time results. delete-duplicates! is the linear-update variant of delete-duplicates; it is allowed, but not required, to alter the cons cells in its argument list to construct the result.

    (scheme list) procedure (delete-duplicates! (list list?) ) ⟹ list?

    (scheme list) procedure (delete-duplicates! (list list?) (= procedure?) ) ⟹ list?

    (= obj1 obj2 ) ⟹ *

    delete-duplicates, delete-duplicates! delete-duplicates removes duplicate elements from the list argument. If there are multiple equal elements in the argument list, the result list only contains the first or leftmost of these elements in the result. The order of these surviving elements is the same as in the original list -- delete-duplicates does not disorder the list (hence it is useful for "cleaning up" association lists). The = parameter is used to compare the elements of the list; it defaults to equal?. If x comes before y in list, then the comparison is performed (= x y). The comparison procedure will be used to compare each pair of elements in list no more than once; the order in which it is applied to the various pairs is not specified. Implementations of delete-duplicates are allowed to share common tails between argument and result lists -- for example, if the list argument contains only unique elements, it may simply return exactly this list. Be aware that, in general, delete-duplicates runs in time O(n2) for n-element lists. Uniquifying long lists can be accomplished in O(n lg n) time by sorting the list to bring equal elements together, then using a linear-time algorithm to remove equal elements. Alternatively, one can use algorithms based on element-marking, with linear-time results. delete-duplicates! is the linear-update variant of delete-duplicates; it is allowed, but not required, to alter the cons cells in its argument list to construct the result.

    (scheme list) procedure (assoc obj (alist list?) ) ⟹ list? / #f /

    (scheme list) procedure (assoc obj (alist list?) (= procedure?) ) ⟹ pair? / #f /

    (= a b ) ⟹ *

    assoc, assq, assv alist must be an association list -- a list of pairs. These procedures find the first pair in alist whose car field is key, and returns that pair. If no pair in alist has key as its car, then #f is returned. assq uses eq? to compare key with the car fields of the pairs in alist, while assv uses eqv? and assoc uses equal?. assoc is extended from its R5RS definition to allow the client to pass in an optional equality procedure = used to compare keys. The comparison procedure is used to compare the elements ei of list to the key parameter in this way: (= key (car ei)) ; list is (E1 ... En). That is, the first argument is always key, and the second argument is one of the list elements. Thus one can reliably find the first entry of alist whose key is greater than five with (assoc 5 alist <). Note that fully general alist searching may be performed with the find-tail and find procedures

    (scheme list) procedure (assq obj (alist list?) ) ⟹ pair? / #f /

    assoc, assq, assv alist must be an association list -- a list of pairs. These procedures find the first pair in alist whose car field is key, and returns that pair. If no pair in alist has key as its car, then #f is returned. assq uses eq? to compare key with the car fields of the pairs in alist, while assv uses eqv? and assoc uses equal?. assoc is extended from its R5RS definition to allow the client to pass in an optional equality procedure = used to compare keys. The comparison procedure is used to compare the elements ei of list to the key parameter in this way: (= key (car ei)) ; list is (E1 ... En). That is, the first argument is always key, and the second argument is one of the list elements. Thus one can reliably find the first entry of alist whose key is greater than five with (assoc 5 alist <). Note that fully general alist searching may be performed with the find-tail and find procedures

    (scheme list) procedure (assv obj (alist list?) ) ⟹ pair? / #f /

    assoc, assq, assv alist must be an association list -- a list of pairs. These procedures find the first pair in alist whose car field is key, and returns that pair. If no pair in alist has key as its car, then #f is returned. assq uses eq? to compare key with the car fields of the pairs in alist, while assv uses eqv? and assoc uses equal?. assoc is extended from its R5RS definition to allow the client to pass in an optional equality procedure = used to compare keys. The comparison procedure is used to compare the elements ei of list to the key parameter in this way: (= key (car ei)) ; list is (E1 ... En). That is, the first argument is always key, and the second argument is one of the list elements. Thus one can reliably find the first entry of alist whose key is greater than five with (assoc 5 alist <). Note that fully general alist searching may be performed with the find-tail and find procedures

    (scheme list) procedure (alist-cons key datum (alist list?) ) ⟹ list?

    (lambda (key datum alist) (cons (cons key datum) alist)) Cons a new alist entry mapping key -> datum onto alist.

    (scheme list) procedure (alist-copy (alist list?) ) ⟹ list?

    Make a fresh copy of alist. This means copying each pair that forms an association as well as the spine of the list.

    (scheme list) procedure (alist-delete key (alist list?) ) ⟹ list?

    (scheme list) procedure (alist-delete key (alist list?) (= procedure?) ) ⟹ list?

    (= a b ) ⟹ *

    alist-delete, alist-delete! alist-delete deletes all associations from alist with the given key, using key-comparison procedure =, which defaults to equal?. The dynamic order in which the various applications of = are made is not specified. Return values may share common tails with the alist argument. The alist is not disordered -- elements that appear in the result alist occur in the same order as they occur in the argument alist. The comparison procedure is used to compare the element keys ki of alist's entries to the key parameter in this way: (= key ki). Thus, one can reliably remove all entries of alist whose key is greater than five with (alist-delete 5 alist <). alist-delete! is the linear-update variant of alist-delete. It is allowed, but not required, to alter cons cells from the alist parameter to construct the result.

    (scheme list) procedure (alist-delete! key (alist list?) ) ⟹ list?

    (scheme list) procedure (alist-delete! key (alist list?) (= procedure?) ) ⟹ list?

    (= a b ) ⟹ *

    alist-delete, alist-delete! alist-delete deletes all associations from alist with the given key, using key-comparison procedure =, which defaults to equal?. The dynamic order in which the various applications of = are made is not specified. Return values may share common tails with the alist argument. The alist is not disordered -- elements that appear in the result alist occur in the same order as they occur in the argument alist. The comparison procedure is used to compare the element keys ki of alist's entries to the key parameter in this way: (= key ki). Thus, one can reliably remove all entries of alist whose key is greater than five with (alist-delete 5 alist <). alist-delete! is the linear-update variant of alist-delete. It is allowed, but not required, to alter cons cells from the alist parameter to construct the result.

    (scheme list) procedure (lset<= (= procedure?) (list1 list?) ... ) ⟹ boolean?

    (= a b ) ⟹ *

    Returns true iff every listi is a subset of listi+1, using = for the element-equality procedure. List A is a subset of list B if every element in A is equal to some element of B. When performing an element comparison, the = procedure's first argument is an element of A; its second, an element of B.

    (scheme list) procedure (lset= (= procedure?) (list1 list?) (list2 list?) ... ) ⟹ boolean?

    (= a b ) ⟹ *

    Returns true iff every listi is set-equal to listi+1, using = for the element-equality procedure. "Set-equal" simply means that listi is a subset of listi+1, and listi+1 is a subset of listi. The = procedure's first argument is an element of listi; its second is an element of listi+1.

    (scheme list) procedure (lset-adjoin (= procedure?) (list list?) elt1 ... ) ⟹ list?

    (= a b ) ⟹ *

    Adds the elti elements not already in the list parameter to the result list. The result shares a common tail with the list parameter. The new elements are added to the front of the list, but no guarantees are made about their order. The = parameter is an equality procedure used to determine if an elti is already a member of list. Its first argument is an element of list; its second is one of the elti. The list parameter is always a suffix of the result -- even if the list parameter contains repeated elements, these are not reduced.

    (scheme list) procedure (lset-union (= procedure?) (list1 list?) ... ) ⟹ list?

    (= a b ) ⟹ *

    Returns the union of the lists, using = for the element-equality procedure. The union of lists A and B is constructed as follows: If A is the empty list, the answer is B (or a copy of B). Otherwise, the result is initialised to be list A (or a copy of A). Proceed through the elements of list B in a left-to-right order. If b is such an element of B, compare every element r of the current result list to b: (= r b). If all comparisons fail, b is consed onto the front of the result. However, there is no guarantee that = will be applied to every pair of arguments from A and B. In particular, if A is eq? to B, the operation may immediately terminate. In the n-ary case, the two-argument list-union operation is simply folded across the argument lists.

    (scheme list) procedure (lset-union! (= procedure?) (list1 list?) ... ) ⟹ list?

    (= a b ) ⟹ *

    lset-union!, lset-intersection!, lset-difference!, lset-xor!, lset-diff+intersection! 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. lset-union! is permitted to recycle cons cells from any of its list arguments.

    (scheme list) procedure (lset-intersection (= procedure?) (list1 list?) (list2 list?) ... ) ⟹ list?

    (= a b ) ⟹ *

    Returns the intersection of the lists, using = for the element-equality procedure. The intersection of lists A and B is comprised of every element of A that is = to some element of B: (= a b), for a in A, and b in B. Note this implies that an element which appears in B and multiple times in list A will also appear multiple times in the result. The order in which elements appear in the result is the same as they appear in list1 -- that is, lset-intersection essentially filters list1, without disarranging element order. The result may share a common tail with list1. In the n-ary case, the two-argument list-intersection operation is simply folded across the argument lists. However, the dynamic order in which the applications of = are made is not specified. The procedure may check an element of list1 for membership in every other list before proceeding to consider the next element of list1, or it may completely intersect list1 and list2 before proceeding to list3, or it may go about its work in some third order.

    (scheme list) procedure (lset-intersection! (= procedure?) (list1 list?) (list2 list?) ... ) ⟹ list?

    (= a b ) ⟹ *

    lset-union!, lset-intersection!, lset-difference!, lset-xor!, lset-diff+intersection! 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. lset-union! is permitted to recycle cons cells from any of its list arguments.

    (scheme list) procedure (lset-difference (= procedure?) (list1 list?) (list2 list?) ... ) ⟹ list?

    (= a b ) ⟹ *

    Returns the difference of the lists, using = for the element-equality procedure -- all the elements of list1 that are not = to any element from one of the other listi parameters. The = procedure's first argument is always an element of list1; its second is an element of one of the other listi. Elements that are repeated multiple times in the list1 parameter will occur multiple times in the result. The order in which elements appear in the result is the same as they appear in list1 -- that is, lset-difference essentially filters list1, without disarranging element order. The result may share a common tail with list1. The dynamic order in which the applications of = are made is not specified. The procedure may check an element of list1 for membership in every other list before proceeding to consider the next element of list1, or it may completely compute the difference of list1 and list2 before proceeding to list3, or it may go about its work in some third order.

    (scheme list) procedure (lset-difference! (= procedure?) (list1 list?) (list2 list?) ... ) ⟹ list?

    (= a b ) ⟹ *

    lset-union!, lset-intersection!, lset-difference!, lset-xor!, lset-diff+intersection! 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. lset-union! is permitted to recycle cons cells from any of its list arguments.

    (scheme list) procedure (lset-xor (= procedure?) (list1 list?) ... ) ⟹ list?

    (= a b ) ⟹ *

    Returns the exclusive-or of the sets, using = for the element-equality procedure. If there are exactly two lists, this is all the elements that appear in exactly one of the two lists. The operation is associative, and thus extends to the n-ary case -- the elements that appear in an odd number of the lists. The result may share a common tail with any of the listi parameters. More precisely, for two lists A and B, A xor B is a list of every element a of A such that there is no element b of B such that (= a b), and every element b of B such that there is no element a of A such that (= b a). However, an implementation is allowed to assume that = is symmetric -- that is, that (= a b) => (= b a). This means, for example, that if a comparison (= a b) produces true for some a in A and b in B, both a and b may be removed from inclusion in the result. In the n-ary case, the binary-xor operation is simply folded across the lists.

    (scheme list) procedure (lset-xor! (= procedure?) (list1 list?) ... ) ⟹ list?

    (= a b ) ⟹ *

    lset-union!, lset-intersection!, lset-difference!, lset-xor!, lset-diff+intersection! 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. lset-union! is permitted to recycle cons cells from any of its list arguments.

    (scheme list) procedure (lset-diff+intersection (= procedure?) (list1 list?) (list2 list?) ... ) ⟹ (values list?list?)

    (= a b ) ⟹ *

    Returns two values -- the difference and the intersection of the lists. Is equivalent to (values (lset-difference = list1 list2 ...) (lset-intersection = list1 (lset-union = list2 ...))) but can be implemented more efficiently. The = procedure's first argument is an element of list1; its second is an element of one of the other listi. Either of the answer lists may share a common tail with list1. This operation essentially partitions list1.

    (scheme list) procedure (lset-diff+intersection! (= procedure?) (list1 list?) (list2 list?) ... ) ⟹ (values list?list?)

    (= a b ) ⟹ *

    lset-union!, lset-intersection!, lset-difference!, lset-xor!, lset-diff+intersection! 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. lset-union! is permitted to recycle cons cells from any of its list arguments.

    (scheme list) procedure (set-car! (pair pair?) object ) ⟹ undefined

    set-car!, set-cdr! These procedures store object in the car and cdr field of pair, respectively. The value returned is unspecified.

    (scheme list) procedure (set-cdr! (pair pair?) object ) ⟹ undefined

    set-car!, set-cdr! These procedures store object in the car and cdr field of pair, respectively. The value returned is unspecified.

    library (scheme list-queue)

    (scheme list-queue) procedure (make-list-queue (list list?) ) ⟹ list-queue?

    (scheme list-queue) procedure (make-list-queue (list list?) (last pair?) ) ⟹ list-queue?

    Returns a newly allocated list queue containing the elements of list in order. The result shares storage with list. If the last argument is not provided, this operation is O(n) where n is the length of list.

    However, if last is provided, make-list-queue returns a newly allocated list queue containing the elements of the list whose first pair is first and whose last pair is last. It is an error if the pairs do not belong to the same list. Alternatively, both first and last can be the empty list. In either case, the operation is O(1).

    Note: To apply a non-destructive list procedure to a list queue and return a new list queue, use (make-list-queue (proc (list-queue-list list-queue))).

    (scheme list-queue) procedure (list-queue element ... ) ⟹ list-queue?

    (scheme list-queue) procedure (list-queue (list-queue list-queue?) ) ⟹ list-queue?

    Returns a newly allocated list queue containing the elements. This operation is O(n) where n is the number of elements.

    (scheme list-queue) procedure (list-queue-copy (list-queue list-queue?) ) ⟹ list-queue?

    Returns a newly allocated list queue containing the elements of list-queue. This operation is O(n) where n is the length of list-queue

    (scheme list-queue) procedure (list-queue-unfold (stop? procedure?) (mapper procedure?) (successor procedure?) seed ) ⟹ list-queue?

    (scheme list-queue) procedure (list-queue-unfold (stop? procedure?) (mapper procedure?) (successor procedure?) seed (queue list-queue?) ) ⟹ list-queue?

    (stop? seed ) ⟹ boolean?

    (mapper seed ) ⟹ *

    (successor seed ) ⟹ *

    Performs the following algorithm:

    If the result of applying the predicate stop? to seed is true, return queue. Otherwise, apply the procedure mapper to seed, returning a value which is added to the front of queue. Then get a new seed by applying the procedure successor to seed, and repeat this algorithm.

    If queue is omitted, a newly allocated list queue is used.

    (scheme list-queue) procedure (list-queue-unfold-right (stop? procedure?) (mapper procedure?) (successor procedure?) seed ) ⟹ list-queue?

    (scheme list-queue) procedure (list-queue-unfold-right (stop? procedure?) (mapper procedure?) (successor procedure?) seed (queue list-queue?) ) ⟹ list-queue?

    (stop? seed ) ⟹ boolean?

    (mapper seed ) ⟹ *

    (successor seed ) ⟹ *

    Performs the following algorithm:

    If the result of applying the predicate stop? to seed is true, return the list queue. Otherwise, apply the procedure mapper to seed, returning a value which is added to the back of the list queue. Then get a new seed by applying the procedure successor to seed, and repeat this algorithm.

    If queue is omitted, a newly allocated list queue is used.

    (scheme list-queue) procedure (list-queue? obj ) ⟹ boolean?

    Returns #t if obj is a list queue, and #f otherwise. This operation is O(1).

    (scheme list-queue) procedure (list-queue-empty? (list-queue list-queue?) ) ⟹ boolean?

    Returns #t if list-queue has no elements, and #f otherwise. This operation is O(1).

    (scheme list-queue) procedure (list-queue-front (list-queue list-queue?) ) ⟹ *

    Returns the first element of list-queue. If the list queue is empty, it is an error. This operation is O(1).

    (scheme list-queue) procedure (list-queue-back (list-queue list-queue?) ) ⟹ *

    Returns the last element of list-queue. If the list queue is empty, it is an error. This operation is O(1).

    (scheme list-queue) procedure (list-queue-list (list-queue list-queue?) ) ⟹ list?

    Returns the list that contains the members of list-queue in order. The result shares storage with list-queue. This operation is O(1).

    (scheme list-queue) procedure (list-queue-first-last (list-queue list-queue?) ) ⟹ (values list?list?)

    Returns two values, the first and last pairs of the list that contains the members of list-queue in order. If list-queue is empty, returns two empty lists. The results share storage with list-queue. This operation is O(1).

    (scheme list-queue) procedure (list-queue-add-front! (list-queue list-queue?) element ) ⟹ undefined

    Adds element to the beginning of list-queue. Returns an unspecified value. This operation is O(1).

    (scheme list-queue) procedure (list-queue-add-back! (list-queue list-queue?) element ) ⟹ undefined

    Adds element to the end of list-queue. Returns an unspecified value. This operation is O(1).

    (scheme list-queue) procedure (list-queue-remove-front! (list-queue list-queue?) ) ⟹ *

    Removes the first element of list-queue and returns it. If the list queue is empty, it is an error. This operation is O(1).

    (scheme list-queue) procedure (list-queue-remove-back! (list-queue list-queue?) ) ⟹ *

    Removes the last element of list-queue and returns it. If the list queue is empty, it is an error. This operation is O(n) where n is the length of list-queue, because queues do not not have backward links.

    (scheme list-queue) procedure (list-queue-remove-all! (list-queue list-queue?) ) ⟹ list?

    Removes all the elements of list-queue and returns them in order as a list. This operation is O(1).

    (scheme list-queue) procedure (list-queue-set-list! (list-queue list-queue?) (list list?) ) ⟹ undefined

    (scheme list-queue) procedure (list-queue-set-list! (list-queue list-queue?) (list list?) (last pair?) ) ⟹ undefined

    Replaces the list associated with list-queue with list, effectively discarding all the elements of list-queue in favor of those in list. Returns an unspecified value. This operation is O(n) where n is the length of list. If last is provided, it is treated in the same way as in make-list-queue, and the operation is O(1).

    Note: To apply a destructive list procedure to a list queue, use (list-queue-set-list! (proc (list-queue-list list-queue))).

    (scheme list-queue) procedure (list-queue-append (list-queue list-queue?) ... ) ⟹ list-queue?

    Returns a list queue which contains all the elements in front-to-back order from all the list-queues in front-to-back order. The result does not share storage with any of the arguments. This operation is O(n) in the total number of elements in all queues.

    (scheme list-queue) procedure (list-queue-append! (list-queue list-queue?) ... ) ⟹ list-queue?

    Returns a list queue which contains all the elements in front-to-back order from all the list-queues in front-to-back order. It is an error to assume anything about the contents of the list-queues after the procedure returns. This operation is O(n) in the total number of queues, not elements. It is not part of the R7RS-small list API, but is included here for efficiency when pure functional append is not required.

    (scheme list-queue) procedure (list-queue-concatenate (list-of-list-queues list?) ) ⟹ list-queue?

    Returns a list queue which contains all the elements in front-to-back order from all the list queues which are members of list-of-list-queues in front-to-back order. The result does not share storage with any of the arguments. This operation is O(n) in the total number of elements in all queues. It is not part of the R7RS-small list API, but is included here to make appending a large number of queues possible in Schemes that limit the number of arguments to apply.

    (scheme list-queue) procedure (list-queue-map (proc procedure?) (list-queue list-queue?) ) ⟹ list-queue?

    (proc element ) ⟹ *

    Applies proc to each element of list-queue in unspecified order and returns a newly allocated list queue containing the results. This operation is O(n) where n is the length of list-queue.

    (scheme list-queue) procedure (list-queue-map! (proc procedure?) (list-queue list-queue?) ) ⟹ undefined

    (proc element ) ⟹ *

    Applies proc to each element of list-queue in front-to-back order and modifies list-queue to contain the results. This operation is O(n) in the length of list-queue. It is not part of the R7RS-small list API, but is included here to make transformation of a list queue by mutation more efficient.

    (scheme list-queue) procedure (list-queue-for-each (proc procedure?) (list-queue list-queue?) ) ⟹ undefined

    (proc element ) ⟹ undefined

    Applies proc to each element of list-queue in front-to-back order, discarding the returned values. Returns an unspecified value. This operation is O(n) where n is the length of list-queue.

    library (scheme lseq)

    (scheme lseq) procedure (generator->lseq (generator procedure?) ) ⟹ lseq?

    (generator ) ⟹ *

    Returns an lseq whose elements are the values generated by generator. The exact behavior is as follows:

  • Generator is invoked with no arguments to produce an object obj.
  • If obj is an end-of-file object, the empty list is returned.
  • Otherwise, a newly allocated pair whose car is obj and whose cdr is generator is returned.
  • (scheme lseq) procedure (lseq? x ) ⟹ boolean?

    Returns #t if x is an lseq. This procedure may also return #t if x is an improper list whose last cdr is a procedure that requires arguments, since there is no portable way to examine a procedure to determine how many arguments it requires. Otherwise it returns #f.

    (scheme lseq) procedure (lseq=? (elt=? procedure?) (lseq1 lseq?) (lseq2 lseq?) ) ⟹ boolean?

    (elt=? a b ) ⟹ boolean?

    Determines lseq equality, given an element-equality procedure. Two lseqs are equal if they are of the same length, and their corresponding elements are equal, as determined by elt=?. When elt=? is called, its first argument is always from lseq1 and its second argument is from lseq2.

    The dynamic order in which the elt=? procedure is applied to pairs of elements is not specified.

    The elt=? procedure must be consistent with eq?. This implies that two lseqs which are eq? are always lseq=?, as well; implementations may exploit this fact to "short-cut" the element-by-element equality tests.

    (scheme lseq) procedure (lseq-car (lseq lseq?) ) ⟹ *

    Returns the first element of lseq. It is included for completeness, as it is the same as car. It is an error to apply it to an empty lseq.

    (scheme lseq) procedure (lseq-first (lseq lseq?) ) ⟹ *

    Returns the first element of lseq. It is included for completeness, as it is the same as car. It is an error to apply it to an empty lseq.

    (scheme lseq) procedure (lseq-cdr (lseq lseq?) ) ⟹ lseq?

    Returns an lseq with the contents of lseq except for the first element. The exact behavior is as follows:

  • If lseq is a pair whose cdr is a procedure, then the procedure is invoked with no arguments to produce an object obj.
  • If obj is an end-of-file object, then the cdr of lseq is set to the empty list, which is returned.

    If obj is any other object, then a new pair is allocated whose car is obj and whose cdr is the cdr of lseq (i.e. the procedure). The cdr of lseq is set to the newly allocated pair, which is returned.

  • If lseq is a pair whose cdr is not a procedure, then the cdr is returned.
  • If lseq is not a pair, it is an error.
  • (scheme lseq) procedure (lseq-rest (lseq lseq?) ) ⟹ lseq?

    Returns an lseq with the contents of lseq except for the first element. The exact behavior is as follows:

  • If lseq is a pair whose cdr is a procedure, then the procedure is invoked with no arguments to produce an object obj.
  • If obj is an end-of-file object, then the cdr of lseq is set to the empty list, which is returned.

    If obj is any other object, then a new pair is allocated whose car is obj and whose cdr is the cdr of lseq (i.e. the procedure). The cdr of lseq is set to the newly allocated pair, which is returned.

  • If lseq is a pair whose cdr is not a procedure, then the cdr is returned.
  • If lseq is not a pair, it is an error.
  • (scheme lseq) procedure (lseq-ref (lseq lseq?) (i integer?) ) ⟹ *

    Returns the ith element of lseq. (This is the same as (lseq-first (lseq-drop lseq i)).) It is an error if i >= n, where n is the length of lseq.

    (scheme lseq) procedure (lseq-take (lseq lseq?) (i integer?) ) ⟹ lseq?

    lseq-take lazily returns the first i elements of lseq.

    (scheme lseq) procedure (lseq-drop (lseq lseq?) (i integer?) ) ⟹ lseq?

    lseq-drop returns all but the first i elements of lseq.

    (scheme lseq) procedure (lseq-realize (lseq lseq?) ) ⟹ list?

    Repeatedly applies lseq-cdr to lseq until its generator (if there is one) has been exhausted, and returns lseq, which is now guaranteed to be a proper list. This procedure can be called on an arbitrary lseq before passing it to a procedure which only accepts lists. However, if the generator never returns an end-of-file object, lseq-realize will never return.

    (scheme lseq) procedure (lseq->generator (lseq lseq?) ) ⟹ procedure?

    (return ) ⟹ *

    Returns a generator which when invoked will return all the elements of lseq, including any that have not yet been realized.

    (scheme lseq) procedure (lseq-length (lseq lseq?) ) ⟹ integer?

    Returns the length of its argument, which is the non-negative integer n such that lseq-rest applied n times to the lseq produces an empty lseq. lseq must be finite, or this procedure will not return.

    (scheme lseq) procedure (lseq-append (lseq lseq?) ... ) ⟹ lseq?

    Returns an lseq that lazily contains all the elements of all the lseqs in order.

    (scheme lseq) procedure (lseq-zip (lseq1 lseq?) (lseq2 lseq?) ... ) ⟹ lseq?

    If lseq-zip is passed n lseqs, it lazily returns an lseq each element of which is an n-element list comprised of the corresponding elements from the lseqs. If any of the lseqs are finite in length, the result is as long as the shortest lseq.

    (scheme lseq) procedure (lseq-map (proc procedure?) (lseq1 lseq?) (lseq2 lseq?) ... ) ⟹ lseq?

    (proc value1 value2 ... ) ⟹ *

    The lseq-map procedure lazily applies proc element-wise to the corresponding elements of the lseqs, where proc is a procedure taking as many arguments as there are lseqs and returning a single value, and returns an lseq of the results in order. The dynamic order in which proc is applied to the elements of the lseqs is unspecified.

    (scheme lseq) procedure (lseq-for-each (proc procedure?) (lseq1 lseq?) (lseq2 lseq?) ... ) ⟹ *

    (proc value1 value2 ... ) ⟹ *

    The arguments to lseq-for-each are like the arguments to lseq-map, but lseq-for-each calls proc for its side effects rather than for its values. Unlike lseq-map, lseq-for-each is guaranteed to call proc on the elements of the lseqs in order from the first element(s) to the last, and the value returned by lseq-for-each is unspecified.

    If none of the lseqs are finite, lseq-for-each never returns.

    (scheme lseq) procedure (lseq-filter (pred procedure?) (lseq lseq?) ) ⟹ lseq?

    (pred element ) ⟹ boolean?

    The procedure lseq-filter lazily returns an lseq that contains only the elements of lseq that satisfy pred.

    (scheme lseq) procedure (lseq-remove (pred procedure?) (lseq lseq?) ) ⟹ lseq?

    (pred element ) ⟹ boolean?

    The procedure lseq-remove is the same as lseq-filter, except that it returns elements that do not satisfy pred. These procedures are guaranteed to call pred on the elements of the lseqs in sequence order.

    (scheme lseq) procedure (lseq-find (pred procedure?) (lseq lseq?) ) ⟹ *

    (pred element ) ⟹ boolean?

    Return the first element of lseq that satisfies predicate pred, or #f if no element does. It cannot reliably be applied to lseqs that include #f as an element; use lseq-find-tail instead. The predicate is guaranteed to be evaluated on the elements of lseq in sequence order, and only as often as necessary.

    (scheme lseq) procedure (lseq-find-tail (pred procedure?) (lseq lseq?) ) ⟹ #f / lseq? /

    (pred element ) ⟹ boolean?

    Returns the longest tail of lseq whose first element satisfies pred, or #f if no element does. The predicate is guaranteed to be evaluated on the elements of lseq in sequence order, and only as often as necessary. lseq-find-tail can be viewed as a general-predicate variant of the lseq-member function.

    (scheme lseq) procedure (lseq-take-while (pred procedure?) (lseq lseq?) ) ⟹ lseq?

    (pred element ) ⟹ boolean?

    Lazily returns the longest initial prefix of lseq whose elements all satisfy the predicate pred.

    (scheme lseq) procedure (lseq-drop-while (pred procedure?) (lseq lseq?) ) ⟹ lseq?

    (pred element ) ⟹ boolean?

    Drops the longest initial prefix of lseq whose elements all satisfy the predicate pred, and returns the rest of the lseq. Note that lseq-drop-while is essentially lseq-find-tail where the sense of the predicate is inverted: lseq-find-tail searches until it finds an element satisfying the predicate; lseq-drop-while searches until it finds an element that doesn't satisfy the predicate.

    (scheme lseq) procedure (lseq-any (pred procedure?) (lseq1 lseq?) (lseq2 lseq?) ... ) ⟹ *

    (pred element ) ⟹ *

    Applies pred to successive elements of the lseqs, returning true if pred returns true on any application. If an application returns a true value, lseq-any immediately returns that value. Otherwise, it iterates until a true value is produced or one of the lseqs runs out of values; in the latter case, lseq-any returns #f. It is an error if pred does not accept the same number of arguments as there are lseqs and return a boolean result. Note the difference between lseq-find and lseq-any — lseq-find returns the element that satisfied the predicate; lseq-any returns the true value that the predicate produced. Like lseq-every, lseq-any's name does not end with a question mark — this is to indicate that it does not return a simple boolean (#t or #f), but a general value.

    (scheme lseq) procedure (lseq-every (pred procedure?) (lseq1 lseq?) (lseq2 lseq?) ... ) ⟹ *

    (pred element ) ⟹ *

    Applies pred to successive elements of the lseqs, returning true if the predicate returns true on every application. If an application returns a false value, lseq-every immediately returns that value. Otherwise, it iterates until a false value is produced or one of the lseqs runs out of values; in the latter case, lseq-every returns the last value returned by pred, or #t if pred was never invoked. It is an error if pred does not accept the same number of arguments as there are lseqs and return a boolean result. Like lseq-any, lseq-every's name does not end with a question mark — this is to indicate that it does not return a simple boolean (#t or #f), but a general value.

    (scheme lseq) procedure (lseq-index (pred procedure?) (lseq1 lseq?) (lseq2 lseq?) ... ) ⟹ integer? / #f /

    (pred element ) ⟹ *

    Return the index of the leftmost element that satisfies pred. Applies pred to successive elements of the lseqs, returning an index usable with lseq-ref if the predicate returns true. Otherwise, it iterates until one of the lseqs runs out of values, in which case #f is returned. It is an error if pred does not accept the same number of arguments as there are lseqs and return a boolean result. The iteration stops when one of the lseqs runs out of values; in this case, lseq-index returns #f.

    (scheme lseq) procedure (lseq-member x (lseq lseq?) ) ⟹ #f / lseq? /

    (scheme lseq) procedure (lseq-member x (lseq lseq?) (= procedure?) ) ⟹ #f / lseq? /

    (= a b ) ⟹ boolean?

    Returns the longest tail of lseq whose first element is x, where the tails of lseq are the non-empty lseqs returned by (lseq-drop lseq i) for i less than the length of lseq. If x does not occur in lseq, then #f is returned. lseq-member uses pred to compare x with the elements of lseq, which defaults to equal?.

    The equality procedure is used to compare the elements ei of lseq to the key x in this way: the first argument is always x, and the second argument is one of the lseq elements. Thus one can reliably find the first element of lseq that is greater than five with (lseq-member 5 lseq <)

    Note that fully general lseq searching may be performed with the lseq-find-tail procedure.

    (scheme lseq) procedure (lseq-memq x (lseq lseq?) ) ⟹ #f / lseq? /

    Returns the longest tail of lseq whose first element is x, where the tails of lseq are the non-empty lseqs returned by (lseq-drop lseq i) for i less than the length of lseq. If x does not occur in lseq, then #f is returned. lseq-memq uses eq? to compare x with the elements of lseq.

    The equality procedure is used to compare the elements ei of lseq to the key x in this way: the first argument is always x, and the second argument is one of the lseq elements. Thus one can reliably find the first element of lseq that is greater than five with (lseq-member 5 lseq <)

    Note that fully general lseq searching may be performed with the lseq-find-tail procedure.

    (scheme lseq) procedure (lseq-memv x (lseq lseq?) ) ⟹ #f / lseq? /

    Returns the longest tail of lseq whose first element is x, where the tails of lseq are the non-empty lseqs returned by (lseq-drop lseq i) for i less than the length of lseq. If x does not occur in lseq, then #f is returned. lseq-memv uses eqv? to compare x with the elements of lseq.

    The equality procedure is used to compare the elements ei of lseq to the key x in this way: the first argument is always x, and the second argument is one of the lseq elements. Thus one can reliably find the first element of lseq that is greater than five with (lseq-member 5 lseq <)

    Note that fully general lseq searching may be performed with the lseq-find-tail procedure.

    library (scheme rlist)

    (scheme rlist) procedure (rpair? obj ) ⟹ boolean?

    Returns #t if obj is a pair, and otherwise returns #f.

    (scheme rlist) procedure (rcons obj1 obj2 ) ⟹ rpair?

    Returns a newly allocated pair whose car is obj1 and whose cdr is obj2. The pair is guaranteed to be different (in the sense of eqv?) from every existing object. This operation must take O(1) time.

    (scheme rlist) procedure (rcar (pair rpair?) ) ⟹ *

    Returns the contents of the car field of pair. This operation must take O(1) time.

    (scheme rlist) procedure (rcdr (pair rpair?) ) ⟹ *

    Returns the contents of the cdr field of pair. This operation must take O(1) time.

    (scheme rlist) procedure (rcaar (pair rpair?) ) ⟹ *

    (scheme rlist) procedure (rcadr (pair rpair?) ) ⟹ *

    (scheme rlist) procedure (rcdar (pair rpair?) ) ⟹ *

    (scheme rlist) procedure (rcddr (pair rpair?) ) ⟹ *

    (scheme rlist) procedure (rcaaar (pair rpair?) ) ⟹ *

    (scheme rlist) procedure (rcaadr (pair rpair?) ) ⟹ *

    (scheme rlist) procedure (rcadar (pair rpair?) ) ⟹ *

    (scheme rlist) procedure (rcaddr (pair rpair?) ) ⟹ *

    (scheme rlist) procedure (rcdaar (pair rpair?) ) ⟹ *

    (scheme rlist) procedure (rcdadr (pair rpair?) ) ⟹ *

    (scheme rlist) procedure (rcddar (pair rpair?) ) ⟹ *

    (scheme rlist) procedure (rcdddr (pair rpair?) ) ⟹ *

    (scheme rlist) procedure (rcaaaar (pair rpair?) ) ⟹ *

    (scheme rlist) procedure (rcaaadr (pair rpair?) ) ⟹ *

    (scheme rlist) procedure (rcaadar (pair rpair?) ) ⟹ *

    (scheme rlist) procedure (rcaaddr (pair rpair?) ) ⟹ *

    (scheme rlist) procedure (rcadaar (pair rpair?) ) ⟹ *

    (scheme rlist) procedure (rcadadr (pair rpair?) ) ⟹ *

    (scheme rlist) procedure (rcaddar (pair rpair?) ) ⟹ *

    (scheme rlist) procedure (rcadddr (pair rpair?) ) ⟹ *

    (scheme rlist) procedure (rcdaaar (pair rpair?) ) ⟹ *

    (scheme rlist) procedure (rcdaadr (pair rpair?) ) ⟹ *

    (scheme rlist) procedure (rcdadar (pair rpair?) ) ⟹ *

    (scheme rlist) procedure (rcdaddr (pair rpair?) ) ⟹ *

    (scheme rlist) procedure (rcddaar (pair rpair?) ) ⟹ *

    (scheme rlist) procedure (rcddadr (pair rpair?) ) ⟹ *

    (scheme rlist) procedure (rcdddar (pair rpair?) ) ⟹ *

    (scheme rlist) procedure (rcddddr (pair rpair?) ) ⟹ *

    These procedures are compositions of car and cdr.

    (scheme rlist) procedure (rnull? obj ) ⟹ boolean?

    Returns #t if obj is the empty list, #f otherwise.

    (scheme rlist) procedure (rlist? obj ) ⟹ boolean?

    Returns #t if obj is a list, #f otherwise. By definition, all lists are chains of pairs that have finite length and are terminated by the empty list. This operation must take time bounded by O(log(n)), where n is the number of pairs in the chain forming the potential list.

    (scheme rlist) procedure (rlist obj ... ) ⟹ rlist?

    Returns a newly allocated list of its arguments. This operation must take time bounded by O(n), where n is the number of arguments to list.

    (scheme rlist) procedure (make-rlist (k integer?) ) ⟹ rlist?

    (scheme rlist) procedure (make-rlist (k integer?) obj ) ⟹ rlist?

    Returns a newly allocated list of k elements. If a second argument is given, then each element is initialized to obj. Otherwise the initial contents of each element is unspecified. This operation must take time and space bounded by O(log(k)).

    (scheme rlist) procedure (rlength (list rlist?) ) ⟹ integer?

    Returns the length of list. This operation must take time bounded by O(log(n)), where n is the length of the list.

    (scheme rlist) procedure (rlength<=? obj (k integer?) ) ⟹ boolean?

    Returns true if obj is a chain of at least k pairs and false otherwise. This operation must take time bounded by O(log(min(k,n))), where n is the length of the chain of pairs.

    (scheme rlist) procedure (rappend (list rlist?) ... ) ⟹ rlist?

    (scheme rlist) procedure (rappend (list rlist?) ... obj ) ⟹ *

    Returns a chain of pairs consisting of the elements of the first list followed by the elements of the other lists, with obj as the cdr of the final pair. An improper list results if obj is not a list. This operation must take time bounded by O(log(n)), where n is the total number of elements in the given lists.

    (scheme rlist) procedure (rreverse (list rlist?) ) ⟹ rlist?

    Returns a newly allocated list consisting of the element of list in reverse order. This operation must take time bounded by O(n) where n is the length of the list.

    (scheme rlist) procedure (rlist-tail (list rlist?) (k integer?) ) ⟹ rlist?

    (scheme rlist) procedure (rlist-tail obj (k integer?) ) ⟹ *

    Obj should be a chain of pairs with a count of at least k. The list-tail procedure returns the object obtained by omitting the first k elements in obj. This operation must take time bounded by O(log(min(k,n))), where n is the length of the chain of pairs.

    (scheme rlist) procedure (rlist-ref (pair rpair?) (k integer?) ) ⟹ *

    Pair must be a chain of pairs whose count is at least k + 1. The list-ref procedure returns the kth element of pair. This operation must take time bounded by O(min(k,log(n))), where n is the length of the chain of pairs.

    (scheme rlist) procedure (rlist-set (pair rpair?) (k integer?) obj ) ⟹ rpair?

    Pair must be a chain of pairs whose count is at least k + 1. The list-set procedure returns the chain of pairs obtained by replacing the kth element with obj. This operation must take time bounded by O(min(k,log(n))), where n is the length of the chain of pairs.

    (scheme rlist) procedure (rlist-ref/update (pair rpair?) (k integer?) (proc procedure?) ) ⟹ (values *rpair?)

    (proc obj ) ⟹ *

    Returns the same results as:

    (values (list-ref pair k)

    (list-set pair k (proc (list-ref pair k))))

    but it may be implemented more efficiently.

    (scheme rlist) procedure (rmap (proc procedure?) (list1 rlist?) (list2 rlist?) ... ) ⟹ rlist?

    (proc obj1 obj2 ... ) ⟹ *

    The lists should all have the same length. Proc should accept as many arguments as there are lists and return a single value.

    The map procedure applies proc element-wise to the elements of the lists and returns a list of the results, in order. Proc is always called in the same dynamic environment as map itself. The order in which proc is applied to the elements of the lists is unspecified.

    (scheme rlist) procedure (rfor-each (proc procedure?) (list1 rlist?) (list2 rlist?) ... ) ⟹ undefined

    (proc obj1 obj2 ... ) ⟹ undefined

    The lists should all have the same length. Proc should accept as many arguments as there are lists.

    The for-each procedure applies proc element-wise to the elements of the lists for its side effects, in order from the first element to the last. Proc is always called in the same dynamic environment as for-each itself. The return values of for-each are unspecified.

    (scheme rlist) procedure (rlist->list (rlist rlist?) ) ⟹ list?

    (scheme rlist) procedure (list->rlist (list list?) ) ⟹ rlist?

    These procedures convert between (potentially) distinct representations of lists. To avoid confusion, parameters named ra-list range over lists represented with random-access lists, i.e. objects satisfying the list? predicate described above, while parameters named la-list range over lists represented with the more traditional linear-access lists, i.e. objects satisfying the list? predicate of R6RS. In systems that represent all lists as random-access lists, these conversions may simply be list identity procedures.

    library (scheme set)

    (scheme set) procedure (set (comparator comparator?) element ... ) ⟹ set?

    Returns a newly allocated empty set. The comparator argument is a SRFI 114 comparator, which is used to control and distinguish the elements of the set. The elements are used to initialize the set.

    (scheme set) procedure (set-unfold (comparator comparator?) (stop? procedure?) (mapper procedure?) (successor procedure?) seed ) ⟹ set?

    (stop? seed ) ⟹ boolean?

    (mapper seed ) ⟹ *

    (successor seed ) ⟹ *

    Create a newly allocated set as if by set using comparator. If the result of applying the predicate stop? to seed is true, return the set. Otherwise, apply the procedure mapper to seed. The value that mapper returns is added to the set. Then get a new seed by applying the procedure successor to seed, and repeat this algorithm.

    (scheme set) procedure (set? obj ) ⟹ boolean?

    Returns #t if obj is a set, and #f otherwise.

    (scheme set) procedure (set-contains? (set set?) element ) ⟹ boolean?

    Returns #t if element is a member of set and #f otherwise.

    (scheme set) procedure (set-empty? (set set?) ) ⟹ boolean?

    Returns #t if set has no elements and #f otherwise.

    (scheme set) procedure (set-disjoint? (set1 set?) (set2 set?) ) ⟹ boolean?

    Returns #t if set1 and set2 have no elements in common and #f otherwise.

    (scheme set) procedure (set-member (set set?) element default ) ⟹ *

    Returns the element of set that is equal, in the sense of set's equality predicate, to element. If element is not a member of set, default is returned.

    (scheme set) procedure (set-element-comparator (set set?) ) ⟹ comparator?

    Returns the comparator used to compare the elements of set.

    (scheme set) procedure (set-adjoin (set set?) element ... ) ⟹ set?

    The set-adjoin procedure returns a newly allocated set that uses the same comparator as set and contains all the values of set, and in addition each element unless it is already equal (in the sense of the comparator) to one of the existing or newly added members. It is an error to add an element to set that does not return #t when passed to the type test procedure of the comparator.

    (scheme set) procedure (set-adjoin! (set set?) element ... ) ⟹ set?

    The set-adjoin! procedure is the same as set-adjoin, except that it is permitted to mutate and return the set argument rather than allocating a new set.

    (scheme set) procedure (set-replace (set set?) element ) ⟹ set?

    The set-replace procedure returns a newly allocated set that uses the same comparator as set and contains all the values of set except as follows: If element is equal (in the sense of set's comparator) to an existing member of set, then that member is omitted and replaced by element. If there is no such element in set, then set is returned unchanged.

    (scheme set) procedure (set-replace! (set set?) element ) ⟹ set?

    The set-replace! procedure is the same as set-replace, except that it is permitted to mutate and return the set argument rather than allocating a new set.

    (scheme set) procedure (set-delete (set set?) element ... ) ⟹ set?

    The set-delete procedure returns a newly allocated set containing all the values of set except for any that are equal (in the sense of set's comparator) to one or more of the elements. Any element that is not equal to some member of the set is ignored.

    (scheme set) procedure (set-delete! (set set?) element ... ) ⟹ set?

    The set-delete! procedure is the same as set-delete, except that it is permitted to mutate and return the set argument rather than allocating a new set.

    (scheme set) procedure (set-delete-all (set set?) (elements list?) ) ⟹ set?

    The set-delete-all procedure is the same as set-delete, except that it accepts a single argument which is a list of elements to be deleted.

    (scheme set) procedure (set-delete-all! (set set?) (elements list?) ) ⟹ set?

    The set-delete-all! procedure is the same as set-delete!, except that it accepts a single argument which is a list of elements to be deleted.

    (scheme set) procedure (set-search! (set set?) element (failure procedure?) (success procedure?) ) ⟹ (values set?*)

    (failure (insert procedure?) (ignore procedure?) ) ⟹ *

    (insert obj ) ⟹ *

    (ignore obj ) ⟹ *

    (success element (update procedure?) (remove procedure?) ) ⟹ *

    (update new-element obj ) ⟹ *

    (remove obj ) ⟹ *

    The set is searched for element. If it is not found, then the failure procedure is tail-called with two continuation arguments, insert and ignore, and is expected to tail-call one of them. If element is found, then the success procedure is tail-called with the matching element of set and two continuations, update and remove, and is expected to tail-call one of them. The effects of the continuations are as follows (where obj is any Scheme object):

  • Invoking (insert obj) causes element to be inserted into set.
  • Invoking (ignore obj) causes set to remain unchanged.
  • Invoking (update new-element obj) causes new-element to be inserted into set in place of element.
  • Invoking (remove obj) causes the matching element of set to be removed from it.
  • In all cases, two values are returned: the possibly updated set and obj.

    (scheme set) procedure (set-size (set set?) ) ⟹ integer?

    Returns the number of elements in set as an exact integer.

    (scheme set) procedure (set-find (predicate procedure?) (set set?) (failure procedure?) ) ⟹ *

    (predicate obj ) ⟹ boolean?

    (failure ) ⟹ *

    Returns an arbitrarily chosen element of set that satisfies predicate, or the result of invoking failure with no arguments if there is none.

    (scheme set) procedure (set-count (predicate procedure?) (set set?) ) ⟹ integer?

    (predicate obj ) ⟹ boolean?

    Returns the number of elements of set that satisfy predicate as an exact integer.

    (scheme set) procedure (set-any? (predicate procedure?) (set set?) ) ⟹ boolean?

    (predicate obj ) ⟹ boolean?

    Returns #t if any element of set satisfies predicate, or #f otherwise. Note that this differs from the SRFI 1 analogue because it does not return an element of the set.

    (scheme set) procedure (set-every? (predicate procedure?) (set set?) ) ⟹ boolean?

    (predicate obj ) ⟹ boolean?

    Returns #t if every element of set satisfies predicate, or #f otherwise. Note that this differs from the SRFI 1 analogue because it does not return an element of the set.

    (scheme set) procedure (set-map (comparator comparator?) (proc procedure?) (set set?) ) ⟹ *

    (proc obj ) ⟹ *

    Applies proc to each element of set in arbitrary order and returns a newly allocated set, created as if by (set comparator), which contains the results of the applications. For example:

    (set-map string-ci-comparator symbol->string (set eq? 'foo 'bar 'baz)) => (set string-ci-comparator "foo" "bar" "baz")

    Note that, when proc defines a mapping that is not 1:1, some of the mapped objects may be equivalent in the sense of comparator's equality predicate, and in this case duplicate elements are omitted as in the set constructor.

    (scheme set) procedure (set-for-each (proc procedure?) (set set?) ) ⟹ undefined

    (proc obj ) ⟹ undefined

    Applies proc to set in arbitrary order, discarding the returned values. Returns an unspecified result.

    (scheme set) procedure (set-fold (proc procedure?) nil (set set?) ) ⟹ *

    (proc obj state ) ⟹ *

    Invokes proc on each member of set in arbitrary order, passing the result of the previous invocation as a second argument. For the first invocation, nil is used as the second argument. Returns the result of the last invocation, or nil if there was no invocation.

    (scheme set) procedure (set-filter (predicate procedure?) (set set?) ) ⟹ set?

    (predicate obj ) ⟹ *

    Returns a newly allocated set with the same comparator as set, containing just the elements of set that satisfy predicate.

    (scheme set) procedure (set-filter! (predicate procedure?) (set set?) ) ⟹ set?

    (predicate obj ) ⟹ *

    A linear update procedure that returns a set containing just the elements of set that satisfy predicate.

    (scheme set) procedure (set-remove (predicate procedure?) (set set?) ) ⟹ set?

    (predicate obj ) ⟹ *

    Returns a newly allocated set with the same comparator as set, containing just the elements of set that do not satisfy predicate.

    (scheme set) procedure (set-remove! (predicate procedure?) (set set?) ) ⟹ set?

    (predicate obj ) ⟹ *

    A linear update procedure that returns a set containing just the elements of set that do not satisfy predicate.

    (scheme set) procedure (set-partition (predicate procedure?) (set set?) ) ⟹ (values set?set?)

    (predicate obj ) ⟹ *

    Returns two values: a newly allocated set with the same comparator as set that contains just the elements of set that satisfy predicate, and another newly allocated set, also with the same comparator, that contains just the elements of set that do not satisfy predicate.

    (scheme set) procedure (set-partition! (predicate procedure?) (set set?) ) ⟹ (values set?set?)

    (predicate obj ) ⟹ *

    A linear update procedure that returns two sets containing the elements of set that do and do not, respectively, not satisfy predicate.

    (scheme set) procedure (set-copy (set set?) ) ⟹ set?

    Returns a newly allocated set containing the elements of set, and using the same comparator.

    (scheme set) procedure (set->list (set set?) ) ⟹ list?

    Returns a newly allocated list containing the members of set in unspecified order.

    (scheme set) procedure (list->set (comparator comparator?) (list list?) ) ⟹ set?

    Returns a newly allocated set, created as if by set using comparator, that contains the elements of list. Duplicate elements (in the sense of the equality predicate) are omitted.

    (scheme set) procedure (list->set! (set set?) (list list?) ) ⟹ set?

    Returns a set that contains the elements of both set and list. Duplicate elements (in the sense of the equality predicate) are omitted.

    (scheme set) procedure (set=? (set1 set?) (set2 set?) ... ) ⟹ boolean?

    Returns #t if each set contains the same elements.

    (scheme set) procedure (set<? (set1 set?) (set2 set?) ... ) ⟹ boolean?

    Returns #t if each set other than the last is a proper subset of the following set, and #f otherwise.

    (scheme set) procedure (set>? (set1 set?) (set2 set?) ... ) ⟹ boolean?

    Returns #t if each set other than the last is a proper superset of the following set, and #f otherwise.

    (scheme set) procedure (set<=? (set1 set?) (set2 set?) ... ) ⟹ boolean?

    Returns #t if each set other than the last is a subset of the following set, and #f otherwise.

    (scheme set) procedure (set>=? (set1 set?) (set2 set?) ... ) ⟹ boolean?

    Returns #t if each set other than the last is a superset of the following set, and #f otherwise.

    (scheme set) procedure (set-union (set1 set?) (set2 set?) ... ) ⟹ set?

    Return a newly allocated set that is the union of the sets.

    (scheme set) procedure (set-intersection (set1 set?) (set2 set?) ... ) ⟹ set?

    Return a newly allocated set that is the intersection of the sets.

    (scheme set) procedure (set-difference (set1 set?) (set2 set?) ... ) ⟹ set?

    Return a newly allocated set that is the asymmetric difference of the sets. Asymmetric difference is extended to more than two sets by taking the difference between the first set and the union of the others.

    (scheme set) procedure (set-xor (set1 set?) (set2 set?) ) ⟹ set?

    Return a newly allocated set that is the symmetric difference of the sets. Symmetric difference is not extended beyond two sets. Elements in the result set are drawn from the first set in which they appear.

    (scheme set) procedure (set-union! (set1 set?) (set2 set?) ... ) ⟹ set?

    Linear update returning a set that is the union of the sets.

    (scheme set) procedure (set-intersection! (set1 set?) (set2 set?) ... ) ⟹ set?

    Linear update returning a set that is the intersection of the sets.

    (scheme set) procedure (set-difference! (set1 set?) (set2 set?) ... ) ⟹ set?

    Linear update returning a set that is the asymmetric difference of the sets. Asymmetric difference is extended to more than two sets by taking the difference between the first set and the union of the others.

    (scheme set) procedure (set-xor! (set1 set?) (set2 set?) ) ⟹ set?

    Linear update returning a set that is the symmetric difference of the sets. Symmetric difference is not extended beyond two sets. Elements in the result set are drawn from the first set in which they appear.

    (scheme set) procedure (bag (comparator comparator?) element ... ) ⟹ bag?

    Returns a newly allocated empty bag. The comparator argument is a SRFI 114 comparator, which is used to control and distinguish the elements of the bag. The elements are used to initialize the bag.

    (scheme set) procedure (bag-unfold (comparator comparator?) (stop? procedure?) (mapper procedure?) (successor procedure?) seed ) ⟹ bag?

    (stop? seed ) ⟹ boolean?

    (mapper seed ) ⟹ *

    (successor seed ) ⟹ *

    Create a newly allocated bag as if by bag using comparator. If the result of applying the predicate stop? to seed is true, return the bag. Otherwise, apply the procedure mapper to seed. The value that mapper returns is added to the bag. Then get a new seed by applying the procedure successor to seed, and repeat this algorithm.

    (scheme set) procedure (bag? obj ) ⟹ boolean?

    Returns #t if obj is a bag, and #f otherwise.

    (scheme set) procedure (bag-contains? (bag bag?) element ) ⟹ boolean?

    Returns #t if element is a member of bag and #f otherwise.

    (scheme set) procedure (bag-empty? (bag bag?) ) ⟹ boolean?

    Returns #t if bag has no elements and #f otherwise.

    (scheme set) procedure (bag-disjoint? (bag1 bag?) (bag2 bag?) ) ⟹ boolean?

    Returns #t if bag1 and bag2 have no elements in common and #f otherwise.

    (scheme set) procedure (bag-member (bag bag?) element default ) ⟹ *

    Returns the element of bag that is equal, in the sense of bag's equality predicate, to element. If element is not a member of bag, default is returned.

    (scheme set) procedure (bag-element-comparator (bag bag?) ) ⟹ comparator?

    Returns the comparator used to compare the elements of bag.

    (scheme set) procedure (bag-adjoin (bag bag?) element ... ) ⟹ bag?

    The bag-adjoin procedure returns a newly allocated bag that uses the same comparator as bag and contains all the values of bag, and in addition each element unless it is already equal (in the sense of the comparator) to one of the existing or newly added members. It is an error to add an element to bag that does not return #t when passed to the type test procedure of the comparator.

    (scheme set) procedure (bag-adjoin! (bag bag?) element ... ) ⟹ bag?

    The bag-adjoin! procedure is the same as bag-adjoin, except that it is permitted to mutate and return the bag argument rather than allocating a new bag.

    (scheme set) procedure (bag-replace (bag bag?) element ) ⟹ bag?

    The bag-replace procedure returns a newly allocated bag that uses the same comparator as bag and contains all the values of bag except as follows: If element is equal (in the sense of bag's comparator) to an existing member of bag, then that member is omitted and replaced by element. If there is no such element in bag, then bag is returned unchanged.

    (scheme set) procedure (bag-replace! (bag bag?) element ) ⟹ bag?

    The bag-replace! procedure is the same as bag-replace, except that it is permitted to mutate and return the bag argument rather than allocating a new bag.

    (scheme set) procedure (bag-delete (bag bag?) element ... ) ⟹ bag?

    The bag-delete procedure returns a newly allocated bag containing all the values of bag except for any that are equal (in the sense of bag's comparator) to one or more of the elements. Any element that is not equal to some member of the bag is ignored.

    (scheme set) procedure (bag-delete! (bag bag?) element ... ) ⟹ bag?

    The bag-delete! procedure is the same as bag-delete, except that it is permitted to mutate and return the bag argument rather than allocating a new bag.

    (scheme set) procedure (bag-delete-all (bag bag?) (elements list?) ) ⟹ bag?

    The bag-delete-all procedure is the same as bag-delete, except that it accepts a single argument which is a list of elements to be deleted.

    (scheme set) procedure (bag-delete-all! (bag bag?) (elements list?) ) ⟹ bag?

    The bag-delete-all! procedure is the same as bag-delete!, except that it accepts a single argument which is a list of elements to be deleted.

    (scheme set) procedure (bag-search! (bag bag?) element (failure procedure?) (success procedure?) ) ⟹ (values bag?*)

    (failure (insert procedure?) (ignore procedure?) ) ⟹ *

    (insert obj ) ⟹ *

    (ignore obj ) ⟹ *

    (success element (update procedure?) (remove procedure?) ) ⟹ *

    (update new-element obj ) ⟹ *

    (remove obj ) ⟹ *

    The bag is searched for element. If it is not found, then the failure procedure is tail-called with two continuation arguments, insert and ignore, and is expected to tail-call one of them. If element is found, then the success procedure is tail-called with the matching element of bag and two continuations, update and remove, and is expected to tail-call one of them. The effects of the continuations are as follows (where obj is any Scheme object):

  • Invoking (insert obj) causes element to be inserted into bag.
  • Invoking (ignore obj) causes bag to remain unchanged.
  • Invoking (update new-element obj) causes new-element to be inserted into bag in place of element.
  • Invoking (remove obj) causes the matching element of bag to be removed from it.
  • In all cases, two values are returned: the possibly updated bag and obj.

    (scheme set) procedure (bag-size (bag bag?) ) ⟹ integer?

    Returns the number of elements in bag as an exact integer.

    (scheme set) procedure (bag-find (predicate procedure?) (bag bag?) (failure procedure?) ) ⟹ *

    (predicate obj ) ⟹ boolean?

    (failure ) ⟹ *

    Returns an arbitrarily chosen element of bag that satisfies predicate, or the result of invoking failure with no arguments if there is none.

    (scheme set) procedure (bag-count (predicate procedure?) (bag bag?) ) ⟹ integer?

    (predicate obj ) ⟹ boolean?

    Returns the number of elements of bag that satisfy predicate as an exact integer.

    (scheme set) procedure (bag-any? (predicate procedure?) (bag bag?) ) ⟹ boolean?

    (predicate obj ) ⟹ boolean?

    Returns #t if any element of bag satisfies predicate, or #f otherwise. Note that this differs from the SRFI 1 analogue because it does not return an element of the bag.

    (scheme set) procedure (bag-every? (predicate procedure?) (bag bag?) ) ⟹ boolean?

    (predicate obj ) ⟹ boolean?

    Returns #t if every element of bag satisfies predicate, or #f otherwise. Note that this differs from the SRFI 1 analogue because it does not return an element of the bag.

    (scheme set) procedure (bag-map (comparator comparator?) (proc procedure?) (bag bag?) ) ⟹ *

    (proc obj ) ⟹ *

    Applies proc to each element of bag in arbitrary order and returns a newly allocated bag, created as if by (bag comparator), which contains the results of the applications. For example:

    (bag-map string-ci-comparator symbol->string (bag eq? 'foo 'bar 'baz)) => (bag string-ci-comparator "foo" "bar" "baz")

    Note that, when proc defines a mapping that is not 1:1, some of the mapped objects may be equivalent in the sense of comparator's equality predicate, and in this case duplicate elements are omitted as in the bag constructor.

    (scheme set) procedure (bag-for-each (proc procedure?) (bag bag?) ) ⟹ undefined

    (proc obj ) ⟹ undefined

    Applies proc to bag in arbitrary order, discarding the returned values. Returns an unspecified result.

    (scheme set) procedure (bag-fold (proc procedure?) nil (bag bag?) ) ⟹ *

    (proc obj state ) ⟹ *

    Invokes proc on each member of bag in arbitrary order, passing the result of the previous invocation as a second argument. For the first invocation, nil is used as the second argument. Returns the result of the last invocation, or nil if there was no invocation.

    (scheme set) procedure (bag-filter (predicate procedure?) (bag bag?) ) ⟹ bag?

    (predicate obj ) ⟹ *

    Returns a newly allocated bag with the same comparator as bag, containing just the elements of bag that satisfy predicate.

    (scheme set) procedure (bag-filter! (predicate procedure?) (bag bag?) ) ⟹ bag?

    (predicate obj ) ⟹ *

    A linear update procedure that returns a bag containing just the elements of bag that satisfy predicate.

    (scheme set) procedure (bag-remove (predicate procedure?) (bag bag?) ) ⟹ bag?

    (predicate obj ) ⟹ *

    Returns a newly allocated bag with the same comparator as bag, containing just the elements of bag that do not satisfy predicate.

    (scheme set) procedure (bag-remove! (predicate procedure?) (bag bag?) ) ⟹ bag?

    (predicate obj ) ⟹ *

    A linear update procedure that returns a bag containing just the elements of bag that do not satisfy predicate.

    (scheme set) procedure (bag-partition (predicate procedure?) (bag bag?) ) ⟹ (values bag?bag?)

    (predicate obj ) ⟹ *

    Returns two values: a newly allocated bag with the same comparator as bag that contains just the elements of bag that satisfy predicate, and another newly allocated bag, also with the same comparator, that contains just the elements of bag that do not satisfy predicate.

    (scheme set) procedure (bag-partition! (predicate procedure?) (bag bag?) ) ⟹ (values bag?bag?)

    (predicate obj ) ⟹ *

    A linear update procedure that returns two bags containing the elements of bag that do and do not, respectively, not satisfy predicate.

    (scheme set) procedure (bag-copy (bag bag?) ) ⟹ bag?

    Returns a newly allocated bag containing the elements of bag, and using the same comparator.

    (scheme set) procedure (bag->list (bag bag?) ) ⟹ list?

    Returns a newly allocated list containing the members of bag in unspecified order.

    (scheme set) procedure (list->bag (comparator comparator?) (list list?) ) ⟹ bag?

    Returns a newly allocated bag, created as if by bag using comparator, that contains the elements of list. Duplicate elements (in the sense of the equality predicate) are omitted.

    (scheme set) procedure (list->bag! (bag bag?) (list list?) ) ⟹ bag?

    Returns a bag that contains the elements of both bag and list. Duplicate elements (in the sense of the equality predicate) are omitted.

    (scheme set) procedure (bag=? (bag1 bag?) (bag2 bag?) ... ) ⟹ boolean?

    Returns #t if each bag contains the same elements.

    (scheme set) procedure (bag<? (bag1 bag?) (bag2 bag?) ... ) ⟹ boolean?

    Returns #t if each bag other than the last is a proper subbag of the following bag, and #f otherwise.

    (scheme set) procedure (bag>? (bag1 bag?) (bag2 bag?) ... ) ⟹ boolean?

    Returns #t if each bag other than the last is a proper superbag of the following bag, and #f otherwise.

    (scheme set) procedure (bag<=? (bag1 bag?) (bag2 bag?) ... ) ⟹ boolean?

    Returns #t if each bag other than the last is a subbag of the following bag, and #f otherwise.

    (scheme set) procedure (bag>=? (bag1 bag?) (bag2 bag?) ... ) ⟹ boolean?

    Returns #t if each bag other than the last is a superbag of the following bag, and #f otherwise.

    (scheme set) procedure (bag-union (bag1 bag?) (bag2 bag?) ... ) ⟹ bag?

    Return a newly allocated bag that is the union of the bags.

    (scheme set) procedure (bag-intersection (bag1 bag?) (bag2 bag?) ... ) ⟹ bag?

    Return a newly allocated bag that is the intersection of the bags.

    (scheme set) procedure (bag-difference (bag1 bag?) (bag2 bag?) ... ) ⟹ bag?

    Return a newly allocated bag that is the asymmetric difference of the bags. Asymmetric difference is extended to more than two bags by taking the difference between the first bag and the union of the others.

    (scheme set) procedure (bag-xor (bag1 bag?) (bag2 bag?) ) ⟹ bag?

    Return a newly allocated bag that is the symmetric difference of the bags. Symmetric difference is not extended beyond two bags. Elements in the result bag are drawn from the first bag in which they appear.

    (scheme set) procedure (bag-union! (bag1 bag?) (bag2 bag?) ... ) ⟹ bag?

    Linear update returning a bag that is the union of the bags.

    (scheme set) procedure (bag-intersection! (bag1 bag?) (bag2 bag?) ... ) ⟹ bag?

    Linear update returning a bag that is the intersection of the bags.

    (scheme set) procedure (bag-difference! (bag1 bag?) (bag2 bag?) ... ) ⟹ bag?

    Linear update returning a bag that is the asymmetric difference of the bags. Asymmetric difference is extended to more than two bags by taking the difference between the first bag and the union of the others.

    (scheme set) procedure (bag-xor! (bag1 bag?) (bag2 bag?) ) ⟹ bag?

    Linear update returning a bag that is the symmetric difference of the bags. Symmetric difference is not extended beyond two bags. Elements in the result bag are drawn from the first bag in which they appear.

    (scheme set) procedure (bag-sum (bag1 bag?) (bag2 bag?) ... ) ⟹ bag?

    The bag-sum procedure returns a newly allocated bag containing all the unique elements in all the bags, such that the count of each unique element in the result is equal to the sum of the counts of that element in the arguments. It differs from bag-union by treating identical elements as potentially distinct rather than attempting to match them up.

    (scheme set) procedure (bag-sum! (bag1 bag?) (bag2 bag?) ... ) ⟹ bag?

    Linear update returning a bag containing all the unique elements in all the bags, such that the count of each unique element in the result is equal to the sum of the counts of that element in the arguments. It differs from bag-union by treating identical elements as potentially distinct rather than attempting to match them up.

    (scheme set) procedure (bag-product (n integer?) (bag bag?) ) ⟹ bag?

    The bag-product procedure returns a newly allocated bag containing all the unique elements in bag, where the count of each unique element in the bag is equal to the count of that element in bag multiplied by n.

    (scheme set) procedure (bag-product! (n integer?) (bag bag?) ) ⟹ bag?

    Linear update returning a bag containing all the unique elements in bag, where the count of each unique element in the bag is equal to the count of that element in bag multiplied by n.

    (scheme set) procedure (bag-unique-size (bag bag?) ) ⟹ integer?

    Returns the number of unique elements of bag.

    (scheme set) procedure (bag-element-count (bag bag?) element ) ⟹ integer?

    Returns an exact integer representing the number of times that element appears in bag.

    (scheme set) procedure (bag-for-each-unique (proc procedure?) (bag bag?) ) ⟹ undefined

    (proc obj ) ⟹ undefined

    Applies proc to each unique element of bag in arbitrary order, passing the element and the number of times it occurs in bag, and discarding the returned values. Returns an unspecified result.

    (scheme set) procedure (bag-fold-unique (proc procedure?) nil (bag bag?) ) ⟹ *

    (proc obj state ) ⟹ *

    Invokes proc on each unique element of bag in arbitrary order, passing the number of occurrences as a second argument and the result of the previous invocation as a third argument. For the first invocation, nil is used as the third argument. Returns the result of the last invocation.

    (scheme set) procedure (bag-increment! (bag bag?) element count ) ⟹ bag?

    Linear update procedure that returns a bag with the same elements as bag, but with the element count of element in bag increased by the exact integer count (but not less than zero).

    (scheme set) procedure (bag-decrement! (bag bag?) element count ) ⟹ bag?

    Linear update procedure that returns a bag with the same elements as bag, but with the element count of element in bag decreased by the exact integer count (but not less than zero).

    (scheme set) procedure (bag->set (bag bag?) ) ⟹ set?

    The bag->set procedure returns a newly allocated set containing the unique elements (in the sense of the equality predicate) of bag.

    (scheme set) procedure (set->bag (set set?) ) ⟹ bag?

    The set->bag procedure returns a newly allocated bag containing the elements of set.

    (scheme set) procedure (set->bag! (set set?) ) ⟹ bag?

    The set->bag! procedure returns a bag containing the elements of both bag and set.

    (scheme set) procedure (bag->alist (bag bag?) ) ⟹ list?

    The bag->alist procedure returns a newly allocated alist whose keys are the unique elements of bag and whose values are the number of occurrences of each element.

    (scheme set) procedure (alist->bag (comparator comparator?) (alist list?) ) ⟹ bag?

    The alist->bag returning a newly allocated bag based on comparator, where the keys of alist specify the elements and the corresponding values of alist specify how many times they occur.

    set-comparatorcomparator?

    Set comparator. The comparator does not provide comparison procedures, as there is no ordering between sets. It is an error to compare sets with different element comparators.

    bag-comparatorcomparator?

    Bag comparator. The comparator does not provide comparison procedures, as there is no ordering between bags. It is an error to compare bags with different element comparators.

    library (scheme stream)

    stream-nullstream-null?

    Stream-null is a promise that, when forced, is a single object, distinguishable from all other objects, that represents the null stream. Stream-null is immutable and unique.

    (scheme stream) syntax (stream-cons () ((_ obj stream) stream-pair?) )

    stream ⟹ stream?

    Stream-cons is a macro that accepts an object and a stream and creates a newly-allocated stream containing a promise that, when forced, is a stream-pair with the object in its stream-car and the stream in its stream-cdr. Stream-cons must be syntactic, not procedural, because neither object nor stream is evaluated when stream-cons is called. Since stream is not evaluated, when the stream-pair is created, it is not an error to call stream-cons with a stream that is not of type stream; however, doing so will cause an error later when the stream-cdr of the stream-pair is accessed. Once created, a stream-pair is immutable; there is no stream-set-car! or stream-set-cdr! that modifies an existing stream-pair. There is no dotted-pair or improper stream as with lists.

    (scheme stream) procedure (stream? obj ) ⟹ boolean?

    Stream? is a procedure that takes an object and returns #t if the object is a stream and #f otherwise. If object is a stream, stream? does not force its promise. If (stream? obj) is #t, then one of (stream-null? obj) and (stream-pair? obj) will be #t and the other will be #f; if (stream? obj) is #f, both (stream-null? obj) and (stream-pair? obj) will be #f.

    (scheme stream) procedure (stream-null? obj ) ⟹ boolean?

    Stream-null? is a procedure that takes an object and returns #t if the object is the distinguished null stream and #f otherwise. If object is a stream, stream-null? must force its promise in order to distinguish stream-null from stream-pair.

    (scheme stream) procedure (stream-pair? obj ) ⟹ boolean?

    Stream-pair? is a procedure that takes an object and returns #t if the object is a stream-pair constructed by stream-cons and #f otherwise. If object is a stream, stream-pair? must force its promise in order to distinguish stream-null from stream-pair.

    (scheme stream) procedure (stream-car (stream stream-pair?) ) ⟹ *

    Stream-car is a procedure that takes a stream and returns the object stored in the stream-car of the stream. Stream-car signals an error if the object passed to it is not a stream-pair. Calling stream-car causes the object stored there to be evaluated if it has not yet been; the object’s value is cached in case it is needed again.

    (scheme stream) procedure (stream-cdr (stream stream-pair?) ) ⟹ stream?

    Stream-car is a procedure that takes a stream and returns the object stored in the stream-car of the stream. Stream-car signals an error if the object passed to it is not a stream-pair. Calling stream-car causes the object stored there to be evaluated if it has not yet been; the object’s value is cached in case it is needed again.

    (scheme stream) syntax (stream-lambda () ((_ formals body) procedure?) )

    (variable1 ...) variable (variable1 ... variable_n . variable_n+1)

    Stream-lambda creates a procedure that returns a promise to evaluate the body of the procedure. The last body expression to be evaluated must yield a stream. As with normal lambda, args may be a single variable name, in which case all the formal arguments are collected into a single list, or a list of variable names, which may be null if there are no arguments, proper if there are an exact number of arguments, or dotted if a fixed number of arguments is to be followed by zero or more arguments collected into a list. Body must contain at least one expression, and may contain internal definitions preceding any expressions to be evaluated.

    (scheme stream) syntax (define-stream () ((_ (variable parameter1 ...) body)) ((_ (variable parameter1 ... . parameter) body)) )

    Define-stream creates a procedure that returns a stream, and may appear anywhere a normal define may appear, including as an internal definition, and may have internal definitions of its own, including other define-streams. The defined procedure takes arguments in the same way as stream-lambda. Define-stream is syntactic sugar on stream-lambda; see also stream-let, which is also a sugaring of stream-lambda.

    (scheme stream) procedure (list->stream (list-of-objects list?) ) ⟹ stream?

    [α] → {α}

    List->stream takes a list of objects and returns a newly-allocated stream containing in its elements the objects in the list. Since the objects are given in a list, they are evaluated when list->stream is called, before the stream is created. If the list of objects is null, as in (list->stream '()), the null stream is returned. See also stream.

    (scheme stream) procedure (port->stream ) ⟹ stream?

    (scheme stream) procedure (port->stream (port input-port?) ) ⟹ stream?

    port → {char}

    Port->stream takes a port and returns a newly-allocated stream containing in its elements the characters on the port. If port is not given it defaults to the current input port. The returned stream has finite length and is terminated by stream-null.

    (scheme stream) syntax (stream () ((_ object ...) stream?) )

    Stream is syntax that takes zero or more objects and creates a newly-allocated stream containing in its elements the objects, in order. Since stream is syntactic, the objects are evaluated when they are accessed, not when the stream is created. If no objects are given, as in (stream), the null stream is returned. See also list->stream.

    (scheme stream) procedure (stream->list (stream stream?) ) ⟹ list?

    (scheme stream) procedure (stream->list (n integer?) (stream stream?) ) ⟹ list?

    nat × {α} → [α]

    Stream->list takes a natural number n and a stream and returns a newly-allocated list containing in its elements the first n items in the stream. If the stream has less than n items all the items in the stream will be included in the returned list. If n is not given it defaults to infinity, which means that unless stream is finite stream->list will never return.

    (scheme stream) procedure (stream-append (stream stream?) ... ) ⟹ stream?

    {α} ... → {α}

    Stream-append returns a newly-allocated stream containing in its elements those elements contained in its input streams, in order of input. If any of the input streams is infinite, no elements of any of the succeeding input streams will appear in the output stream; thus, if x is infinite, (stream-append x y) ≡ x. See also stream-concat.

    (scheme stream) procedure (stream-concat (stream-of-streams stream?) ) ⟹ stream?

    {{α}} ... → {α}

    Stream-concat takes a stream consisting of one or more streams and returns a newly-allocated stream containing all the elements of the input streams. If any of the streams in the input stream is infinite, any remaining streams in the input stream will never appear in the output stream. See also stream-append.

    (scheme stream) procedure (stream-constant object ... ) ⟹ stream?

    α ... → {α}

    Stream-constant takes one or more objects and returns a newly-allocated stream containing in its elements the objects, repeating the objects in succession forever.

    (scheme stream) procedure (stream-drop (n integer?) (stream stream?) ) ⟹ stream?

    nat × {α} → {α}

    Stream-drop returns the suffix of the input stream that starts at the next element after the first n elements. The output stream shares structure with the input stream; thus, promises forced in one instance of the stream are also forced in the other instance of the stream. If the input stream has less than n elements, stream-drop returns the null stream. See also stream-take.

    (scheme stream) procedure (stream-drop-while (pred? procedure?) (stream stream?) ) ⟹ stream?

    (pred? obj ) ⟹ boolean?

    (α → boolean) × {α} → {α}

    Stream-drop-while returns the suffix of the input stream that starts at the first element x for which (pred? x) is #f. The output stream shares structure with the input stream. See also stream-take-while.

    (scheme stream) procedure (stream-filter (pred? procedure?) (stream stream?) ) ⟹ stream?

    (pred? obj ) ⟹ boolean?

    (α → boolean) × {α} → {α}

    Stream-filter returns a newly-allocated stream that contains only those elements x of the input stream for which (pred? x) is non-#f.

    (scheme stream) procedure (stream-fold (proc procedure?) base (stream stream?) ) ⟹ *

    (proc base element ) ⟹ *

    (α × β → α) × α × {β} → α

    Stream-fold applies a binary procedure to base and the first element of stream to compute a new base, then applies the procedure to the new base and the next element of stream to compute a succeeding base, and so on, accumulating a value that is finally returned as the value of stream-fold when the end of the stream is reached. Stream must be finite, or stream-fold will enter an infinite loop. See also stream-scan, which is similar to stream-fold, but useful for infinite streams. For readers familiar with other functional languages, this is a left-fold; there is no corresponding right-fold, since right-fold relies on finite streams that are fully-evaluated, at which time they may as well be converted to a list.

    (scheme stream) procedure (stream-for-each (proc procedure?) (stream1 stream?) ... ) ⟹ undefined

    (proc element1 ... ) ⟹ undefined

    (α × β × ...) × {α} × {β} ...

    Stream-for-each applies a procedure element-wise to corresponding elements of the input streams for its side-effects; it returns nothing. Stream-for-each stops as soon as any of its input streams is exhausted.

    (scheme stream) procedure (stream-from (from number?) ) ⟹ stream?

    (scheme stream) procedure (stream-from (from number?) (step number?) ) ⟹ stream?

    number × number → {number}

    Stream-from creates a newly-allocated stream that contains first as its first element and increments each succeeding element by step. If step is not given it defaults to 1. First and step may be of any numeric type. Stream-from is frequently useful as a generator in stream-of expressions. See also stream-range for a similar procedure that creates finite streams.

    (scheme stream) procedure (stream-iterate (proc procedure?) base ) ⟹ stream?

    (proc element ) ⟹ *

    (α → α) × α → {α}

    Stream-iterate creates a newly-allocated stream containing base in its first element and applies proc to each element in turn to determine the succeeding element. See also stream-unfold and stream-unfolds.

    (scheme stream) procedure (stream-length (stream stream?) ) ⟹ integer?

    {α} → nat

    Stream-length takes an input stream and returns the number of elements in the stream; it does not evaluate its elements. Stream-length may only be used on finite streams; it enters an infinite loop with infinite streams.

    (scheme stream) syntax (stream-let () ((_ tag ((var expr) ...) body)) )

    Stream-let creates a local scope that binds each variable to the value of its corresponding expression. It additionally binds tag to a procedure which takes the bound variables as arguments and body as its defining expressions, binding the tag with stream-lambda. Tag is in scope within body, and may be called recursively. When the expanded expression defined by the stream-let is evaluated, stream-let evaluates the expressions in its body in an environment containing the newly-bound variables, returning the value of the last expression evaluated, which must yield a stream.

    Stream-let provides syntactic sugar on stream-lambda, in the same manner as normal let provides syntactic sugar on normal lambda. However, unlike normal let, the tag is required, not optional, because unnamed stream-let is meaningless.

    (scheme stream) procedure (stream-map (proc procedure?) (stream1 stream?) ... ) ⟹ stream?

    (proc element1 ... ) ⟹ *

    (α × β ... → ω) × {α} × {β} ... → {ω}

    Stream-map applies a procedure element-wise to corresponding elements of the input streams, returning a newly-allocated stream containing elements that are the results of those procedure applications. The output stream has as many elements as the minimum-length input stream, and may be infinite.

    (scheme stream) syntax (stream-match (_ ) ((_ stream clause ...)) )

    () (pat0 pat1 ...) (pat0 pat1 ... . pat_rest) pat

    identifier _

    stream ⟹ stream?

    Stream-match provides the syntax of pattern-matching for streams. The input stream is an expression that evaluates to a stream. Clauses are of the form (pattern [fender] expr), consisting of a pattern that matches a stream of a particular shape, an optional fender that must succeed if the pattern is to match, and an expression that is evaluated if the pattern matches. There are four types of patterns:

    * () — Matches the null stream.

    * (pat0 pat1 ...) — Matches a finite stream with length exactly equal to the number of pattern elements.

    * (pat0 pat1 ... . patrest) — Matches an infinite stream, or a finite stream with length at least as great as the number of pattern elements before the literal dot.

    * pat — Matches an entire stream. Should always appear last in the list of clauses; it’s not an error to appear elsewhere, but subsequent clauses could never match.

    Each pattern element pati may be either:

    * An identifier — Matches any stream element. Additionally, the value of the stream element is bound to the variable named by the identifier, which is in scope in the fender and expression of the corresponding clause. Each identifier in a single pattern must be unique.

    * A literal underscore — Matches any stream element, but creates no bindings.

    The patterns are tested in order, left-to-right, until a matching pattern is found; if fender is present, it must evaluate as non-#f for the match to be successful. Pattern variables are bound in the corresponding fender and expression. Once the matching pattern is found, the corresponding expression is evaluated and returned as the result of the match. An error is signaled if no pattern matches the input stream.

    (scheme stream) syntax (stream-of (in is ) ((_ expr clause ...) stream?) )

    (var in stream-expr) (var is expr) (pred? expr)

    Stream-of provides the syntax of stream comprehensions, which generate streams by means of looping expressions. The result is a stream of objects of the type returned by expr. There are four types of clauses:

    * (var in stream-expr) — Loop over the elements of stream-expr, in order from the start of the stream, binding each element of the stream in turn to var. Stream-from and stream-range are frequently useful as generators for stream-expr.

    * (var is expr) — Bind var to the value obtained by evaluating expr.

    * (pred? expr) — Include in the output stream only those elements x for which (pred? x) is non-#f.

    The scope of variables bound in the stream comprehension is the clauses to the right of the binding clause (but not the binding clause itself) plus the result expression.

    When two or more generators are present, the loops are processed as if they are nested from left to right; that is, the rightmost generator varies fastest. A consequence of this is that only the first generator may be infinite and all subsequent generators must be finite. If no generators are present, the result of a stream comprehension is a stream containing the result expression; thus, (stream-of 1) produces a finite stream containing only the element 1.

    (scheme stream) procedure (stream-range (first real?) (past real?) ) ⟹ stream?

    (scheme stream) procedure (stream-range (first real?) (past real?) (step real?) ) ⟹ stream?

    number × number × number → {number}

    Stream-range creates a newly-allocated stream that contains first as its first element and increments each succeeding element by step. The stream is finite and ends before past, which is not an element of the stream. If step is not given it defaults to 1 if first is less than past and -1 otherwise. First, past and step may be of any numeric type. Stream-range is frequently useful as a generator in stream-of expressions. See also stream-from for a similar procedure that creates infinite streams.

    Successive elements of the stream are calculated by adding step to first, so if any of first, past or step are inexact, the length of the output stream may differ from (ceiling (- (/ (- past first) step) 1).

    (scheme stream) procedure (stream-ref (stream stream?) (n integer?) ) ⟹ *

    {α} × nat → α

    Stream-ref returns the nth element of stream, counting from zero. An error is signaled if n is greater than or equal to the length of stream.

    (scheme stream) procedure (stream-reverse (stream stream?) ) ⟹ stream?

    {α} → {α}

    Stream-reverse returns a newly-allocated stream containing the elements of the input stream but in reverse order. Stream-reverse may only be used with finite streams; it enters an infinite loop with infinite streams. Stream-reverse does not force evaluation of the elements of the stream.

    (scheme stream) procedure (stream-scan (proc procedure?) base (stream stream?) ) ⟹ stream?

    (proc base element ) ⟹ *

    (α × β → α) × α × {β} → {α}

    Stream-scan accumulates the partial folds of an input stream into a newly-allocated output stream. The output stream is the base followed by (stream-fold proc base (stream-take i stream)) for each of the first i elements of stream.

    (scheme stream) procedure (stream-take (n integer?) (stream stream?) ) ⟹ stream?

    nat × {α} → {α}

    Stream-take takes a non-negative integer n and a stream and returns a newly-allocated stream containing the first n elements of the input stream. If the input stream has less than n elements, so does the output stream. See also stream-drop.

    (scheme stream) procedure (stream-take-while (pred? procedure?) (stream stream?) ) ⟹ stream?

    (pred? obj ) ⟹ boolean?

    (α → boolean) × {α} → {α}

    Stream-take-while takes a predicate and a stream and returns a newly-allocated stream containing those elements x that form the maximal prefix of the input stream for which (pred? x) is non-#f. See also stream-drop-while.

    (scheme stream) procedure (stream-unfold (map procedure?) (pred? procedure?) (gen procedure?) base ) ⟹ stream?

    (map base ) ⟹ *

    (pred? base ) ⟹ boolean?

    (gen base ) ⟹ *

    (α → β) × (α → boolean) × (α → α) × α → {β}

    Stream-unfold is the fundamental recursive stream constructor. It constructs a stream by repeatedly applying gen to successive values of base, in the manner of stream-iterate, then applying map to each of the values so generated, appending each of the mapped values to the output stream as long as (pred? base) is non-#f. See also stream-iterate and stream-unfolds.

    (scheme stream) procedure (stream-unfolds (proc procedure?) seed ) ⟹ (values stream?...)

    (proc seed ) ⟹ (values list? / #f / *...)

    (α → (values α × β ...)) × α → (values {β} ...)

    Stream-unfolds returns n newly-allocated streams containing those elements produced by successive calls to the generator proc, which takes the current seed as its argument and returns n+1 values

    (proc seed → seed result0 ... resultn-1

    where the returned seed is the input seed to the next call to the generator and resulti indicates how to produce the next element of the ith result stream:

    * (value) — value is the next car of the result stream

    * #f — no value produced by this iteration of the generator proc for the result stream

    * () — the end of the result stream

    It may require multiple calls of proc to produce the next element of any particular result stream. See also stream-iterate and stream-unfold.

    (scheme stream) procedure (stream-zip (stream stream?) ... ) ⟹ stream?

    {α} × {β} × ... → {[α β ...]}

    Stream-zip takes one or more input streams and returns a newly-allocated stream in which each element is a list (not a stream) of the corresponding elements of the input streams. The output stream is as long as the shortest input stream, if any of the input streams is finite, or is infinite if all the input streams are infinite.

    A common use of stream-zip is to add an index to a stream, as in (stream-finds eql? obj strm), which returns all the zero-based indices in strm at which obj appears; (stream-find eql? obj strm) returns the first such index, or #f if obj is not in strm.

    library (scheme sort)

    (scheme sort) procedure (list-sorted? (< procedure?) (lis list?) ) ⟹ boolean?

    (< obj1 obj2 ) ⟹ boolean?

    (shared description for list-sorted?, vector-sorted?) These procedures return true iff their input list or vector is in sorted order, as determined by <. Specifically, they return #f iff there is an adjacent pair ... X Y ... in the input list or vector such that Y < X in the sense of <. The optional start and end range arguments restrict vector-sorted? to examining the indicated subvector.

    These procedures are equivalent to the SRFI 95 sorted? procedure when applied to lists or vectors respectively, except that they do not accept a key procedure.

    (scheme sort) procedure (vector-sorted? (< procedure?) (v vector?) ) ⟹ boolean?

    (scheme sort) procedure (vector-sorted? (< procedure?) (v vector?) (start integer?) ) ⟹ boolean?

    (scheme sort) procedure (vector-sorted? (< procedure?) (v vector?) (start integer?) (end integer?) ) ⟹ boolean?

    (< obj1 obj2 ) ⟹ boolean?

    (shared description for list-sorted?, vector-sorted?) These procedures return true iff their input list or vector is in sorted order, as determined by <. Specifically, they return #f iff there is an adjacent pair ... X Y ... in the input list or vector such that Y < X in the sense of <. The optional start and end range arguments restrict vector-sorted? to examining the indicated subvector.

    These procedures are equivalent to the SRFI 95 sorted? procedure when applied to lists or vectors respectively, except that they do not accept a key procedure.

    (scheme sort) procedure (list-sort (< procedure?) (lis list?) ) ⟹ list?

    (< obj1 obj2 ) ⟹ boolean?

    (shared description for list-sort, list-stable-sort) These procedures do not alter their inputs, but are allowed to return a value that shares a common tail with a list argument.

    The list-stable-sort procedure is equivalent to the R6RS list-sort procedure. It is also equivalent to the SRFI 95 sort procedure when applied to lists, except that it does not accept a key procedure.

    (scheme sort) procedure (list-stable-sort (< procedure?) (lis list?) ) ⟹ list?

    (< obj1 obj2 ) ⟹ boolean?

    (shared description for list-sort, list-stable-sort) These procedures do not alter their inputs, but are allowed to return a value that shares a common tail with a list argument.

    The list-stable-sort procedure is equivalent to the R6RS list-sort procedure. It is also equivalent to the SRFI 95 sort procedure when applied to lists, except that it does not accept a key procedure.

    (scheme sort) procedure (list-sort! (< procedure?) (lis list?) ) ⟹ list?

    (< obj1 obj2 ) ⟹ boolean?

    (shared description for list-sort!, list-stable-sort!) These procedures are linear update operators — they are allowed, but not required, to alter the cons cells of their arguments to produce their results. They return a sorted list containing the same elements as lis.

    The list-stable-sort! procedure is equivalent to the SRFI 95 sort! procedure when applied to lists, except that it does not accept a key procedure.

    (scheme sort) procedure (list-stable-sort! (< procedure?) (lis list?) ) ⟹ list?

    (< obj1 obj2 ) ⟹ boolean?

    (shared description for list-sort!, list-stable-sort!) These procedures are linear update operators — they are allowed, but not required, to alter the cons cells of their arguments to produce their results. They return a sorted list containing the same elements as lis.

    The list-stable-sort! procedure is equivalent to the SRFI 95 sort! procedure when applied to lists, except that it does not accept a key procedure.

    (scheme sort) procedure (vector-sort (< procedure?) (v vector?) ) ⟹ boolean?

    (scheme sort) procedure (vector-sort (< procedure?) (v vector?) (start integer?) ) ⟹ boolean?

    (scheme sort) procedure (vector-sort (< procedure?) (v vector?) (start integer?) (end integer?) ) ⟹ boolean?

    (< obj1 obj2 ) ⟹ boolean?

    (shared description for vector-sort, vector-stable-sort) These procedures do not alter their inputs, but allocate a fresh vector as their result, of length end - start. The vector-stable-sort procedure with no optional arguments is equivalent to the R6RS vector-sort procedure. It is also equivalent to the SRFI 95 sort procedure when applied to vectors, except that it does not accept a key procedure.

    (scheme sort) procedure (vector-stable-sort (< procedure?) (v vector?) ) ⟹ boolean?

    (scheme sort) procedure (vector-stable-sort (< procedure?) (v vector?) (start integer?) ) ⟹ boolean?

    (scheme sort) procedure (vector-stable-sort (< procedure?) (v vector?) (start integer?) (end integer?) ) ⟹ boolean?

    (< obj1 obj2 ) ⟹ boolean?

    (shared description for vector-sort, vector-stable-sort) These procedures do not alter their inputs, but allocate a fresh vector as their result, of length end - start. The vector-stable-sort procedure with no optional arguments is equivalent to the R6RS vector-sort procedure. It is also equivalent to the SRFI 95 sort procedure when applied to vectors, except that it does not accept a key procedure.

    (scheme sort) procedure (vector-sort! (< procedure?) (v vector?) ) ⟹ boolean?

    (scheme sort) procedure (vector-sort! (< procedure?) (v vector?) (start integer?) ) ⟹ boolean?

    (scheme sort) procedure (vector-sort! (< procedure?) (v vector?) (start integer?) (end integer?) ) ⟹ boolean?

    (< obj1 obj2 ) ⟹ boolean?

    (shared description for vector-sort!, vector-stable-sort!) These procedures sort their data in-place. (But note that vector-stable-sort! may allocate temporary storage proportional to the size of the input — there are no known O(n lg n) stable vector sorting algorithms that run in constant space.) They return an unspecified value.

    The vector-sort! procedure with no optional arguments is equivalent to the R6RS vector-sort! procedure.

    (scheme sort) procedure (vector-stable-sort! (< procedure?) (v vector?) ) ⟹ boolean?

    (scheme sort) procedure (vector-stable-sort! (< procedure?) (v vector?) (start integer?) ) ⟹ boolean?

    (scheme sort) procedure (vector-stable-sort! (< procedure?) (v vector?) (start integer?) (end integer?) ) ⟹ boolean?

    (< obj1 obj2 ) ⟹ boolean?

    (shared description for vector-sort!, vector-stable-sort!) These procedures sort their data in-place. (But note that vector-stable-sort! may allocate temporary storage proportional to the size of the input — there are no known O(n lg n) stable vector sorting algorithms that run in constant space.) They return an unspecified value.

    The vector-sort! procedure with no optional arguments is equivalent to the R6RS vector-sort! procedure.

    (scheme sort) procedure (list-merge (< procedure?) (lis1 list?) (lis2 list?) ) ⟹ list?

    (< obj1 obj2 ) ⟹ boolean?

    This procedure does not alter its inputs, and is allowed to return a value that shares a common tail with a list argument.

    This procedure is equivalent to the SRFI 95 merge procedure when applied to lists, except that it does not accept a key procedure.

    (scheme sort) procedure (list-merge! (< procedure?) (lis1 list?) (lis2 list?) ) ⟹ list?

    (< obj1 obj2 ) ⟹ boolean?

    This procedure makes only a single, iterative, linear-time pass over its argument lists, using set-cdr!s to rearrange the cells of the lists into the list that is returned — it works "in place." Hence, any cons cell appearing in the result must have originally appeared in an input. It returns the sorted input.

    Additionally, list-merge! is iterative, not recursive — it can operate on arguments of arbitrary size without requiring an unbounded amount of stack space. The intent of this iterative-algorithm commitment is to allow the programmer to be sure that if, for example, list-merge! is asked to merge two ten-million-element lists, the operation will complete without performing some extremely (possibly twenty-million) deep recursion.

    This procedure is equivalent to the SRFI 95 merge! procedure when applied to lists, except that it does not accept a key procedure.

    (scheme sort) procedure (vector-merge (< procedure?) (v1 vector?) (v2 vector?) ) ⟹ vector?

    (scheme sort) procedure (vector-merge (< procedure?) (v1 vector?) (v2 vector?) (start1 integer?) ) ⟹ vector?

    (scheme sort) procedure (vector-merge (< procedure?) (v1 vector?) (v2 vector?) (start1 integer?) (end1 integer?) ) ⟹ vector?

    (scheme sort) procedure (vector-merge (< procedure?) (v1 vector?) (v2 vector?) (start1 integer?) (end1 integer?) (start2 integer?) ) ⟹ vector?

    (scheme sort) procedure (vector-merge (< procedure?) (v1 vector?) (v2 vector?) (start1 integer?) (end1 integer?) (start2 integer?) (end2 integer?) ) ⟹ vector?

    (< obj1 obj2 ) ⟹ boolean?

    This procedure does not alter its inputs, and returns a newly allocated vector of length (end1 - start1) + (end2 - start2).

    This procedure is equivalent to the SRFI 95 merge procedure when applied to vectors, except that it does not accept a key procedure.

    (scheme sort) procedure (vector-merge! (< procedure?) (v1 vector?) (v2 vector?) ) ⟹ vector?

    (scheme sort) procedure (vector-merge! (< procedure?) (v1 vector?) (v2 vector?) (start1 integer?) ) ⟹ vector?

    (scheme sort) procedure (vector-merge! (< procedure?) (v1 vector?) (v2 vector?) (start1 integer?) (end1 integer?) ) ⟹ vector?

    (scheme sort) procedure (vector-merge! (< procedure?) (v1 vector?) (v2 vector?) (start1 integer?) (end1 integer?) (start2 integer?) ) ⟹ vector?

    (scheme sort) procedure (vector-merge! (< procedure?) (v1 vector?) (v2 vector?) (start1 integer?) (end1 integer?) (start2 integer?) (end2 integer?) ) ⟹ vector?

    (< obj1 obj2 ) ⟹ boolean?

    This procedure writes its result into vector to, beginning at index start, for indices less than end, which is defined as start + (end1 - start1) + (end2 - start2). The target subvector to[start, end) may not overlap either of the source subvectors from1[start1, end1] and from2[start2, end2]. It returns an unspecified value.

    This procedure is equivalent to the SRFI 95 merge! procedure when applied to lists, except that it does not accept a key procedure.

    (scheme sort) procedure (list-delete-neighbor-dups (= procedure?) (lis list?) ) ⟹ list?

    (= obj1 obj2 ) ⟹ boolean?

    This procedure does not alter its input list, but its result may share storage with the input list.

    (scheme sort) procedure (list-delete-neighbor-dups! (= procedure?) (lis list?) ) ⟹ list?

    (= obj1 obj2 ) ⟹ boolean?

    This procedure mutates its input list in order to construct its result. It makes only a single, iterative, linear-time pass over its argument, using set-cdr!s to rearrange the cells of the list into the final result — it works "in place." Hence, any cons cell appearing in the result must have originally appeared in the input.

    (scheme sort) procedure (vector-delete-neighbor-dups (= procedure?) (v vector?) ) ⟹ vector?

    (scheme sort) procedure (vector-delete-neighbor-dups (= procedure?) (v vector?) (start integer?) ) ⟹ vector?

    (scheme sort) procedure (vector-delete-neighbor-dups (= procedure?) (v vector?) (start integer?) (end integer?) ) ⟹ vector?

    (= obj1 obj2 ) ⟹ boolean?

    This procedure does not alter its input vector, but rather newly allocates and returns a vector to hold the result.

    (scheme sort) procedure (vector-delete-neighbor-dups! (= procedure?) (v vector?) ) ⟹ vector?

    (scheme sort) procedure (vector-delete-neighbor-dups! (= procedure?) (v vector?) (start integer?) ) ⟹ vector?

    (scheme sort) procedure (vector-delete-neighbor-dups! (= procedure?) (v vector?) (start integer?) (end integer?) ) ⟹ vector?

    (= obj1 obj2 ) ⟹ boolean?

    This procedure reuses its input vector to hold the answer, packing it into the index range [start, newend), where newend is the non-negative exact integer that is returned as its value. The vector is not altered outside the range [start, newend).

    (scheme sort) procedure (vector-find-median (< procedure?) (v vector?) knil ) ⟹ *

    (scheme sort) procedure (vector-find-median (< procedure?) (v vector?) knil (mean procedure?) ) ⟹ *

    (< obj1 obj2 ) ⟹ boolean?

    (mean obj1 obj2 ) ⟹ *

    This procedure does not alter its input vector, but rather newly allocates a vector to hold the intermediate result. Runs in O(n) time.

    (scheme sort) procedure (vector-find-median! (< procedure?) (v vector?) knil ) ⟹ *

    (scheme sort) procedure (vector-find-median! (< procedure?) (v vector?) knil (mean procedure?) ) ⟹ *

    (< obj1 obj2 ) ⟹ boolean?

    (mean obj1 obj2 ) ⟹ *

    This procedure reuses its input vector to hold the intermediate result, leaving it sorted, but is otherwise the same as vector-find-median. Runs in O(n ln n) time.

    (scheme sort) procedure (vector-select! (< procedure?) (v vector?) (k integer?) ) ⟹ *

    (scheme sort) procedure (vector-select! (< procedure?) (v vector?) (k integer?) (start integer?) ) ⟹ *

    (scheme sort) procedure (vector-select! (< procedure?) (v vector?) (k integer?) (start integer?) (end integer?) ) ⟹ *

    (< obj1 obj2 ) ⟹ boolean?

    This procedure returns the kth smallest element (in the sense of the < argument) of the region of a vector between start and end. Elements within the range may be reordered, whereas those outside the range are left alone. Runs in O(n) time.

    (scheme sort) procedure (vector-separate! (< procedure?) (v vector?) (k integer?) ) ⟹ undefined

    (scheme sort) procedure (vector-separate! (< procedure?) (v vector?) (k integer?) (start integer?) ) ⟹ undefined

    (scheme sort) procedure (vector-separate! (< procedure?) (v vector?) (k integer?) (start integer?) (end integer?) ) ⟹ undefined

    (< obj1 obj2 ) ⟹ boolean?

    This procedure places the smallest k elements (in the sense of the < argument) of the region of a vector between start and end into the first k positions of that range, and the remaining elements into the remaining positions. Otherwise, the elements are not in any particular order. Elements outside the range are left alone. Runs in O(n) time. Returns an unspecified value.

    library (scheme text)

    (scheme text) procedure (text? obj ) ⟹ boolean?

    Is obj an immutable text? In particular, (text? obj) returns false if (string? obj) returns true, which implies string? returns false if text? returns true. Must execute in O(1) time.

    (scheme text) procedure (textual? obj ) ⟹ boolean?

    Returns true if and only if obj is an immutable text or a string. Must execute in O(1) time.

    (scheme text) procedure (textual-null? (textual textual?) ) ⟹ boolean?

    Is textual the empty text or the empty string? Must execute in O(1) time.

    (scheme text) procedure (textual-every (pred procedure?) (textual textual?) ) ⟹ *

    (scheme text) procedure (textual-every (pred procedure?) (textual textual?) (start integer?) ) ⟹ *

    (scheme text) procedure (textual-every (pred procedure?) (textual textual?) (start integer?) (end integer?) ) ⟹ *

    (pred (char char?) ) ⟹ *

    (scheme text) procedure (textual-any (pred procedure?) (textual textual?) ) ⟹ *

    (scheme text) procedure (textual-any (pred procedure?) (textual textual?) (start integer?) ) ⟹ *

    (scheme text) procedure (textual-any (pred procedure?) (textual textual?) (start integer?) (end integer?) ) ⟹ *

    (pred (char char?) ) ⟹ *

    Checks to see if every/any character in textual satisfies pred, proceeding from left (index start) to right (index end). textual-every These procedures are short-circuiting: if pred returns false, textual-every does not call pred on subsequent characters; if pred returns true, textual-any does not call pred on subsequent characters; Both procedures are "witness-generating":

  • If textual-every is given an empty interval (with start = end), it returns #t.
  • If textual-every returns true for a non-empty interval (with start < end), the returned true value is the one returned by the final call to the predicate on (text-ref (textual-copy text) (- end 1)).
  • If textual-any returns true, the returned true value is the one returned by the predicate.
  • Note: The names of these procedures do not end with a question mark. This indicates a general value is returned instead of a simple boolean (#t or #f).

    (scheme text) procedure (make-text (len integer?) (char char?) ) ⟹ text?

    Returns a text of the given length filled with the given character.

    (scheme text) procedure (text (char char?) ... ) ⟹ text?

    Returns a text consisting of the given characters.

    (scheme text) procedure (text-tabulate (proc procedure?) (len integer?) ) ⟹ text?

    (proc (k integer?) ) ⟹ char?

    Proc is a procedure that accepts an exact integer as its argument and returns a character. Constructs a text of size len by calling proc on each value from 0 (inclusive) to len (exclusive) to produce the corresponding element of the text. The order in which proc is called on those indexes is not specified.

    (scheme text) procedure (text-unfold (stop? procedure?) (mapper procedure?) (successor procedure?) seed ) ⟹ text?

    (scheme text) procedure (text-unfold (stop? procedure?) (mapper procedure?) (successor procedure?) seed (base textual?) ) ⟹ text?

    (scheme text) procedure (text-unfold (stop? procedure?) (mapper procedure?) (successor procedure?) seed (base textual?) (make-final procedure?) ) ⟹ text?

    (stop? seed ) ⟹ boolean?

    (mapper seed ) ⟹ char? / string? / text? /

    (success seed ) ⟹ *

    (make-final seed ) ⟹ char? / string? / text? /

    This is a fundamental constructor for texts.

  • successor is used to generate a series of "seed" values from the initial seed: seed, (successor seed), (successor2 seed), (successor3 seed), ...
  • stop? tells us when to stop — when it returns true when applied to one of these seed values.
  • mapper maps each seed value to the corresponding character(s) in the result text, which are assembled into that text in left-to-right order. It is an error for mapper to return anything other than a character, string, or text.
  • base is the optional initial/leftmost portion of the constructed text, which defaults to the empty text (text). It is an error if base is anything other than a character, string, or text.
  • make-final is applied to the terminal seed value (on which stop? returns true) to produce the final/rightmost portion of the constructed text. It defaults to (lambda (x) (text)). It is an error for make-final to return anything other than a character, string, or text.
  • text-unfold is a fairly powerful text constructor. You can use it to convert a list to a text, read a port into a text, reverse a text, copy a text, and so forth.

    (scheme text) procedure (text-unfold-right (stop? procedure?) (mapper procedure?) (successor procedure?) seed ) ⟹ text?

    (scheme text) procedure (text-unfold-right (stop? procedure?) (mapper procedure?) (successor procedure?) seed (base textual?) ) ⟹ text?

    (scheme text) procedure (text-unfold-right (stop? procedure?) (mapper procedure?) (successor procedure?) seed (base textual?) (make-final procedure?) ) ⟹ text?

    (stop? seed ) ⟹ boolean?

    (mapper seed ) ⟹ char? / string? / text? /

    (success seed ) ⟹ *

    (make-final seed ) ⟹ char? / string? / text? /

    This is a fundamental constructor for texts. It is the same as text-unfold except the results of mapper are assembled into the text in right-to-left order, base is the optional rightmost portion of the constructed text, and make-final produces the leftmost portion of the constructed text.

    (scheme text) procedure (textual->text (textual textual?) ) ⟹ text?

    When given a text, textual->text just returns that text. When given a string, textual->text returns the result of calling string->text on that string. Signals an error when its argument is neither string nor text.

    (scheme text) procedure (textual->string (textual textual?) ) ⟹ string?

    (scheme text) procedure (textual->string (textual textual?) (start integer?) ) ⟹ string?

    (scheme text) procedure (textual->string (textual textual?) (start integer?) (end integer?) ) ⟹ string?

    (scheme text) procedure (textual->vector (textual textual?) ) ⟹ vector?

    (scheme text) procedure (textual->vector (textual textual?) (start integer?) ) ⟹ vector?

    (scheme text) procedure (textual->vector (textual textual?) (start integer?) (end integer?) ) ⟹ vector?

    return ⟹ (vector (c char?))

    (scheme text) procedure (textual->list (textual textual?) ) ⟹ list?

    (scheme text) procedure (textual->list (textual textual?) (start integer?) ) ⟹ list?

    (scheme text) procedure (textual->list (textual textual?) (start integer?) (end integer?) ) ⟹ list?

    return ⟹ (list (c char?))

    textual->string, textual->vector, and textual->list return a newly allocated (unless empty) mutable string, vector, or list of the characters that make up the given subtext or substring.

    (scheme text) procedure (string->text (string string?) ) ⟹ text?

    (scheme text) procedure (string->text (string string?) (start integer?) ) ⟹ text?

    (scheme text) procedure (string->text (string string?) (start integer?) (end integer?) ) ⟹ text?

    (scheme text) procedure (vector->text (vector vector?) ) ⟹ text?

    (scheme text) procedure (vector->text (vector vector?) (start integer?) ) ⟹ text?

    (scheme text) procedure (vector->text (vector vector?) (start integer?) (end integer?) ) ⟹ text?

    vector ⟹ (vector (c char?))

    (scheme text) procedure (list->text (list list?) ) ⟹ text?

    (scheme text) procedure (list->text (list list?) (start integer?) ) ⟹ text?

    (scheme text) procedure (list->text (list list?) (start integer?) (end integer?) ) ⟹ text?

    list ⟹ (list (c char?))

    These procedures return a text containing the characters of the given substring, subvector, or sublist. The behavior of the text will not be affected by subsequent mutation of the given string, vector, or list.

    (scheme text) procedure (reverse-list->text (char-list list?) ) ⟹ text?

    char-list ⟹ (list (c char?))

    An efficient implementation of (compose list->text reverse):

    (reverse-list->text '(#\a #\B #\c)) → "cBa"

    This is a common idiom in the epilogue of text-processing loops that accumulate their result using a list in reverse order. (See also textual-concatenate-reverse for the "chunked" variant.)

    (scheme text) procedure (textual->utf8 (textual textual?) ) ⟹ bytevector?

    (scheme text) procedure (textual->utf8 (textual textual?) (start integer?) ) ⟹ bytevector?

    (scheme text) procedure (textual->utf8 (textual textual?) (start integer?) (end integer?) ) ⟹ bytevector?

    (scheme text) procedure (textual->utf16 (textual textual?) ) ⟹ bytevector?

    (scheme text) procedure (textual->utf16 (textual textual?) (start integer?) ) ⟹ bytevector?

    (scheme text) procedure (textual->utf16 (textual textual?) (start integer?) (end integer?) ) ⟹ bytevector?

    (scheme text) procedure (textual->utf16be (textual textual?) ) ⟹ bytevector?

    (scheme text) procedure (textual->utf16be (textual textual?) (start integer?) ) ⟹ bytevector?

    (scheme text) procedure (textual->utf16be (textual textual?) (start integer?) (end integer?) ) ⟹ bytevector?

    (scheme text) procedure (textual->utf16le (textual textual?) ) ⟹ bytevector?

    (scheme text) procedure (textual->utf16le (textual textual?) (start integer?) ) ⟹ bytevector?

    (scheme text) procedure (textual->utf16le (textual textual?) (start integer?) (end integer?) ) ⟹ bytevector?

    These procedures return a newly allocated (unless empty) bytevector containing a UTF-8 or UTF-16 encoding of the given subtext or substring.

    The bytevectors returned by textual->utf8, textual->utf16be, and textual->utf16le do not contain a byte-order mark (BOM). textual->utf16be returns a big-endian encoding, while textual->utf16le returns a little-endian encoding.

    The bytevectors returned by textual->utf16 begin with a BOM that declares an implementation-dependent endianness, and the bytevector elements following that BOM encode the given subtext or substring using that endianness.

    (scheme text) procedure (utf8->text (bytevector bytevector?) ) ⟹ text?

    (scheme text) procedure (utf8->text (bytevector bytevector?) (start integer?) ) ⟹ text?

    (scheme text) procedure (utf8->text (bytevector bytevector?) (start integer?) (end integer?) ) ⟹ text?

    (scheme text) procedure (utf16->text (bytevector bytevector?) ) ⟹ text?

    (scheme text) procedure (utf16->text (bytevector bytevector?) (start integer?) ) ⟹ text?

    (scheme text) procedure (utf16->text (bytevector bytevector?) (start integer?) (end integer?) ) ⟹ text?

    (scheme text) procedure (utf16be->text (bytevector bytevector?) ) ⟹ text?

    (scheme text) procedure (utf16be->text (bytevector bytevector?) (start integer?) ) ⟹ text?

    (scheme text) procedure (utf16be->text (bytevector bytevector?) (start integer?) (end integer?) ) ⟹ text?

    (scheme text) procedure (utf16le->text (bytevector bytevector?) ) ⟹ text?

    (scheme text) procedure (utf16le->text (bytevector bytevector?) (start integer?) ) ⟹ text?

    (scheme text) procedure (utf16le->text (bytevector bytevector?) (start integer?) (end integer?) ) ⟹ text?

    These procedures interpret their bytevector argument as a UTF-8 or UTF-16 encoding of a sequence of characters, and return a text containing that sequence.

    The bytevector subrange given to utf16->text may begin with a byte order mark (BOM); if so, that BOM determines whether the rest of the subrange is to be interpreted as big-endian or little-endian; in either case, the BOM will not become a character in the returned text. If the subrange does not begin with a BOM, it is decoded using the same implementation-dependent endianness used by textual->utf16.

    The utf16be->text and utf16le->text procedures interpret their inputs as big-endian or little-endian, respectively. If a BOM is present, it is treated as a normal character and will become part of the result.

    It is an error if the bytevector subrange given to utf8->text contains invalid UTF-8 byte sequences. For the other three procedures, it is an error if start or end are odd, or if the bytevector subrange contains invalid UTF-16 byte sequences.

    (scheme text) procedure (text-length (text text?) ) ⟹ integer?

    Returns the number of characters within the given text. Must execute in O(1) time.

    (scheme text) procedure (text-ref (text text?) (idx integer?) ) ⟹ char?

    Returns character text[idx], using 0-origin indexing. Must execute in O(1) time.

    (scheme text) procedure (textual-length (textual textual?) ) ⟹ integer?

    Returns the number of characters within the given textual. Generalization of text-length to accept strings as well as texts.

    (scheme text) procedure (textual-ref (text textual?) (idx integer?) ) ⟹ char?

    Returns character text[idx], using 0-origin indexing. Generalization of text-ref to accept strings as well as texts.

    (scheme text) procedure (subtext (text text?) (start integer?) (end integer?) ) ⟹ text?

    (scheme text) procedure (subtextual (text textual?) (start integer?) (end integer?) ) ⟹ text?

    These procedures return a text containing the characters of text or textual beginning with index start (inclusive) and ending with index end (exclusive).

    If textual is a string, then that string does not share any storage with the result, so subsequent mutation of that string will not affect the text returned by subtextual. When the first argument is a text, as is required by subtext, implementations are encouraged to return a result that shares storage with that text, to whatever extent sharing is possible while maintaining some small fixed bound on the ratio of storage used by the shared representation divided by the storage that would be used by an unshared representation. In particular, these procedures should just return their first argument when that argument is a text, start is 0, and end is the length of that text.

    (scheme text) procedure (textual-copy (textual textual?) ) ⟹ text?

    (scheme text) procedure (textual-copy (textual textual?) (start integer?) ) ⟹ text?

    (scheme text) procedure (textual-copy (textual textual?) (start integer?) (end integer?) ) ⟹ text?

    Returns a text containing the characters of textual beginning with index start (inclusive) and ending with index end (exclusive).

    Unlike subtext and subtextual, the result of textual-copy never shares substructures that would retain characters or sequences of characters that are substructures of its first argument or previously allocated objects.

    If textual-copy returns an empty text, that empty text may be eq? or eqv? to the text returned by (text). If the text returned by textual-copy is non-empty, then it is not eqv? to any previously extant object.

    (scheme text) procedure (textual-take (textual textual?) (nchars integer?) ) ⟹ text?

    (scheme text) procedure (textual-drop (textual textual?) (nchars integer?) ) ⟹ text?

    (scheme text) procedure (textual-take-right (textual textual?) (nchars integer?) ) ⟹ text?

    (scheme text) procedure (textual-drop-right (textual textual?) (nchars integer?) ) ⟹ text?

    textual-take returns a text containing the first nchars of textual; textual-drop returns a text containing all but the first nchars of textual. textual-take-right returns a text containing the last nchars of textual; textual-drop-right returns a text containing all but the last nchars of textual.

    If textual is a string, then that string does not share any storage with the result, so subsequent mutation of that string will not affect the text returned by these procedures. If textual is a text, implementations are encouraged to return a result that shares storage with that text (which is easily accomplished by using subtext to create the result).

    (scheme text) procedure (textual-pad (textual textual?) (len integer?) ) ⟹ text?

    (scheme text) procedure (textual-pad (textual textual?) (len integer?) (char char?) ) ⟹ text?

    (scheme text) procedure (textual-pad (textual textual?) (len integer?) (char char?) (start integer?) ) ⟹ text?

    (scheme text) procedure (textual-pad (textual textual?) (len integer?) (char char?) (start integer?) (end integer?) ) ⟹ text?

    (scheme text) procedure (textual-pad-right (textual textual?) (len integer?) ) ⟹ text?

    (scheme text) procedure (textual-pad-right (textual textual?) (len integer?) (char char?) ) ⟹ text?

    (scheme text) procedure (textual-pad-right (textual textual?) (len integer?) (char char?) (start integer?) ) ⟹ text?

    (scheme text) procedure (textual-pad-right (textual textual?) (len integer?) (char char?) (start integer?) (end integer?) ) ⟹ text?

    Returns a text of length len comprised of the characters drawn from the given subrange of textual, padded on the left (right) by as many occurrences of the character char as needed. If textual has more than len chars, it is truncated on the left (right) to length len. char defaults to #\space.

    If textual is a string, then that string does not share any storage with the result, so subsequent mutation of that string will not affect the text returned by these procedures. If textual is a text, implementations are encouraged to return a result that shares storage with that text whenever sharing would be space-efficient.

    (scheme text) procedure (textual-trim (textual textual?) ) ⟹ text?

    (scheme text) procedure (textual-trim (textual textual?) (pred procedure?) ) ⟹ text?

    (scheme text) procedure (textual-trim (textual textual?) (pred procedure?) (start integer?) ) ⟹ text?

    (scheme text) procedure (textual-trim (textual textual?) (pred procedure?) (start integer?) (end integer?) ) ⟹ text?

    (pred (char char?) ) ⟹ boolean?

    (scheme text) procedure (textual-trim-right (textual textual?) ) ⟹ text?

    (scheme text) procedure (textual-trim-right (textual textual?) (pred procedure?) ) ⟹ text?

    (scheme text) procedure (textual-trim-right (textual textual?) (pred procedure?) (start integer?) ) ⟹ text?

    (scheme text) procedure (textual-trim-right (textual textual?) (pred procedure?) (start integer?) (end integer?) ) ⟹ text?

    (pred (char char?) ) ⟹ boolean?

    (scheme text) procedure (textual-trim-both (textual textual?) ) ⟹ text?

    (scheme text) procedure (textual-trim-both (textual textual?) (pred procedure?) ) ⟹ text?

    (scheme text) procedure (textual-trim-both (textual textual?) (pred procedure?) (start integer?) ) ⟹ text?

    (scheme text) procedure (textual-trim-both (textual textual?) (pred procedure?) (start integer?) (end integer?) ) ⟹ text?

    (pred (char char?) ) ⟹ boolean?

    Returns a text obtained from the given subrange of textual by skipping over all characters on the left / on the right / on both sides that satisfy the second argument pred: pred defaults to char-whitespace?.

    If textual is a string, then that string does not share any storage with the result, so subsequent mutation of that string will not affect the text returned by these procedures. If textual is a text, implementations are encouraged to return a result that shares storage with that text whenever sharing would be space-efficient.

    (scheme text) procedure (textual-replace (textual1 textual?) (textual2 textual?) (start1 integer?) (end1 integer?) ) ⟹ text?

    (scheme text) procedure (textual-replace (textual1 textual?) (textual2 textual?) (start1 integer?) (end1 integer?) (start2 integer?) ) ⟹ text?

    (scheme text) procedure (textual-replace (textual1 textual?) (textual2 textual?) (start1 integer?) (end1 integer?) (start2 integer?) (end2 integer?) ) ⟹ text?

    Returns

    (textual-append (subtextual textual1 0 start1)

    (subtextual textual2 start2 end2)

    (subtextual textual1 end1 (textual-length textual1)))

    That is, the segment of characters in textual1 from start1 to end1 is replaced by the segment of characters in textual2 from start2 to end2. If start1=end1, this simply splices the characters drawn from textual2 into textual1 at that position.

    (scheme text) procedure (textual=? (textual1 textual?) (textual2 textual?) (textual3 textual?) ... ) ⟹ boolean?

    Returns #t if all the texts have the same length and contain exactly the same characters in the same positions; otherwise returns #f.

    (scheme text) procedure (textual<? (textual1 textual?) (textual2 textual?) (textual3 textual?) ... ) ⟹ boolean?

    (scheme text) procedure (textual>? (textual1 textual?) (textual2 textual?) (textual3 textual?) ... ) ⟹ boolean?

    (scheme text) procedure (textual<=? (textual1 textual?) (textual2 textual?) (textual3 textual?) ... ) ⟹ boolean?

    (scheme text) procedure (textual>=? (textual1 textual?) (textual2 textual?) (textual3 textual?) ... ) ⟹ boolean?

    These procedures return #t if their arguments are (respectively): monotonically increasing, monotonically decreasing, monotonically non-decreasing, or monotonically non-increasing.

    These comparison predicates are required to be transitive.

    These procedures compare texts in an implementation-defined way. One approach is to make them the lexicographic extensions to texts of the corresponding orderings on characters. In that case, text<? would be the lexicographic ordering on texts induced by the ordering char<? on characters, and if two texts differ in length but are the same up to the length of the shorter text, the shorter text would be considered to be lexicographically less than the longer string. However, implementations are also allowed to use more sophisticated locale-specific orderings.

    In all cases, a pair of texts must satisfy exactly one of textual<?, textual=?, and textual>?, must satisfy textual<=? if and only if they do not satisfy textual>?, and must satisfy textual>=? if and only if they do not satisfy textual<?.

    (scheme text) procedure (textual-ci=? (textual1 textual?) (textual2 textual?) (textual3 textual?) ... ) ⟹ boolean?

    Returns #t if, after calling textual-foldcase on each of the arguments, all of the case-folded texts would have the same length and contain the same characters in the same positions; otherwise returns #f.

    (scheme text) procedure (textual-ci<? (textual1 textual?) (textual2 textual?) (textual3 textual?) ... ) ⟹ boolean?

    (scheme text) procedure (textual-ci>? (textual1 textual?) (textual2 textual?) (textual3 textual?) ... ) ⟹ boolean?

    (scheme text) procedure (textual-ci<=? (textual1 textual?) (textual2 textual?) (textual3 textual?) ... ) ⟹ boolean?

    (scheme text) procedure (textual-ci>=? (textual1 textual?) (textual2 textual?) (textual3 textual?) ... ) ⟹ boolean?

    These procedures behave as though they had called textual-foldcase on their arguments before applying the corresponding procedures without "-ci".

    (scheme text) procedure (textual-prefix-length (textual1 textual?) (textual2 textual?) ) ⟹ integer?

    (scheme text) procedure (textual-prefix-length (textual1 textual?) (textual2 textual?) (start1 integer?) ) ⟹ integer?

    (scheme text) procedure (textual-prefix-length (textual1 textual?) (textual2 textual?) (start1 integer?) (end1 integer?) ) ⟹ integer?

    (scheme text) procedure (textual-prefix-length (textual1 textual?) (textual2 textual?) (start1 integer?) (end1 integer?) (start2 integer?) ) ⟹ integer?

    (scheme text) procedure (textual-prefix-length (textual1 textual?) (textual2 textual?) (start1 integer?) (end1 integer?) (start2 integer?) (end2 integer?) ) ⟹ integer?

    (scheme text) procedure (textual-suffix-length (textual1 textual?) (textual2 textual?) ) ⟹ integer?

    (scheme text) procedure (textual-suffix-length (textual1 textual?) (textual2 textual?) (start1 integer?) ) ⟹ integer?

    (scheme text) procedure (textual-suffix-length (textual1 textual?) (textual2 textual?) (start1 integer?) (end1 integer?) ) ⟹ integer?

    (scheme text) procedure (textual-suffix-length (textual1 textual?) (textual2 textual?) (start1 integer?) (end1 integer?) (start2 integer?) ) ⟹ integer?

    (scheme text) procedure (textual-suffix-length (textual1 textual?) (textual2 textual?) (start1 integer?) (end1 integer?) (start2 integer?) (end2 integer?) ) ⟹ integer?

    Return the length of the longest common prefix/suffix of textual1 and textual2. For prefixes, this is equivalent to their "mismatch index" (relative to the start indexes).

    The optional start/end indexes restrict the comparison to the indicated subtexts of textual1 and textual2.

    (scheme text) procedure (textual-prefix? (textual1 textual?) (textual2 textual?) ) ⟹ boolean?

    (scheme text) procedure (textual-prefix? (textual1 textual?) (textual2 textual?) (start1 integer?) ) ⟹ boolean?

    (scheme text) procedure (textual-prefix? (textual1 textual?) (textual2 textual?) (start1 integer?) (end1 integer?) ) ⟹ boolean?

    (scheme text) procedure (textual-prefix? (textual1 textual?) (textual2 textual?) (start1 integer?) (end1 integer?) (start2 integer?) ) ⟹ boolean?

    (scheme text) procedure (textual-prefix? (textual1 textual?) (textual2 textual?) (start1 integer?) (end1 integer?) (start2 integer?) (end2 integer?) ) ⟹ boolean?

    (scheme text) procedure (textual-suffix? (textual1 textual?) (textual2 textual?) ) ⟹ boolean?

    (scheme text) procedure (textual-suffix? (textual1 textual?) (textual2 textual?) (start1 integer?) ) ⟹ boolean?

    (scheme text) procedure (textual-suffix? (textual1 textual?) (textual2 textual?) (start1 integer?) (end1 integer?) ) ⟹ boolean?

    (scheme text) procedure (textual-suffix? (textual1 textual?) (textual2 textual?) (start1 integer?) (end1 integer?) (start2 integer?) ) ⟹ boolean?

    (scheme text) procedure (textual-suffix? (textual1 textual?) (textual2 textual?) (start1 integer?) (end1 integer?) (start2 integer?) (end2 integer?) ) ⟹ boolean?

    Is textual1 a prefix/suffix of textual2?

    The optional start/end indexes restrict the comparison to the indicated subtexts of textual1 and textual2.

    (scheme text) procedure (textual-index (textual textual?) (pred procedure?) ) ⟹ #f / integer? /

    (scheme text) procedure (textual-index (textual textual?) (pred procedure?) (start integer?) ) ⟹ #f / integer? /

    (scheme text) procedure (textual-index (textual textual?) (pred procedure?) (start integer?) (end integer?) ) ⟹ #f / integer? /

    (pred (char char?) ) ⟹ boolean?

    (scheme text) procedure (textual-index-right (textual textual?) (pred procedure?) ) ⟹ #f / integer? /

    (scheme text) procedure (textual-index-right (textual textual?) (pred procedure?) (start integer?) ) ⟹ #f / integer? /

    (scheme text) procedure (textual-index-right (textual textual?) (pred procedure?) (start integer?) (end integer?) ) ⟹ #f / integer? /

    (pred (char char?) ) ⟹ boolean?

    (scheme text) procedure (textual-skip (textual textual?) (pred procedure?) ) ⟹ #f / integer? /

    (scheme text) procedure (textual-skip (textual textual?) (pred procedure?) (start integer?) ) ⟹ #f / integer? /

    (scheme text) procedure (textual-skip (textual textual?) (pred procedure?) (start integer?) (end integer?) ) ⟹ #f / integer? /

    (pred (char char?) ) ⟹ boolean?

    (scheme text) procedure (textual-skip-right (textual textual?) (pred procedure?) ) ⟹ #f / integer? /

    (scheme text) procedure (textual-skip-right (textual textual?) (pred procedure?) (start integer?) ) ⟹ #f / integer? /

    (scheme text) procedure (textual-skip-right (textual textual?) (pred procedure?) (start integer?) (end integer?) ) ⟹ #f / integer? /

    (pred (char char?) ) ⟹ boolean?

    textual-index searches through the given subtext or substring from the left, returning the index of the leftmost character satisfying the predicate pred. textual-index-right searches from the right, returning the index of the rightmost character satisfying the predicate pred. If no match is found, these procedures return #f.

    Rationale: The SRFI 130 analogues of these procedures return cursors, even when no match is found, and SRFI 130's string-index-right returns the successor of the cursor for the first character that satisfies the predicate. As there are no cursors in this SRFI, it seems best to follow the more intuitive and long-standing precedent set by SRFI 13.

    The start and end arguments specify the beginning and end of the search; the valid indexes relevant to the search include start but exclude end. Beware of "fencepost" errors: when searching right-to-left, the first index considered is (- end 1), whereas when searching left-to-right, the first index considered is start. That is, the start/end indexes describe the same half-open interval [start,end) in these procedures that they do in all other procedures specified by this SRFI.

    The skip functions are similar, but use the complement of the criterion: they search for the first char that doesn't satisfy pred.

    (scheme text) procedure (textual-contains (textual1 textual?) (textual2 textual?) ) ⟹ #f / integer? /

    (scheme text) procedure (textual-contains (textual1 textual?) (textual2 textual?) (start1 integer?) ) ⟹ #f / integer? /

    (scheme text) procedure (textual-contains (textual1 textual?) (textual2 textual?) (start1 integer?) (end1 integer?) ) ⟹ #f / integer? /

    (scheme text) procedure (textual-contains (textual1 textual?) (textual2 textual?) (start1 integer?) (end1 integer?) (start2 integer?) ) ⟹ #f / integer? /

    (scheme text) procedure (textual-contains (textual1 textual?) (textual2 textual?) (start1 integer?) (end1 integer?) (start2 integer?) (end2 integer?) ) ⟹ #f / integer? /

    (scheme text) procedure (textual-contains-right (textual1 textual?) (textual2 textual?) ) ⟹ #f / integer? /

    (scheme text) procedure (textual-contains-right (textual1 textual?) (textual2 textual?) (start1 integer?) ) ⟹ #f / integer? /

    (scheme text) procedure (textual-contains-right (textual1 textual?) (textual2 textual?) (start1 integer?) (end1 integer?) ) ⟹ #f / integer? /

    (scheme text) procedure (textual-contains-right (textual1 textual?) (textual2 textual?) (start1 integer?) (end1 integer?) (start2 integer?) ) ⟹ #f / integer? /

    (scheme text) procedure (textual-contains-right (textual1 textual?) (textual2 textual?) (start1 integer?) (end1 integer?) (start2 integer?) (end2 integer?) ) ⟹ #f / integer? /

    Does the subtext of textual1 specified by start1 and end1 contain the sequence of characters given by the subtext of textual2 specified by start2 and end2?

    Returns #f if there is no match. If start2 = end2, textual-contains returns start1 but textual-contains-right returns end1. Otherwise returns the index in textual1 for the first character of the first/last match; that index lies within the half-open interval [start1,end1), and the match lies entirely within the [start1,end1) range of textual1.

    (scheme text) procedure (textual-upcase (textual textual?) ) ⟹ text?

    (scheme text) procedure (textual-downcase (textual textual?) ) ⟹ text?

    (scheme text) procedure (textual-foldcase (textual textual?) ) ⟹ text?

    (scheme text) procedure (textual-titlecase (textual textual?) ) ⟹ text?

    These procedures return the text obtained by applying Unicode's full uppercasing, lowercasing, case-folding, or title-casing algorithms to their argument. In some cases, the length of the result may be different from the length of the argument. Note that language-sensitive mappings and foldings are not used.

    (scheme text) procedure (textual-append (textual textual?) ... ) ⟹ text?

    Returns a text whose sequence of characters is the concatenation of the sequences of characters in the given arguments.

    (scheme text) procedure (textual-concatenate (textual-list list?) ) ⟹ text?

    Concatenates the elements of textual-list together into a single text.

    If any elements of textual-list are strings, then those strings do not share any storage with the result, so subsequent mutation of those string will not affect the text returned by this procedure. Implementations are encouraged to return a result that shares storage with some of the texts in the list if that sharing would be space-efficient.

    Rationale: Some implementations of Scheme limit the number of arguments that may be passed to an n-ary procedure, so the (apply textual-append textual-list) idiom, which is otherwise equivalent to using this procedure, is not as portable.

    (scheme text) procedure (textual-concatenate-reverse (textual-list list?) ) ⟹ text?

    (scheme text) procedure (textual-concatenate-reverse (textual-list list?) (final-textual textual?) ) ⟹ text?

    (scheme text) procedure (textual-concatenate-reverse (textual-list list?) (final-textual textual?) (end integer?) ) ⟹ text?

    With no optional arguments, calling this procedure is equivalent to

    (textual-concatenate (reverse textual-list))

    If the optional argument final-textual is specified, it is effectively consed onto the beginning of textual-list before performing the list-reverse and textual-concatenate operations.

    If the optional argument end is given, only the characters up to but not including end in final-textual are added to the result, thus producing

    (textual-concatenate

    (reverse (cons (subtext final-textual 0 end)

    textual-list)))

    (scheme text) procedure (textual-join (textual-list list?) ) ⟹ text?

    (scheme text) procedure (textual-join (textual-list list?) (delimiter textual?) ) ⟹ text?

    (scheme text) procedure (textual-join (textual-list list?) (delimiter textual?) (grammar symbol?) ) ⟹ text?

    This procedure is a simple unparser; it pastes texts together using the delimiter text.

    textual-list is a list of texts and/or strings. delimiter is a text or a string. The grammar argument is a symbol that determines how the delimiter is used, and defaults to 'infix. It is an error for grammar to be any symbol other than these four:

    'infix means an infix or separator grammar: insert the delimiter between list elements. An empty list will produce an empty text.

    'strict-infix means the same as 'infix if the textual-list is non-empty, but will signal an error if given an empty list. (This avoids an ambiguity shown in the examples below.)

    'suffix means a suffix or terminator grammar: insert the delimiter after every list element.

    'prefix means a prefix grammar: insert the delimiter before every list element.

    The delimiter is the text used to delimit elements; it defaults to a single space " ".

    (scheme text) procedure (textual-fold (kons procedure?) knil (textual textual?) ) ⟹ *

    (scheme text) procedure (textual-fold (kons procedure?) knil (textual textual?) (start integer?) ) ⟹ *

    (scheme text) procedure (textual-fold (kons procedure?) knil (textual textual?) (start integer?) (end integer?) ) ⟹ *

    (kons (char char?) state ) ⟹ *

    (scheme text) procedure (textual-fold-right (kons procedure?) knil (textual textual?) ) ⟹ *

    (scheme text) procedure (textual-fold-right (kons procedure?) knil (textual textual?) (start integer?) ) ⟹ *

    (scheme text) procedure (textual-fold-right (kons procedure?) knil (textual textual?) (start integer?) (end integer?) ) ⟹ *

    (kons (char char?) state ) ⟹ *

    These are the fundamental iterators for texts.

    The textual-fold procedure maps the kons procedure across the given text or string from left to right:

    (... (kons textual[2] (kons textual[1] (kons textual[0] knil))))

    The textual-fold-right procedure maps kons across the given text or string from right to left:

    (kons textual[0]

    (... (kons textual[end-3]

    (kons textual[end-2]

    (kons textual[end-1]

    knil)))))

    (scheme text) procedure (textual-map (proc procedure?) (textual1 textual?) (textual2 textual?) ... ) ⟹ text?

    (proc (char1 char?) (char2 char?) ... ) ⟹ textual? / char? /

    It is an error if proc does not accept as many arguments as the number of textual arguments passed to textual-map, does not accept characters as arguments, or returns a value that is not a character, string, or text.

    The textual-map procedure applies proc element-wise to the characters of the textual arguments, converts each value returned by proc to a text, and returns the concatenation of those texts. If more than one textual argument is given and not all have the same length, then textual-map terminates when the shortest textual argument runs out. The dynamic order in which proc is called on the characters of the textual arguments is unspecified, as is the dynamic order in which the coercions are performed. If any strings returned by proc are mutated after they have been returned and before the call to textual-map has returned, then textual-map returns a text with unspecified contents; the textual-map procedure itself does not mutate those strings.

    (scheme text) procedure (textual-for-each (proc procedure?) (textual1 textual?) (textual2 textual?) ... ) ⟹ undefined

    (proc (char1 char?) (char2 char?) ... ) ⟹ undefined

    It is an error if proc does not accept as many arguments as the number of textual arguments passed to textual-map or does not accept characters as arguments.

    The textual-for-each procedure applies proc element-wise to the characters of the textual arguments, going from left to right. If more than one textual argument is given and not all have the same length, then textual-for-each terminates when the shortest textual argument runs out.

    (scheme text) procedure (textual-map-index (proc procedure?) (textual textual?) ) ⟹ text?

    (scheme text) procedure (textual-map-index (proc procedure?) (textual textual?) (start integer?) ) ⟹ text?

    (scheme text) procedure (textual-map-index (proc procedure?) (textual textual?) (start integer?) (end integer?) ) ⟹ text?

    (proc (char char?) ) ⟹ textual? / char? /

    Calls proc on each valid index of the specified subtext or substring, converts the results of those calls into texts, and returns the concatenation of those texts. It is an error for proc to return anything other than a character, string, or text. The dynamic order in which proc is called on the indexes is unspecified, as is the dynamic order in which the coercions are performed. If any strings returned by proc are mutated after they have been returned and before the call to textual-map-index has returned, then textual-map-index returns a text with unspecified contents; the textual-map-index procedure itself does not mutate those strings.

    (scheme text) procedure (textual-for-each-index (proc procedure?) (textual textual?) ) ⟹ undefined

    (scheme text) procedure (textual-for-each-index (proc procedure?) (textual textual?) (start integer?) ) ⟹ undefined

    (scheme text) procedure (textual-for-each-index (proc procedure?) (textual textual?) (start integer?) (end integer?) ) ⟹ undefined

    (proc (char char?) ) ⟹ undefined

    Calls proc on each valid index of the specified subtext or substring, in increasing order, discarding the results of those calls. This is simply a safe and correct way to loop over a subtext or substring.

    (scheme text) procedure (textual-count (textual textual?) (pred procedure?) ) ⟹ integer?

    (scheme text) procedure (textual-count (textual textual?) (pred procedure?) (start integer?) ) ⟹ integer?

    (scheme text) procedure (textual-count (textual textual?) (pred procedure?) (start integer?) (end integer?) ) ⟹ integer?

    (pred (char char?) ) ⟹ boolean?

    Returns a count of the number of characters in the specified subtext of textual that satisfy the given predicate.

    (scheme text) procedure (textual-filter (pred procedure?) (textual textual?) ) ⟹ text?

    (scheme text) procedure (textual-filter (pred procedure?) (textual textual?) (start integer?) ) ⟹ text?

    (scheme text) procedure (textual-filter (pred procedure?) (textual textual?) (start integer?) (end integer?) ) ⟹ text?

    (pred (char char?) ) ⟹ boolean?

    (scheme text) procedure (textual-remove (pred procedure?) (textual textual?) ) ⟹ text?

    (scheme text) procedure (textual-remove (pred procedure?) (textual textual?) (start integer?) ) ⟹ text?

    (scheme text) procedure (textual-remove (pred procedure?) (textual textual?) (start integer?) (end integer?) ) ⟹ text?

    (pred (char char?) ) ⟹ boolean?

    Filter the given subtext of textual, retaining only those characters that satisfy / do not satisfy pred.

    If textual is a string, then that string does not share any storage with the result, so subsequent mutation of that string will not affect the text returned by these procedures. If textual is a text, implementations are encouraged to return a result that shares storage with that text whenever sharing would be space-efficient.

    (scheme text) procedure (textual-replicate (textual textual?) (from integer?) (to integer?) ) ⟹ text?

    (scheme text) procedure (textual-replicate (textual textual?) (from integer?) (to integer?) (start integer?) ) ⟹ text?

    (scheme text) procedure (textual-replicate (textual textual?) (from integer?) (to integer?) (start integer?) (end integer?) ) ⟹ text?

    This is an "extended subtext" procedure that implements replicated copying of a subtext or substring.

    textual is a text or string; start and end are optional arguments that specify a subtext of textual, defaulting to 0 and the length of textual. This subtext is conceptually replicated both up and down the index space, in both the positive and negative directions. textual-replicate returns the subtext of this text beginning at index from, and ending at to. It is an error if from is greater than to.

    Note that

  • The from/to arguments give a half-open range containing the characters from index from up to, but not including, index to.
  • The from/to indexes are not expressed in the index space of textual. They refer instead to the replicated index space of the subtext defined by textual, start, and end.
  • It is an error if start=end, unless from=to, which is allowed as a special case.

    (scheme text) procedure (textual-split (textual textual?) (delimiter textual?) ) ⟹ list?

    (scheme text) procedure (textual-split (textual textual?) (delimiter textual?) (grammar symbol?) ) ⟹ list?

    (scheme text) procedure (textual-split (textual textual?) (delimiter textual?) (grammar symbol?) (limit (or #finteger?)) ) ⟹ list?

    (scheme text) procedure (textual-split (textual textual?) (delimiter textual?) (grammar symbol?) (limit (or #finteger?)) (start integer?) ) ⟹ list?

    (scheme text) procedure (textual-split (textual textual?) (delimiter textual?) (grammar symbol?) (limit (or #finteger?)) (start integer?) (end integer?) ) ⟹ list?

    Returns a list of texts representing the words contained in the subtext of textual from start (inclusive) to end (exclusive). The delimiter is a text or string to be used as the word separator. This will often be a single character, but multiple characters are allowed for use cases such as splitting on "\r\n". The returned list will have one more item than the number of non-overlapping occurrences of the delimiter in the text. If delimiter is an empty text, then the returned list contains a list of texts, each of which contains a single character.

    The grammar is a symbol with the same meaning as in the textual-join procedure. If it is infix, which is the default, processing is done as described above, except an empty textual produces the empty list; if grammar is strict-infix, then an empty textual signals an error. The values prefix and suffix cause a leading/trailing empty text in the result to be suppressed.

    If limit is a non-negative exact integer, at most that many splits occur, and the remainder of textual is returned as the final element of the list (so the result will have at most limit+1 elements). If limit is not specified or is #f, then as many splits as possible are made. It is an error if limit is any other value.

    library (scheme vector)

    (scheme vector) procedure (make-vector (k integer?) ) ⟹ vector?

    (scheme vector) procedure (make-vector (k integer?) fill ) ⟹ vector?

    Creates and returns a vector of size size. If fill is specified, all the elements of the vector are initialized to fill. Otherwise, their contents are indeterminate.

    (scheme vector) procedure (vector obj ... ) ⟹ vector?

    Creates and returns a vector whose elements are x ....

    (scheme vector) procedure (vector-unfold (f procedure?) (length integer?) initial-seed ... ) ⟹ vector?

    (f (index integer?) seed ... ) ⟹ (values **...)

    The fundamental vector constructor. Creates a vector whose length is length and iterates across each index k between 0 and length, applying f at each iteration to the current index and current seeds, in that order, to receive n + 1 values: first, the element to put in the kth slot of the new vector and n new seeds for the next iteration. It is an error for the number of seeds to vary between iterations. Note that the termination condition is different from the unfold procedure of SRFI 1.

    (scheme vector) procedure (vector-unfold-right (f procedure?) (length integer?) initial-seed ... ) ⟹ vector?

    (f (index integer?) seed ... ) ⟹ (values **...)

    Like vector-unfold, but it uses f to generate elements from right-to-left, rather than left-to-right. The first index used is length - 1. Note that the termination condition is different from the unfold-right procedure of SRFI 1.

    (scheme vector) procedure (vector-copy (vector vector?) ) ⟹ vector?

    (scheme vector) procedure (vector-copy (vector vector?) (start integer?) ) ⟹ vector?

    (scheme vector) procedure (vector-copy (vector vector?) (start integer?) (end integer?) ) ⟹ vector?

    Allocates a new vector whose length is end - start and fills it with elements from vec, taking elements from vec starting at index start and stopping at index end. Start defaults to 0 and end defaults to the value of (vector-length vec). SRFI 43 provides an optional fill argument to supply values if end is greater than the length of vec. Neither R7RS-small nor this SRFI requires support for this argument.

    (scheme vector) procedure (vector-reverse-copy (vector vector?) ) ⟹ vector?

    (scheme vector) procedure (vector-reverse-copy (vector vector?) (start integer?) ) ⟹ vector?

    (scheme vector) procedure (vector-reverse-copy (vector vector?) (start integer?) (end integer?) ) ⟹ vector?

    Like vector-copy, but it copies the elements in the reverse order from vec.

    (scheme vector) procedure (vector-append (vector vector?) ... ) ⟹ vector?

    Returns a newly allocated vector that contains all elements in order from the subsequent locations in vec ....

    (scheme vector) procedure (vector-concatenate (list-of-vectors list?) ... ) ⟹ vector?

    list-of-vectors ⟹ (list (vec vector?))

    Appends each vector in list-of-vectors.

    (scheme vector) procedure (vector-append-subvectors (vec1 vector?) (start1 integer?) (end1 integer?) ... ) ⟹ vector?

    Returns a vector that contains every element of each vec from start to end in the specified order. This procedure is a generalization of vector-append.

    (scheme vector) procedure (vector? obj ) ⟹ boolean?

    Disjoint type predicate for vectors: this returns #t if x is a vector, and #f if otherwise.

    (scheme vector) procedure (vector-empty? (vec vector?) ) ⟹ boolean?

    Returns #t if vec is empty, i.e. its length is 0, and #f if not.

    (scheme vector) procedure (vector= (elt=? procedure?) (vec vector?) ... ) ⟹ boolean?

    (elt=? a b ) ⟹ boolean?

    Vector structure comparator, generalized across user-specified element comparators. Vectors a and b are considered equal by vector= iff their lengths are the same, and for each respective element Ea and Eb, (elt=? Ea Eb) returns a true value. Elt=? is always applied to two arguments.

    If there are only zero or one vector arguments, #t is automatically returned. The dynamic order in which comparisons of elements and of vectors are performed is left completely unspecified; do not rely on a particular order.

    (scheme vector) procedure (vector-ref (vector vector?) (k integer?) ) ⟹ *

    Vector element dereferencing: returns the value that the location in vec at i is mapped to in the store. Indexing is based on zero. I must be within the range [0, (vector-length vec)).

    (scheme vector) procedure (vector-length (vector vector?) ) ⟹ integer?

    Returns the length of vec, the number of locations reachable from vec. (The careful word 'reachable' is used to allow for 'vector slices,' whereby vec refers to a larger vector that contains more locations that are unreachable from vec. This SRFI does not define vector slices, but later SRFIs may.)

    (scheme vector) procedure (vector-fold (kons procedure?) knil (vec1 vector?) (vec2 vector?) ... ) ⟹ *

    (kons state obj1 obj2 ... ) ⟹ *

    The fundamental vector iterator. Kons is iterated over each value in all of the vectors, stopping at the end of the shortest; kons is applied as (kons state (vector-ref vec1 i) (vector-ref vec2 i) ...) where state is the current state value — the current state value begins with knil, and becomes whatever kons returned on the previous iteration —, and i is the current index.

    The iteration is strictly left-to-right.

    (scheme vector) procedure (vector-fold-right (kons procedure?) knil (vec1 vector?) (vec2 vector?) ... ) ⟹ *

    (kons state obj1 obj2 ... ) ⟹ *

    Similar to vector-fold, but it iterates right to left instead of left to right.

    (scheme vector) procedure (vector-map (proc procedure?) (vector1 vector?) (vector2 vector?) ... ) ⟹ vector?

    (proc obj ... ) ⟹ *

    Constructs a new vector of the shortest size of the vector arguments. Each element at index i of the new vector is mapped from the old vectors by (f (vector-ref vec1 i) (vector-ref vec2 i) ...). The dynamic order of application of f is unspecified.

    (scheme vector) procedure (vector-map! (proc procedure?) (vector1 vector?) (vector2 vector?) ... ) ⟹ undefined

    (proc obj ... ) ⟹ *

    Similar to vector-map, but rather than mapping the new elements into a new vector, the new mapped elements are destructively inserted into vec1. Again, the dynamic order of application of f unspecified, so it is dangerous for f to apply either vector-ref or vector-set! to vec1 in f.

    (scheme vector) procedure (vector-for-each (proc procedure?) (vector1 vector?) (vector2 vector?) ... ) ⟹ undefined

    (proc obj ... ) ⟹ undefined

    Simple vector iterator: applies f to the corresponding list of parallel elements from vec1 vec2 ... in the range [0, length), where length is the length of the smallest vector argument passed, In contrast with vector-map, f is reliably applied to each subsequent element, starting at index 0, in the vectors.

    (scheme vector) procedure (vector-count (pred? procedure?) (vec1 vector?) (vec2 vector?) ... ) ⟹ integer?

    (pred? obj1 obj2 ... ) ⟹ *

    Counts the number of parallel elements in the vectors that satisfy pred?, which is applied, for each index i in the range [0, length) where length is the length of the smallest vector argument, to each parallel element in the vectors, in order.

    (scheme vector) procedure (vector-cumulate (f procedure?) knil (vec vector?) ) ⟹ vector?

    (f obj1 obj2 ) ⟹ *

    Returns a newly allocated vector new with the same length as vec. Each element i of new is set to the result of invoking f on newi-1 and veci, except that for the first call on f, the first argument is knil. The new vector is returned.

    Note that the order of arguments to vector-cumulate was changed by errata-3 on 2016-09-02.

    (scheme vector) procedure (vector-index (pred? procedure?) (vec1 vector?) (vec2 vector?) ... ) ⟹ integer? / #f /

    (pred? obj1 obj2 ... ) ⟹ *

    Finds & returns the index of the first elements in vec1 vec2 ... that satisfy pred?. If no matching element is found by the end of the shortest vector, #f is returned.

    (scheme vector) procedure (vector-index-right (pred? procedure?) (vec1 vector?) (vec2 vector?) ... ) ⟹ integer? / #f /

    (pred? obj1 obj2 ... ) ⟹ *

    Like vector-index, but it searches right-to-left, rather than left-to-right, and all of the vectors must have the same length.

    (scheme vector) procedure (vector-skip (pred? procedure?) (vec1 vector?) (vec2 vector?) ... ) ⟹ integer? / #f /

    (pred? obj1 obj2 ... ) ⟹ *

    Finds & returns the index of the first elements in vec1 vec2 ... that do not satisfy pred?. If all the values in the vectors satisfy pred? until the end of the shortest vector, this returns #f.

    (scheme vector) procedure (vector-skip-right (pred? procedure?) (vec1 vector?) (vec2 vector?) ... ) ⟹ integer? / #f /

    (pred? obj1 obj2 ... ) ⟹ *

    Like vector-skip, but it searches for a non-matching element right-to-left, rather than left-to-right, and it is an error if all of the vectors do not have the same length.

    (scheme vector) procedure (vector-any (pred? procedure?) (vec1 vector?) (vec2 vector?) ... ) ⟹ *

    (pred? obj1 obj2 ... ) ⟹ *

    Finds the first set of elements in parallel from vec1 vec2 ... for which pred? returns a true value. If such a parallel set of elements exists, vector-any returns the value that pred? returned for that set of elements. The iteration is strictly left-to-right.

    (scheme vector) procedure (vector-every (pred? procedure?) (vec1 vector?) (vec2 vector?) ... ) ⟹ *

    (pred? obj1 obj2 ... ) ⟹ *

    If, for every index i between 0 and the length of the shortest vector argument, the set of elements (vector-ref vec1 i) (vector-ref vec2 i) ... satisfies pred?, vector-every returns the value that pred? returned for the last set of elements, at the last index of the shortest vector. The iteration is strictly left-to-right.

    (scheme vector) procedure (vector-partition (pred? procedure?) (vec vector?) ) ⟹ (values vector?integer?)

    (pred? obj ) ⟹ boolean?

    A vector the same size as vec is newly allocated and filled with all the elements of vec that satisfy pred? in their original order followed by all the elements that do not satisfy pred?, also in their original order.

    Two values are returned, the newly allocated vector and the index of the leftmost element that does not satisfy pred?.

    (scheme vector) procedure (vector-set! (vector vector?) (k integer?) obj ) ⟹ undefined

    Assigns the contents of the location at i in vec to value.

    (scheme vector) procedure (vector-swap! (vector vector?) (i integer?) (j integer?) ) ⟹ undefined

    Swaps or exchanges the values of the locations in vec at i & j.

    (scheme vector) procedure (vector-fill! (vector vector?) fill ) ⟹ undefined

    (scheme vector) procedure (vector-fill! (vector vector?) fill (start integer?) ) ⟹ undefined

    (scheme vector) procedure (vector-fill! (vector vector?) fill (start integer?) (end integer?) ) ⟹ undefined

    Assigns the value of every location in vec between start, which defaults to 0 and end, which defaults to the length of vec, to fill.

    (scheme vector) procedure (vector-reverse! (vector vector?) ) ⟹ undefined

    (scheme vector) procedure (vector-reverse! (vector vector?) (start integer?) ) ⟹ undefined

    (scheme vector) procedure (vector-reverse! (vector vector?) (start integer?) (end integer?) ) ⟹ undefined

    Destructively reverses the contents of the sequence of locations in vec between start and end. Start defaults to 0 and end defaults to the length of vec. Note that this does not deeply reverse.

    (scheme vector) procedure (vector-copy! (to vector?) (at integer?) (from vector?) ) ⟹ undefined

    (scheme vector) procedure (vector-copy! (to vector?) (at integer?) (from vector?) (start integer?) ) ⟹ undefined

    (scheme vector) procedure (vector-copy! (to vector?) (at integer?) (from vector?) (start integer?) (end integer?) ) ⟹ undefined

    Copies the elements of vector from between start and end to vector to, starting at at. The order in which elements are copied is unspecified, except that if the source and destination overlap, copying takes place as if the source is first copied into a temporary vector and then into the destination. This can be achieved without allocating storage by making sure to copy in the correct direction in such circumstances.

    (scheme vector) procedure (vector-reverse-copy! (to vector?) (at integer?) (from vector?) ) ⟹ undefined

    (scheme vector) procedure (vector-reverse-copy! (to vector?) (at integer?) (from vector?) (start integer?) ) ⟹ undefined

    (scheme vector) procedure (vector-reverse-copy! (to vector?) (at integer?) (from vector?) (start integer?) (end integer?) ) ⟹ undefined

    Like vector-copy!, but the elements appear in to in reverse order.

    (scheme vector) procedure (vector-unfold! (f procedure?) (vec vector?) (start integer?) (end integer?) initial-seed ... ) ⟹ undefined

    (f (index integer?) seed ... ) ⟹ (values **...)

    Like vector-unfold, but the elements are copied into the vector vec starting at element start rather than into a newly allocated vector. Terminates when end-start elements have been generated.

    (scheme vector) procedure (vector-unfold-right! (f procedure?) (vec vector?) (start integer?) (end integer?) initial-seed ... ) ⟹ undefined

    (f (index integer?) seed ... ) ⟹ (values **...)

    Like vector-unfold!, but the elements are copied in reverse order into the vector vec starting at the index preceding end.

    (scheme vector) procedure (vector->list (vector vector?) ) ⟹ list?

    (scheme vector) procedure (vector->list (vector vector?) (start integer?) ) ⟹ list?

    (scheme vector) procedure (vector->list (vector vector?) (start integer?) (end integer?) ) ⟹ list?

    Creates a list containing the elements in vec between start, which defaults to 0, and end, which defaults to the length of vec.

    (scheme vector) procedure (reverse-vector->list (vector vector?) ) ⟹ list?

    (scheme vector) procedure (reverse-vector->list (vector vector?) (start integer?) ) ⟹ list?

    (scheme vector) procedure (reverse-vector->list (vector vector?) (start integer?) (end integer?) ) ⟹ list?

    Like vector->list, but the resulting list contains the elements in reverse of vec.

    (scheme vector) procedure (list->vector (list list?) ) ⟹ vector?

    Creates a vector of elements from proper-list.

    (scheme vector) procedure (reverse-list->vector (list list?) ) ⟹ vector?

    Like list->vector, but the resulting vector contains the elements in reverse of proper-list.

    (scheme vector) procedure (string->vector (string string?) ) ⟹ vector?

    (scheme vector) procedure (string->vector (string string?) (start integer?) ) ⟹ vector?

    (scheme vector) procedure (string->vector (string string?) (start integer?) (end integer?) ) ⟹ vector?

    Creates a vector containing the elements in string between start, which defaults to 0, and end, which defaults to the length of string.

    (scheme vector) procedure (vector->string (vector vector?) ) ⟹ string?

    (scheme vector) procedure (vector->string (vector vector?) (start integer?) ) ⟹ string?

    (scheme vector) procedure (vector->string (vector vector?) (start integer?) (end integer?) ) ⟹ string?

    Creates a string containing the elements in vec between start, which defaults to 0, and end, which defaults to the length of vec. It is an error if the elements are not characters.

    library (scheme bitwise)

    (scheme bitwise) procedure (bitwise-not (i integer?) ) ⟹ integer?

    Returns the bitwise complement of i; that is, all 1 bits are changed to 0 bits and all 0 bits to 1 bits.

    (scheme bitwise) procedure (bitwise-and (i integer?) ... ) ⟹ integer?

    (scheme bitwise) procedure (bitwise-ior (i integer?) ... ) ⟹ integer?

    (scheme bitwise) procedure (bitwise-xor (i integer?) ... ) ⟹ integer?

    (scheme bitwise) procedure (bitwise-eqv (i integer?) ... ) ⟹ integer?

    For each function, the corresponding bitwise operator maps that function across a pair of bitstrings in a bit-wise fashion. These operations are associative. When passed no arguments, the procedures return the identity values -1, 0, 0, and -1 respectively.

    (scheme bitwise) procedure (bitwise-nand (i integer?) (j integer?) ) ⟹ integer?

    (scheme bitwise) procedure (bitwise-nor (i integer?) (j integer?) ) ⟹ integer?

    (scheme bitwise) procedure (bitwise-andc1 (i integer?) (j integer?) ) ⟹ integer?

    (scheme bitwise) procedure (bitwise-andc2 (i integer?) (j integer?) ) ⟹ integer?

    (scheme bitwise) procedure (bitwise-orc1 (i integer?) (j integer?) ) ⟹ integer?

    (scheme bitwise) procedure (bitwise-orc2 (i integer?) (j integer?) ) ⟹ integer?

    For each function, the corresponding bitwise operator maps that function across a pair of bitstrings in a bit-wise fashion. These operations are not associative.

    (scheme bitwise) procedure (arithmetic-shift (i integer?) (count integer?) ) ⟹ integer?

    Returns the arithmetic left shift when count>0; right shift when count<0.

    (scheme bitwise) procedure (bit-count (i integer?) ) ⟹ integer?

    Returns the population count of 1's (i >= 0) or 0's (i < 0). The result is always non-negative.

    (scheme bitwise) procedure (integer-length (i integer?) ) ⟹ integer?

    The number of bits needed to represent i

    (scheme bitwise) procedure (bitwise-if (mask integer?) (i integer?) (j integer?) ) ⟹ integer?

    Merge the bitstrings i and j, with bitstring mask determining from which string to take each bit. That is, if the kth bit of mask is 1, then the kth bit of the result is the kth bit of i, otherwise the kth bit of j.

    (scheme bitwise) procedure (bit-set? (index integer?) (i integer?) ) ⟹ boolean?

    Is bit index set in bitstring i (where index is a non-negative exact integer)?

    (scheme bitwise) procedure (copy-bit (index integer?) (i integer?) (boolean boolean?) ) ⟹ integer?

    Returns an integer the same as i except in the indexth bit, which is 1 if boolean is #t and 0 if boolean is #f.

    (scheme bitwise) procedure (bit-swap (index1 integer?) (index2 integer?) (i integer?) ) ⟹ integer?

    Returns an integer the same as i except that the index1th bit and the index2th bit have been exchanged.

    (scheme bitwise) procedure (any-bit-set? (test-bits integer?) (i integer?) ) ⟹ boolean?

    (scheme bitwise) procedure (every-bit-set? (test-bits integer?) (i integer?) ) ⟹ boolean?

    Determines if any/all of the bits set in bitstring test-bits are set in bitstring i. I.e., returns (not (zero? (bitwise-and test-bits i))) and (= test-bits (bitwise-and test-bits i))) respectively.

    (scheme bitwise) procedure (first-set-bit (i integer?) ) ⟹ integer?

    Return the index of the first (smallest index) 1 bit in bitstring i. Return -1 if i contains no 1 bits (i.e., if i is zero).

    (scheme bitwise) procedure (bit-field (i integer?) (start integer?) (end integer?) ) ⟹ integer?

    Returns the field from i, shifted down to the least-significant position in the result.

    (scheme bitwise) procedure (bit-field-any? (i integer?) (start integer?) (end integer?) ) ⟹ boolean?

    Returns true if any of the field's bits are set in bitstring i, and false otherwise.

    (scheme bitwise) procedure (bit-field-every? (i integer?) (start integer?) (end integer?) ) ⟹ boolean?

    Returns false if any of the field's bits are not set in bitstring i, and true otherwise.

    (scheme bitwise) procedure (bit-field-clear (i integer?) (start integer?) (end integer?) ) ⟹ integer?

    (scheme bitwise) procedure (bit-field-set (i integer?) (start integer?) (end integer?) ) ⟹ integer?

    Returns i with the field's bits set to all 0s/1s.

    (scheme bitwise) procedure (bit-field-replace (dest integer?) (source integer?) (start integer?) (end integer?) ) ⟹ integer?

    Returns dest with the field replaced by the least-significant end-start bits in source.

    (scheme bitwise) procedure (bit-field-replace-same (dest integer?) (source integer?) (start integer?) (end integer?) ) ⟹ integer?

    Returns dest with its field replaced by the corresponding field in source.

    (scheme bitwise) procedure (bit-field-rotate (i integer?) (count integer?) (start integer?) (end integer?) ) ⟹ integer?

    Returns i with the field cyclically permuted by count bits towards high-order.

    (scheme bitwise) procedure (bit-field-reverse (i integer?) (start integer?) (end integer?) ) ⟹ integer?

    Returns i with the order of the bits in the field reversed.

    (scheme bitwise) procedure (bits->list (i integer?) ) ⟹ list?

    (scheme bitwise) procedure (bits->list (i integer?) (len integer?) ) ⟹ list?

    return ⟹ (list (b boolean?))

    (scheme bitwise) procedure (bits->vector (i integer?) ) ⟹ vector?

    (scheme bitwise) procedure (bits->vector (i integer?) (len integer?) ) ⟹ vector?

    return ⟹ (vector (b boolean?))

    Returns a list/vector of len booleans corresponding to each bit of the non-negative integer i, returning bit #0 as the first element, bit #1 as the second, and so on. #t is returned for each 1; #f for 0.

    (scheme bitwise) procedure (list->bits (list list?) ) ⟹ integer?

    list ⟹ (list (b boolean?))

    (scheme bitwise) procedure (vector->bits (vector vector?) ) ⟹ integer?

    vector ⟹ (vector (b boolean?))

    Returns an integer formed from the booleans in list/vector, using the first element as bit #0, the second element as bit #1, and so on. It is an error if list/vector contains non-booleans. A 1 bit is coded for each #t; a 0 bit for #f. Note that the result is never a negative integer.

    (scheme bitwise) procedure (bits (bool boolean?) ... ) ⟹ integer?

    Returns the integer coded by the bool arguments. The first argument is bit #0, the second argument is bit #1, and so on. Note that the result is never a negative integer.

    (scheme bitwise) procedure (bitwise-fold (proc procedure?) seed (i integer?) ) ⟹ *

    (proc (bit boolean?) state ) ⟹ *

    For each bit b of i from bit #0 (inclusive) to bit (integer-length i) (exclusive), proc is called as (proc b r), where r is the current accumulated result. The initial value of r is seed, and the value returned by proc becomes the next accumulated result. When the last bit has been processed, the final accumulated result becomes the result of bitwise-fold.

    (scheme bitwise) procedure (bitwise-for-each (proc procedure?) (i integer?) ) ⟹ undefined

    (proc (bit boolean?) ) ⟹ undefined

    Repeatedly applies proc to the bits of i starting with bit #0 (inclusive) and ending with bit (integer-length i) (exclusive). The values returned by proc are discarded. Returns an unspecified value.

    (scheme bitwise) procedure (bitwise-unfold (stop? procedure?) (mapper procedure?) (successor procedure?) seed ) ⟹ integer?

    (stop? seed ) ⟹ boolean?

    (mapper seed ) ⟹ boolean?

    (successor seed ) ⟹ *

    Generates a non-negative integer bit by bit, starting with bit 0. If the result of applying stop? to the current state (whose initial value is seed) is true, return the currently accumulated bits as an integer. Otherwise, apply mapper to the current state to obtain the next bit of the result by interpreting a true value as a 1 bit and a false value as a 0 bit. Then get a new state by applying successor to the current state, and repeat this algorithm.

    (scheme bitwise) procedure (make-bitwise-generator (i integer?) ) ⟹ procedure?

    (return ) ⟹ boolean?

    Returns a SRFI 121 generator that generates all the bits of i starting with bit #0. Note that the generator is infinite.

    library (scheme bytevector)

    (scheme bytevector) syntax (endianness () ((_ endianness-symbol)) )

    The name of <endianness symbol> must be a symbol describing an endianness. An implementation must support at least the symbols big and little, but may support other endianness symbols. (endianness <endianness symbol>) evaluates to the symbol named <endianness symbol>. Whenever one of the procedures operating on bytevectors accepts an endianness as an argument, that argument must be one of these symbols. It is a syntax violation for <endianness symbol> to be anything other than an endianness symbol supported by the implementation.

    Note: Implementors should use widely accepted designations for endianness symbols other than big and little.

    Note: Only the name of <endianness symbol> is significant.

    (scheme bytevector) procedure (native-endianness ) ⟹ symbol?

    Returns the endianness symbol associated implementation's preferred endianness (usually that of the underlying machine architecture). This may be any <endianness symbol>, including a symbol other than big and little.

    (scheme bytevector) procedure (bytevector? obj ) ⟹ boolean?

    Returns #t if obj is a bytevector, otherwise returns #f.

    (scheme bytevector) procedure (make-bytevector (k integer?) ) ⟹ bytevector?

    (scheme bytevector) procedure (make-bytevector (k integer?) (byte integer?) ) ⟹ bytevector?

    Returns a newly allocated bytevector of k bytes. If the fill argument is missing, the initial contents of the returned bytevector are unspecified. If the fill argument is present, it must be an exact integer object in the interval {−128, ... 255} that specifies the initial value for the bytes of the bytevector: If fill is positive, it is interpreted as an octet; if it is negative, it is interpreted as a byte.

    (scheme bytevector) procedure (bytevector-length (bytevector bytevector?) ) ⟹ integer?

    Returns, as an exact integer object, the number of bytes in bytevector.

    (scheme bytevector) procedure (bytevector=? (bytevector1 bytevector?) (bytevector2 bytevector?) ) ⟹ boolean?

    Returns #t if bytevector1 and bytevector2 are equal - that is, if they have the same length and equal bytes at all valid indices. It returns #f otherwise.

    (scheme bytevector) procedure (bytevector-fill! (bytevector bytevector?) (k integer?) ) ⟹ undefined

    The fill argument is as in the description of the make-bytevector procedure. The bytevector-fill! procedure stores fill in every element of bytevector and returns unspecified values. Analogous to vector-fill!.

    (scheme bytevector) procedure (bytevector-copy! (source bytevector?) (source-start integer?) (target bytevector?) (target-start integer?) (k integer?) ) ⟹ undefined

    Source and target must be bytevectors. Source-start, target-start, and k must be non-negative exact integer objects that satisfy

    0 <= source-start <= source-start + k <= lsource

    0 <= target-start <= target-start + k <= ltarget

    where lsource is the length of source and ltarget is the length of target. The bytevector-copy! procedure copies the bytes from source at indices source-start, ..., source-start + k - 1 to consecutive indices in target starting at target-index. This must work even if the memory regions for the source and the target overlap, i.e., the bytes at the target location after the copy must be equal to the bytes at the source location before the copy. This returns unspecified values.

    (scheme bytevector) procedure (bytevector-copy (bytevector bytevector?) ) ⟹ bytevector?

    Returns a newly allocated copy of bytevector.

    (scheme bytevector) procedure (bytevector-u8-ref (bytevector bytevector?) (k integer?) ) ⟹ integer?

    K must be a valid index of bytevector. The bytevector-u8-ref procedure returns the byte at index k of bytevector, as an octet.

    (scheme bytevector) procedure (bytevector-s8-ref (bytevector bytevector?) (k integer?) ) ⟹ integer?

    K must be a valid index of bytevector. The bytevector-s8-ref procedure returns the byte at index k of bytevector, as a (signed) byte.

    (scheme bytevector) procedure (bytevector-u8-set! (bytevector bytevector?) (k integer?) (octet integer?) ) ⟹ undefined

    K must be a valid index of bytevector. The bytevector-u8-set! procedure stores octet in element k of bytevector.

    (scheme bytevector) procedure (bytevector-s8-set! (bytevector bytevector?) (k integer?) (byte integer?) ) ⟹ undefined

    K must be a valid index of bytevector. The bytevector-s8-set! procedure stores the two's-complement representation of byte in element k of bytevector.

    (scheme bytevector) procedure (bytevector->u8-list (bytevector bytevector?) ) ⟹ list?

    The bytevector->u8-list procedure returns a newly allocated list of the octets of bytevector in the same order.

    (scheme bytevector) procedure (u8-list->bytevector (list list?) ) ⟹ bytevector?

    list ⟹ (list (octet integer?))

    List must be a list of octets. The u8-list->bytevector procedure returns a newly allocated bytevector whose elements are the elements of list list, in the same order. It is analogous to list->vector.

    (scheme bytevector) procedure (bytevector-uint-ref (bytevector bytevector?) (k integer?) (endianness symbol?) (size integer?) ) ⟹ integer?

    The bytevector-uint-ref procedure retrieves the exact integer object corresponding to the unsigned representation of size size and specified by endianness at indices k, ..., k + size − 1.

    (scheme bytevector) procedure (bytevector-sint-ref (bytevector bytevector?) (k integer?) (endianness symbol?) (size integer?) ) ⟹ integer?

    The bytevector-sint-ref procedure retrieves the exact integer object corresponding to the two's-complement representation of size size and specified by endianness at indices k, ..., k + size − 1.

    (scheme bytevector) procedure (bytevector-uint-set! (bytevector bytevector?) (k integer?) (n integer?) (endianness symbol?) (size integer?) ) ⟹ undefined

    The bytevector-uint-set! procedure stores the unsigned representation of size size and specified by endianness into bytevector at indices k, ..., k + size − 1.

    (scheme bytevector) procedure (bytevector-sint-set! (bytevector bytevector?) (k integer?) (n integer?) (endianness symbol?) (size integer?) ) ⟹ undefined

    bytevector-sint-set! stores the two's-complement representation of size size and specified by endianness into bytevector at indices k, ..., k + size − 1.

    (scheme bytevector) procedure (bytevector->uint-list (bytevector bytevector?) (endianness symbol?) (size integer?) ) ⟹ list?

    (scheme bytevector) procedure (bytevector->sint-list (bytevector bytevector?) (endianness symbol?) (size integer?) ) ⟹ list?

    (scheme bytevector) procedure (uint-list->bytevector (list list?) (endianness symbol?) (size integer?) ) ⟹ bytevector?

    (scheme bytevector) procedure (sint-list->bytevector (list list?) (endianness symbol?) (size integer?) ) ⟹ bytevector?

    Size must be a positive exact integer object. For uint-list->bytevector, list must be a list of exact integer objects in the interval {0, ..., 256^mathitsize−1}. For sint-list->bytevector, list must be a list of exact integer objects in the interval {−256^mathitsize/2, ..., 256^mathitsize/2−1}. The length of bytevector or, respectively, of list must be divisible by size.

    These procedures convert between lists of integer objects and their consecutive representations according to size and endianness in the bytevector objects in the same way as bytevector->u8-list and u8-list->bytevector do for one-byte representations.

    (scheme bytevector) procedure (bytevector-u16-ref (bytevector bytevector?) (k integer?) (endianness symbol?) (size integer?) ) ⟹ integer?

    (scheme bytevector) procedure (bytevector-s16-ref (bytevector bytevector?) (k integer?) (endianness symbol?) (size integer?) ) ⟹ integer?

    (scheme bytevector) procedure (bytevector-u16-native-ref (bytevector bytevector?) (k integer?) (size integer?) ) ⟹ integer?

    (scheme bytevector) procedure (bytevector-s16-native-ref (bytevector bytevector?) (k integer?) (size integer?) ) ⟹ integer?

    (scheme bytevector) procedure (bytevector-u16-set! (bytevector bytevector?) (k integer?) (n integer?) (endianness symbol?) (size integer?) ) ⟹ undefined

    (scheme bytevector) procedure (bytevector-s16-set! (bytevector bytevector?) (k integer?) (n integer?) (endianness symbol?) (size integer?) ) ⟹ undefined

    (scheme bytevector) procedure (bytevector-u16-native-set! (bytevector bytevector?) (k integer?) (n integer?) (size integer?) ) ⟹ undefined

    (scheme bytevector) procedure (bytevector-s16-native-set! (bytevector bytevector?) (k integer?) (n integer?) (size integer?) ) ⟹ undefined

    K must be a valid index of bytevector; so must k + 1. For bytevector-u16-set! and bytevector-u16-native-set!, n must be an exact integer object in the interval {0, ..., 2^16−1}. For bytevector-s16-set! and bytevector-s16-native-set!, n must be an exact integer object in the interval {−2^15, ..., 2^15−1}.

    These retrieve and set two-byte representations of numbers at indices k and k + 1, according to the endianness specified by endianness. The procedures with u16 in their names deal with the unsigned representation; those with s16 in their names deal with the two's-complement representation.

    The procedures with native in their names employ the native endianness, and work only at aligned indices: k must be a multiple of 2.

    The ...-set! procedures return unspecified values.

    (scheme bytevector) procedure (bytevector-u32-ref (bytevector bytevector?) (k integer?) (endianness symbol?) (size integer?) ) ⟹ integer?

    (scheme bytevector) procedure (bytevector-s32-ref (bytevector bytevector?) (k integer?) (endianness symbol?) (size integer?) ) ⟹ integer?

    (scheme bytevector) procedure (bytevector-u32-native-ref (bytevector bytevector?) (k integer?) (size integer?) ) ⟹ integer?

    (scheme bytevector) procedure (bytevector-s32-native-ref (bytevector bytevector?) (k integer?) (size integer?) ) ⟹ integer?

    (scheme bytevector) procedure (bytevector-u32-set! (bytevector bytevector?) (k integer?) (n integer?) (endianness symbol?) (size integer?) ) ⟹ undefined

    (scheme bytevector) procedure (bytevector-s32-set! (bytevector bytevector?) (k integer?) (n integer?) (endianness symbol?) (size integer?) ) ⟹ undefined

    (scheme bytevector) procedure (bytevector-u32-native-set! (bytevector bytevector?) (k integer?) (n integer?) (size integer?) ) ⟹ undefined

    (scheme bytevector) procedure (bytevector-s32-native-set! (bytevector bytevector?) (k integer?) (n integer?) (size integer?) ) ⟹ undefined

    K, ..., k + 3 must be valid indices of bytevector. For bytevector-u32-set! and bytevector-u32-native-set!, n must be an exact integer object in the interval {0, ..., 2^32−1}. For bytevector-s32-set! and bytevector-s32-native-set!, n must be an exact integer object in the interval {−2^31, ..., 2^32−1}.

    These retrieve and set four-byte representations of numbers at indices k, ..., k + 3, according to the endianness specified by endianness. The procedures with u32 in their names deal with the unsigned representation; those with s32 with the two's-complement representation.

    The procedures with native in their names employ the native endianness, and work only at aligned indices: k must be a multiple of 4.

    The ...-set! procedures return unspecified values.

    (scheme bytevector) procedure (bytevector-u64-ref (bytevector bytevector?) (k integer?) (endianness symbol?) (size integer?) ) ⟹ integer?

    (scheme bytevector) procedure (bytevector-s64-ref (bytevector bytevector?) (k integer?) (endianness symbol?) (size integer?) ) ⟹ integer?

    (scheme bytevector) procedure (bytevector-u64-native-ref (bytevector bytevector?) (k integer?) (size integer?) ) ⟹ integer?

    (scheme bytevector) procedure (bytevector-s64-native-ref (bytevector bytevector?) (k integer?) (size integer?) ) ⟹ integer?

    (scheme bytevector) procedure (bytevector-u64-set! (bytevector bytevector?) (k integer?) (n integer?) (endianness symbol?) (size integer?) ) ⟹ undefined

    (scheme bytevector) procedure (bytevector-s64-set! (bytevector bytevector?) (k integer?) (n integer?) (endianness symbol?) (size integer?) ) ⟹ undefined

    (scheme bytevector) procedure (bytevector-u64-native-set! (bytevector bytevector?) (k integer?) (n integer?) (size integer?) ) ⟹ undefined

    (scheme bytevector) procedure (bytevector-s64-native-set! (bytevector bytevector?) (k integer?) (n integer?) (size integer?) ) ⟹ undefined

    K, ..., k + 7 must be valid indices of bytevector. For bytevector-u64-set! and bytevector-u64-native-set!, n must be an exact integer object in the interval {0, ..., 2^64−1}. For bytevector-s64-set! and bytevector-s64-native-set!, n must be an exact integer object in the interval {−2^63, ..., 2^64−1}.

    These retrieve and set eight-byte representations of numbers at indices k, ..., k + 7, according to the endianness specified by endianness. The procedures with u64 in their names deal with the unsigned representation; those with s64 with the two's-complement representation.

    The procedures with native in their names employ the native endianness, and work only at aligned indices: k must be a multiple of 8.

    The ...-set! procedures return unspecified values.

    (scheme bytevector) procedure (bytevector-ieee-single-ref (bytevector bytevector?) (k integer?) (endianness symbol?) (size integer?) ) ⟹ real?

    K, ..., k + 3 must be valid indices of bytevector. The procedure returns the inexact real number object that best represents the IEEE-754 single-precision number represented by the four bytes beginning at index k.

    (scheme bytevector) procedure (bytevector-ieee-double-ref (bytevector bytevector?) (k integer?) (endianness symbol?) (size integer?) ) ⟹ real?

    K, ..., k + 7 must be valid indices of bytevector. The procedure returns the inexact real number object that best represents the IEEE-754 double-precision number represented by the eight bytes beginning at index k.

    (scheme bytevector) procedure (bytevector-ieee-single-native-ref (bytevector bytevector?) (k integer?) (size integer?) ) ⟹ real?

    K, ..., k + 3 must be valid indices of bytevector. K must be a multiple of 4. The procedure returns the inexact real number object that best represents the IEEE-754 single-precision number represented by the four bytes beginning at index k.

    (scheme bytevector) procedure (bytevector-ieee-double-native-ref (bytevector bytevector?) (k integer?) (size integer?) ) ⟹ real?

    K, ..., k + 7 must be valid indices of bytevector. K must be a multiple of 8. The procedure returns the inexact real number object that best represents the IEEE-754 double-precision number represented by the eight bytes beginning at index k.

    (scheme bytevector) procedure (bytevector-ieee-single-set! (bytevector bytevector?) (k integer?) (x real?) (endianness symbol?) (size integer?) ) ⟹ undefined

    K, ..., k + 3 must be valid indices of bytevector. The procedure stores an IEEE-754 single-precision representation of x into elements k through k + 3 of bytevector, and returns unspecified values.

    (scheme bytevector) procedure (bytevector-ieee-double-set! (bytevector bytevector?) (k integer?) (x real?) (endianness symbol?) (size integer?) ) ⟹ undefined

    K, ..., k + 7 must be valid indices of bytevector. The procedure stores an IEEE-754 double-precision representation of x into elements k through k + 7 of bytevector, and returns unspecified values.

    (scheme bytevector) procedure (bytevector-ieee-single-native-set! (bytevector bytevector?) (k integer?) (x real?) (size integer?) ) ⟹ undefined

    K, ..., k + 3 must be valid indices of bytevector. K must be a multiple of 4. The procedure stores an IEEE-754 single-precision representation of x into elements k through k + 3 of bytevector, and returns unspecified values.

    (scheme bytevector) procedure (bytevector-ieee-double-native-set! (bytevector bytevector?) (k integer?) (x real?) (size integer?) ) ⟹ undefined

    K, ..., k + 7 must be valid indices of bytevector. K must be a multiple of 8. The procedure stores an IEEE-754 double-precision representation of x into elements k through k + 7 of bytevector, and returns unspecified values.

    (scheme bytevector) procedure (string->utf8 (string string?) ) ⟹ bytevector?

    Returns a newly allocated (unless empty) bytevector that contains the UTF-8 encoding of the given string.

    (scheme bytevector) procedure (string->utf16 (string string?) ) ⟹ bytevector?

    (scheme bytevector) procedure (string->utf16 (string string?) (endianness symbol?) ) ⟹ bytevector?

    If endianness is specified, it must be the symbol big or the symbol little. The string->utf16 procedure returns a newly allocated (unless empty) bytevector that contains the UTF-16BE or UTF-16LE encoding of the given string (with no byte-order mark). If endianness is not specified or is big, then UTF-16BE is used. If endianness is little, then UTF-16LE is used.

    (scheme bytevector) procedure (string->utf32 (string string?) ) ⟹ bytevector?

    (scheme bytevector) procedure (string->utf32 (string string?) (endianness symbol?) ) ⟹ bytevector?

    If endianness is specified, it must be the symbol big or the symbol little. The string->utf32 procedure returns a newly allocated (unless empty) bytevector that contains the UTF-32BE or UTF-32LE encoding of the given string (with no byte mark). If endianness is not specified or is big, then UTF-32BE is used. If endianness is little, then UTF-32LE is used.

    (scheme bytevector) procedure (utf8->string (bytevector bytevector?) ) ⟹ string?

    Returns a newly allocated (unless empty) string whose character sequence is encoded by the given bytevector.

    (scheme bytevector) procedure (utf16->string (bytevector bytevector?) (endianness symbol?) ) ⟹ string?

    (scheme bytevector) procedure (utf16->string (bytevector bytevector?) (endianness symbol?) (endianness-mandatory? boolean?) ) ⟹ string?

    Endianness must be the symbol big or the symbol little. The utf16->string procedure returns a newly allocated (unless empty) string whose character sequence is encoded by the given bytevector. Bytevector is decoded according to UTF-16BE or UTF-16LE: If endianness-mandatory? is absent or #f, utf16->string determines the endianness according to a UTF-16 BOM at the beginning of bytevector if a BOM is present; in this case, the BOM is not decoded as a character. Also in this case, if no UTF-16 BOM is present, endianness specifies the endianness of the encoding. If endianness-mandatory? is a true value, endianness specifies the endianness of the encoding, and any UTF-16 BOM in the encoding is decoded as a regular character.

    Note: A UTF-16 BOM is either a sequence of bytes #xFE, #xFF specifying big and UTF-16BE, or #xFF, #xFE specifying little and UTF-16LE.

    (scheme bytevector) procedure (utf32->string (bytevector bytevector?) (endianness symbol?) ) ⟹ string?

    (scheme bytevector) procedure (utf32->string (bytevector bytevector?) (endianness symbol?) (endianness-mandatory? boolean?) ) ⟹ string?

    Endianness must be the symbol big or the symbol little. The utf32->string procedure returns a newly allocated (unless empty) string whose character sequence is encoded by the given bytevector. Bytevector is decoded according to UTF-32BE or UTF-32LE: If endianness-mandatory? is absent or #f, utf32->string determines the endianness according to a UTF-32 BOM at the beginning of bytevector if a BOM is present; in this case, the BOM is not decoded as a character. Also in this case, if no UTF-32 BOM is present, endianness specifies the endianness of the encoding. If endianness-mandatory? is a true value, endianness specifies the endianness of the encoding, and any UTF-32 BOM in the encoding is decoded as a regular character.

    Note: A UTF-32 BOM is either a sequence of bytes #x00, #x00, #xFE, #xFF specifying big and UTF-32BE, or #xFF, #xFE, #x00, #x00, specifying little and UTF-32LE.

    library (scheme division)

    (scheme division) procedure (floor/ (numerator integer?) (denominator integer?) ) ⟹ (values integer?integer?)

    (scheme division) procedure (floor-quotient (numerator integer?) (denominator integer?) ) ⟹ integer?

    (scheme division) procedure (floor-remainder (numerator integer?) (denominator integer?) ) ⟹ integer?

    q = floor(n/d)

    Thus a nonzero r is negative iff d is negative.

    (scheme division) procedure (ceiling/ (numerator integer?) (denominator integer?) ) ⟹ (values integer?integer?)

    (scheme division) procedure (ceiling-quotient (numerator integer?) (denominator integer?) ) ⟹ integer?

    (scheme division) procedure (ceiling-remainder (numerator integer?) (denominator integer?) ) ⟹ integer?

    q = ceiling(n/d)

    Thus a nonzero r is negative iff d is non-negative.

    If denominator is the number of units in a block, and numerator; is some number of units, then (ceiling-quotient numerator denominator) gives the number of blocks needed to cover numerator units. For example, denominator might be the number of bytes in a disk sector, and numerator the number of bytes in a file; then the quotient is the number of disk sectors needed to store the contents of the file. For another example, denominator might be the number of octets in the output of a cryptographic hash function, and numerator the number of octets desired in a key for a symmetric cipher, to be derived using the cryptographic hash function; then the quotient is the number of hash values needed to concatenate to make a key.

    (scheme division) procedure (truncate/ (numerator integer?) (denominator integer?) ) ⟹ (values integer?integer?)

    (scheme division) procedure (truncate-quotient (numerator integer?) (denominator integer?) ) ⟹ integer?

    (scheme division) procedure (truncate-remainder (numerator integer?) (denominator integer?) ) ⟹ integer?

    q = truncate(n/d)

    Thus a nonzero r is negative iff n is negative. With the truncate operator pair, the quotient of +1, 0, or -1 by any non-unit denominator is 0; that is, three contiguous numerators divided by a common denominator share a common quotient. Of the other division operator pairs, only the round pair exhibits this property.

    (scheme division) procedure (round/ (numerator integer?) (denominator integer?) ) ⟹ (values integer?integer?)

    (scheme division) procedure (round-quotient (numerator integer?) (denominator integer?) ) ⟹ integer?

    (scheme division) procedure (round-remainder (numerator integer?) (denominator integer?) ) ⟹ integer?

    q = round(n/d)

    The round function rounds to the nearest integer, breaking ties by choosing the nearest even integer. Nothing general can be said about the sign of r. Like the truncate operator pair, the quotient of +1, 0, or -1 by any non-unit denominator is 0, so that three contiguous numerators by a common denominator share a common quotient.

    (scheme division) procedure (euclidean/ (numerator integer?) (denominator integer?) ) ⟹ (values integer?integer?)

    (scheme division) procedure (euclidean-quotient (numerator integer?) (denominator integer?) ) ⟹ integer?

    (scheme division) procedure (euclidean-remainder (numerator integer?) (denominator integer?) ) ⟹ integer?

    If d > 0, q = floor(n/d); if d < 0, q = ceiling(n/d).

    This division operator pair satisfies the stronger property

    0 <= r < |d|,

    used often in mathematics. Thus, for example, (euclidean-remainder numerator denominator) is always a valid index into a vector whose length is at least the absolute value of denominator. This division operator pair is so named because it is the subject of the Euclidean division algorithm.

    (scheme division) procedure (balanced/ (numerator integer?) (denominator integer?) ) ⟹ (values integer?integer?)

    (scheme division) procedure (balanced-quotient (numerator integer?) (denominator integer?) ) ⟹ integer?

    (scheme division) procedure (balanced-remainder (numerator integer?) (denominator integer?) ) ⟹ integer?

    This division operator pair satisfies the property

    -|d/2| <= r < |d/2|.

    When d is a power of 2, say 2k for some k, this reduces to

    -2(k - 1) <= r < 2(k - 1).

    Computer scientists will immediately recognize this as the interval of integers representable in two's-complement with k bits.

    library (scheme fixnum)

    fx-widthinteger?

    Bound to the value w that specifies the implementation-defined range. (R6RS fixnum-width is a procedure that always returns this value.)

    fx-greatestfixnum?

    Bound to the value 2^(w-1)-1, the largest representable fixnum. (R6RS greatest-fixnum is a procedure that always returns this value.)

    fx-leastfixnum?

    Bound to the value -2^(w-1), the smallest representable fixnum. (R6RS least-fixnum is a procedure that always returns this value.)

    (scheme fixnum) procedure (fixnum? obj ) ⟹ boolean?

    Returns #t if obj is an exact integer within the fixnum range, and #f otherwise.

    (scheme fixnum) procedure (fx=? (i fixnum?) ... ) ⟹ boolean?

    Semantically equivalent to =.

    (scheme fixnum) procedure (fx<? (i fixnum?) ... ) ⟹ boolean?

    Semantically equivalent to <.

    (scheme fixnum) procedure (fx>? (i fixnum?) ... ) ⟹ boolean?

    Semantically equivalent to >.

    (scheme fixnum) procedure (fx<=? (i fixnum?) ... ) ⟹ boolean?

    Semantically equivalent to <=.

    (scheme fixnum) procedure (fx>=? (i fixnum?) ... ) ⟹ boolean?

    Semantically equivalent to >=.

    (scheme fixnum) procedure (fxzero? (i fixnum?) ) ⟹ boolean?

    Semantically equivalent to zero?.

    (scheme fixnum) procedure (fxpositive? (i fixnum?) ) ⟹ boolean?

    Semantically equivalent to positive?.

    (scheme fixnum) procedure (fxnegative? (i fixnum?) ) ⟹ boolean?

    Semantically equivalent to negative?.

    (scheme fixnum) procedure (fxodd? (i fixnum?) ) ⟹ boolean?

    Semantically equivalent to odd?.

    (scheme fixnum) procedure (fxeven? (i fixnum?) ) ⟹ boolean?

    Semantically equivalent to even?.

    (scheme fixnum) procedure (fxmax (i fixnum?) (j fixnum?) ... ) ⟹ fixnum?

    Semantically equivalent to max.

    (scheme fixnum) procedure (fxmin (i fixnum?) (j fixnum?) ... ) ⟹ fixnum?

    Semantically equivalent to min.

    (scheme fixnum) procedure (fx+ (i fixnum?) (j fixnum?) ) ⟹ fixnum?

    Semantically equivalent to +, but accepts exactly two arguments.

    (scheme fixnum) procedure (fx- (i fixnum?) (j fixnum?) ) ⟹ fixnum?

    Semantically equivalent to -, but accepts exactly two arguments.

    (scheme fixnum) procedure (fxneg (i fixnum?) ) ⟹ fixnum?

    Semantically equivalent to -, but accepts exactly one argument.

    (scheme fixnum) procedure (fx* (i fixnum?) (j fixnum?) ) ⟹ fixnum?

    Semantically equivalent to *, but accepts exactly two arguments.

    (scheme fixnum) procedure (fxquotient (i fixnum?) (j fixnum?) ) ⟹ fixnum?

    Semantically equivalent to quotient.

    (scheme fixnum) procedure (fxremainder (i fixnum?) (j fixnum?) ) ⟹ fixnum?

    Semantically equivalent to remainder.

    (scheme fixnum) procedure (fxabs (i fixnum?) ) ⟹ fixnum?

    Semantically equivalent to abs. In accordance with the fixnum rule, has undefined results when applied to fx-least.

    (scheme fixnum) procedure (fxsquare (i fixnum?) ) ⟹ fixnum?

    Semantically equivalent to square.

    (scheme fixnum) procedure (fxsqrt (i fixnum?) ) ⟹ fixnum?

    Semantically equivalent to exact-integer-sqrt (not sqrt).

    (scheme fixnum) procedure (fx+/carry (i fixnum?) (j fixnum?) (k fixnum?) ) ⟹ (values fixnum?fixnum?)

    Returns the two fixnum results of the following computation:

    (let*-values (((s) (+ i j k))

    ((q r) (balanced/ s (expt 2 fx-width))))

    (values r q))

    (scheme fixnum) procedure (fx-/carry (i fixnum?) (j fixnum?) (k fixnum?) ) ⟹ (values fixnum?fixnum?)

    Returns the two fixnum results of the following computation:

    (let*-values (((d) (- i j k))

    ((q r) (balanced/ d (expt 2 fx-width))))

    (values r q))

    (scheme fixnum) procedure (fx*/carry (i fixnum?) (j fixnum?) (k fixnum?) ) ⟹ (values fixnum?fixnum?)

    Returns the two fixnum results of the following computation:

    (let*-values (((s) (+ (* i j) k))

    ((q r) (balanced/ s (expt 2 fx-width))))

    (values r q))

    (scheme fixnum) procedure (fxnot (i integer?) ) ⟹ integer?

    Semantically equivalent to bitwise-not.

    (scheme fixnum) procedure (fxand (i integer?) ... ) ⟹ integer?

    Semantically equivalent to bitwise-and.

    (scheme fixnum) procedure (fxior (i integer?) ... ) ⟹ integer?

    Semantically equivalent to bitwise-ior.

    (scheme fixnum) procedure (fxxor (i integer?) ... ) ⟹ integer?

    Semantically equivalent to bitwise-xor.

    (scheme fixnum) procedure (fxarithmetic-shift (i fixnum?) (count integer?) ) ⟹ fixnum?

    Semantically equivalent to arithmetic-shift, except that it is an error for the absolute value of count to exceed w-1.

    (scheme fixnum) procedure (fxarithmetic-shift-left (i fixnum?) (count integer?) ) ⟹ fixnum?

    The same as fxarithmetic-shift except that a negative value of count is an error. This is provided for additional efficiency.

    (scheme fixnum) procedure (fxarithmetic-shift-right (i fixnum?) (count integer?) ) ⟹ fixnum?

    The same as fxarithmetic-shift except that a non-negative value of count specifies the number of bits to shift right, and a negative value is an error. This is provided for additional efficiency.

    (scheme fixnum) procedure (fxbit-count (i fixnum?) ) ⟹ integer?

    Semantically equivalent to SRFI 151 bit-count.

    (scheme fixnum) procedure (fxlength (i fixnum?) ) ⟹ integer?

    Semantically equivalent to integer-length.

    (scheme fixnum) procedure (fxif (mask fixnum?) (i fixnum?) (j fixnum?) ) ⟹ fixnum?

    Semantically equivalent to bitwise-if. It can be implemented as (fxior (fxand mask i) (fxand (fxnot mask) j))).

    (scheme fixnum) procedure (fxbit-set? (index integer?) (i fixnum?) ) ⟹ boolean?

    Semantically equivalent to SRFI 151 bit-set?, except that it is an error for index to be larger than or equal to fx-width.

    (scheme fixnum) procedure (fxcopy-bit (index integer?) (i fixnum?) (boolean boolean?) ) ⟹ fixnum?

    Semantically equivalent to SRFI 151 copy-bit, except that it is an error for index to be larger than or equal to fx-width.

    (scheme fixnum) procedure (fxfirst-set-bit (i fixnum?) ) ⟹ integer?

    Semantically equivalent to first-set-bit.

    (scheme fixnum) procedure (fxbit-field (i fixnum?) (start integer?) (end integer?) ) ⟹ fixnum?

    Semantically equivalent to bit-field.

    (scheme fixnum) procedure (fxbit-field-rotate (i fixnum?) (count integer?) (start integer?) (end integer?) ) ⟹ fixnum?

    Semantically equivalent to SRFI 151 bit-field-rotate.

    (scheme fixnum) procedure (bit-field-reverse (i fixnum?) (start integer?) (end integer?) ) ⟹ fixnum?

    Semantically equivalent to bit-field-reverse.

    library (scheme flonum)

    fl-eflonum?

    Bound to the mathematical constant e. (C99 M_E)

    fl-1/eflonum?

    Bound to 1/e. (C99 M_E)

    fl-e-2flonum?

    Bound to e^2.

    fl-e-pi/4flonum?

    Bound to e^(pi/4).

    fl-log2-eflonum?

    Bound to log2 e. (C99 M_LOG2E)

    fl-log10-eflonum?

    Bound to log10 e. (C99 M_LOG10E)

    fl-log-2flonum?

    Bound to loge 2. (C99 M_LN2)

    fl-1/log-2flonum?

    Bound to 1/(loge 2)

    fl-log-3flonum?

    Bound to loge 3.

    fl-log-piflonum?

    Bound to loge pi.

    fl-log-10flonum?

    Bound to loge 10. (C99 M_LN10)

    fl-1/log-10flonum?

    Bound to 1/(loge 10). (C99 M_LN10)

    fl-piflonum?

    Bound to the mathematical constant pi. (C99 M_PI)

    fl-1/piflonum?

    Bound to 1/pi. (C99 M_1_PI)

    fl-2piflonum?

    Bound to 2pi.

    fl-pi/2flonum?

    Bound to pi/2. (C99 M_PI_2)

    fl-pi/4flonum?

    Bound to pi/4. (C99 M_PI_4)

    fl-pi-squaredflonum?

    Bound to pi^2.

    fl-degreeflonum?

    Bound to pi/180, the number of radians in a degree.

    fl-2/piflonum?

    Bound to 2/pi. (C99 M_2_PI)

    fl-2/sqrt-piflonum?

    Bound to 2/(pi^0.5). (C99 M_2_SQRTPI)

    fl-sqrt-2flonum?

    Bound to 2^0.5. (C99 M_SQRT2)

    fl-sqrt-3flonum?

    Bound to 3^0.5.

    fl-sqrt-5flonum?

    Bound to 5^0.5.

    fl-sqrt-10flonum?

    Bound to 10^0.5.

    fl-1/sqrt-2flonum?

    Bound to 1/(2^0.5). (C99 M_SQRT1_2)

    fl-cbrt-2flonum?

    Bound to 2^(1/3).

    fl-cbrt-3flonum?

    Bound to 3^(1/3).

    fl-4thrt-2flonum?

    Bound to 2^(1/4).

    fl-phiflonum?

    Bound to the mathematical constant φ.

    fl-log-phiflonum?

    Bound to log(φ).

    fl-1/log-phiflonum?

    Bound to 1/log(φ).

    fl-eulerflonum?

    Bound to the mathematical constant γ (Euler's constant).

    fl-e-eulerflonum?

    Bound to e^γ.

    fl-sin-1flonum?

    Bound to sin 1.

    fl-cos-1flonum?

    Bound to cos 1.

    fl-gamma-1/2flonum?

    Bound to Γ(1/2).

    fl-gamma-1/3flonum?

    Bound to Γ(1/3).

    fl-gamma-2/3flonum?

    Bound to Γ(2/3).

    fl-greatestflonum?

    Bound to the largest positive finite flonum. (C99 DBL_MAX)

    fl-leastflonum?

    Bound to the smallest positive finite flonum. (C99 DBL_TRUE_MIN)

    fl-epsilonflonum?

    Bound to the appropriate machine epsilon for the hardware representation of flonums. (C99 DBL_EPSILON in <float.h>)

    fl-fast-fl+*boolean?

    Bound to #t if (fl+* x y z) executes about as fast as, or faster than, (fl+ (fl* x y) z); bound to #f otherwise. (C99 FP_FAST_FMA)

    So that the value of this variable can be determined at compile time, R7RS implementations and other implementations that provide a features function should provide the feature fl-fast-fl+* if this variable is true, and not if it is false or the value is unknown at compile time.

    fl-integer-exponent-zerointeger?

    Bound to whatever exact integer is returned by (flinteger-exponent 0.0). (C99 FP_ILOGB0)

    fl-integer-exponent-naninteger?

    Bound to whatever exact integer is returned by (flinteger-exponent +nan.0). (C99 FP_ILOGBNAN)

    (scheme flonum) procedure (flonum (number real?) ) ⟹ flonum?

    If number is an inexact real number and there exists a flonum that is the same (in the sense of =) to number, returns that flonum. If number is a negative zero, an infinity, or a NaN, return its flonum equivalent. If such a flonum does not exist, returns the nearest flonum, where "nearest" is implementation-dependent. If number is not a real number, it is an error. If number is exact, applies inexact or exact->inexact to number first.

    (scheme flonum) procedure (fladjacent (x flonum?) (y flonum?) ) ⟹ flonum?

    Returns a flonum adjacent to x in the direction of y. Specifically: if x < y, returns the smallest flonum larger than x; if x > y, returns the largest flonum smaller than x; if x = y, returns x. (C99 nextafter)

    (scheme flonum) procedure (flcopysign (x flonum?) (y flonum?) ) ⟹ flonum?

    Returns a flonum whose magnitude is the magnitude of x and whose sign is the sign of y. (C99 copysign)

    (scheme flonum) procedure (make-flonum (x flonum?) (n integer?) ) ⟹ flonum?

    Returns x * 2^n, where n is an integer with an implementation-dependent range. (C99 ldexp)

    (scheme flonum) procedure (flinteger-fraction (x flonum?) ) ⟹ (values flonum?flonum?)

    Returns two values, the integral part of x as a flonum and the fractional part of x as a flonum. (C99 modf)

    (scheme flonum) procedure (flexponent (x flonum?) ) ⟹ flonum?

    Returns the exponent of x. (C99 logb)

    (scheme flonum) procedure (flinteger-exponent (x flonum?) ) ⟹ integer?

    Returns the same as flexponent truncated to an exact integer. If x is zero, returns fl-integer-exponent-zero; if x is a NaN, returns fl-integer-exponent-nan; if x is infinite, returns a large implementation-dependent exact integer. (C99 ilogb)

    (scheme flonum) procedure (flnormalized-fraction-exponent (x flonum?) ) ⟹ (values flonum?integer?)

    Returns two values, a correctly signed fraction y whose absolute value is between 0.5 (inclusive) and 1.0 (exclusive), and an exact integer exponent n such that x = y(2^n). (C99 frexp)

    (scheme flonum) procedure (flsign-bit (x flonum?) ) ⟹ integer?

    Returns 0 for positive flonums and 1 for negative flonums and -0.0. The value of (flsign-bit +nan.0) is implementation-dependent, reflecting the sign bit of the underlying representation of NaNs. (C99 signbit)

    (scheme flonum) procedure (flonum? obj ) ⟹ boolean?

    Returns #t if obj is a flonum and #f otherwise.

    (scheme flonum) procedure (fl=? (x flonum?) (y flonum?) (z flonum?) ... ) ⟹ boolean?

    (scheme flonum) procedure (fl<? (x flonum?) (y flonum?) (z flonum?) ... ) ⟹ boolean?

    (scheme flonum) procedure (fl>? (x flonum?) (y flonum?) (z flonum?) ... ) ⟹ boolean?

    (scheme flonum) procedure (fl<=? (x flonum?) (y flonum?) (z flonum?) ... ) ⟹ boolean?

    (scheme flonum) procedure (fl>=? (x flonum?) (y flonum?) (z flonum?) ... ) ⟹ boolean?

    These procedures return #t if their arguments are (respectively): equal, monotonically increasing, monotonically decreasing, monotonically nondecreasing, or monotonically nonincreasing; they return #f otherwise. These predicates must be transitive. (C99 =, <, > <=, >= operators respectively)

    (scheme flonum) procedure (flunordered? (x flonum?) (y flonum?) ) ⟹ boolean?

    Returns #t if x and y are unordered according to IEEE rules. This means that one of them is a NaN.

    (scheme flonum) procedure (flinteger? (x flonum?) ) ⟹ boolean?

    Tests whether x is an integral flonum.

    (scheme flonum) procedure (flzero? (x flonum?) ) ⟹ boolean?

    Tests whether x is zero. Beware of roundoff errors.

    (scheme flonum) procedure (flpositive? (x flonum?) ) ⟹ boolean?

    Tests whether x is positive.

    (scheme flonum) procedure (flnegative? (x flonum?) ) ⟹ boolean?

    Tests whether x is negative. Note that (flnegative? -0.0) must return #f; otherwise it would lose the correspondence with (fl<? -0.0 0.0), which is #f according to IEEE 754.

    (scheme flonum) procedure (flodd? (x flonum?) ) ⟹ boolean?

    Tests whether the flonum x is odd. It is an error if x is not an integer.

    (scheme flonum) procedure (fleven? (x flonum?) ) ⟹ boolean?

    Tests whether the flonum x is even. It is an error if x is not an integer.

    (scheme flonum) procedure (flfinite? (x flonum?) ) ⟹ boolean?

    Tests whether the flonum x is finite. (C99 isfinite)

    (scheme flonum) procedure (flinfinite? (x flonum?) ) ⟹ boolean?

    Tests whether the flonum x is infinite. (C99 isinf)

    (scheme flonum) procedure (flnan? (x flonum?) ) ⟹ boolean?

    Tests whether the flonum x is NaN. (C99 isnan)

    (scheme flonum) procedure (flnormalized? (x flonum?) ) ⟹ boolean?

    Tests whether the flonum x is normalized. (C11 isnormal; in C99, use fpclassify(x) == FP_NORMAL)

    (scheme flonum) procedure (fldenormalized? (x flonum?) ) ⟹ boolean?

    Tests whether the flonum x is denormalized. (C11 issubnormal; in C99, use fpclassify(x) == FP_SUBNORMAL)

    (scheme flonum) procedure (flmax (x flonum?) ... ) ⟹ flonum?

    (scheme flonum) procedure (flmin (x flonum?) ... ) ⟹ flonum?

    Return the maximum/minimum argument. If there are no arguments, these procedures return -inf.0 or +inf.0 if the implementation provides these numbers, and (fl- fl-greatest) or fl-greatest otherwise. (C99 fmax fmin)

    (scheme flonum) procedure (fl+ (x flonum?) ... ) ⟹ flonum?

    (scheme flonum) procedure (fl* (x flonum?) ... ) ⟹ flonum?

    Return the flonum sum or product of their flonum arguments. (C99 + * operators respectively)

    (scheme flonum) procedure (fl+* (x flonum?) (y flonum?) (z flonum?) ) ⟹ flonum?

    Returns xy + z as if to infinite precision and rounded only once. The boolean constant fl-fast-fl+* indicates whether this procedure executes about as fast as, or faster than, a multiply and an add of flonums. (C99 fma)

    (scheme flonum) procedure (fl- (x flonum?) (y flonum?) ... ) ⟹ flonum?

    (scheme flonum) procedure (fl/ (x flonum?) (y flonum?) ... ) ⟹ flonum?

    With two or more arguments, these procedures return the difference or quotient of their arguments, associating to the left. With one argument, however, they return the additive or multiplicative inverse of their argument. (C99 - / operators respectively)

    (scheme flonum) procedure (flabs (x flonum?) ) ⟹ flonum?

    Returns the absolute value of x. (C99 fabs)

    (scheme flonum) procedure (flabsdiff (x flonum?) (y flonum?) ) ⟹ flonum?

    Returns |x - y|.

    (scheme flonum) procedure (flposdiff (x flonum?) (y flonum?) ) ⟹ flonum?

    Returns the difference of x and y if it is non-negative, or zero if the difference is negative. (C99 fdim)

    (scheme flonum) procedure (flsgn (x flonum?) ) ⟹ flonum?

    Returns (flcopysign 1.0 x).

    (scheme flonum) procedure (flnumerator (x flonum?) ) ⟹ flonum?

    (scheme flonum) procedure (fldenominator (x flonum?) ) ⟹ flonum?

    Returns the numerator/denominator of x as a flonum; the result is computed as if x was represented as a fraction in lowest terms. The denominator is always positive. The numerator of an infinite flonum is itself. The denominator of an infinite or zero flonum is 1.0. The numerator and denominator of a NaN is a NaN.

    (scheme flonum) procedure (flfloor (x flonum?) ) ⟹ flonum?

    Returns the largest integral flonum not larger than x. (C99 floor)

    (scheme flonum) procedure (flceiling (x flonum?) ) ⟹ flonum?

    Returns the smallest integral flonum not smaller than x. (C99 ceil)

    (scheme flonum) procedure (flround (x flonum?) ) ⟹ flonum?

    Returns the closest integral flonum to x, rounding to even when x represents a number halfway between two integers. (Not the same as C99 round, which rounds away from zero)

    (scheme flonum) procedure (fltruncate (x flonum?) ) ⟹ flonum?

    Returns the closest integral flonum to x whose absolute value is not larger than the absolute value of x (C99 trunc)

    (scheme flonum) procedure (flexp (x flonum?) ) ⟹ flonum?

    Returns e^x. (C99 exp)

    (scheme flonum) procedure (flexp2 (x flonum?) ) ⟹ flonum?

    Returns 2^x. (C99 exp2)

    (scheme flonum) procedure (flexp-1 (x flonum?) ) ⟹ flonum?

    Returns e^x - 1, but is much more accurate than flexp for very small values of x. It is recommended for use in algorithms where accuracy is important. (C99 expm1)

    (scheme flonum) procedure (flsquare (x flonum?) ) ⟹ flonum?

    Returns x^2.

    (scheme flonum) procedure (flsqrt (x flonum?) ) ⟹ flonum?

    Returns x^0.5. For -0.0, flsqrt should return -0.0. (C99 sqrt)

    (scheme flonum) procedure (flcbrt (x flonum?) ) ⟹ flonum?

    Returns x^(1/3). (C99 cbrt)

    (scheme flonum) procedure (flhypot (x flonum?) (y flonum?) ) ⟹ flonum?

    Returns the length of the hypotenuse of a right triangle whose sides are of length |x| and |y|. (C99 hypot)

    (scheme flonum) procedure (flexpt (x flonum?) (y flonum?) ) ⟹ flonum?

    Returns x^y. If x is zero, then the result is zero. (C99 pow)

    (scheme flonum) procedure (fllog (x flonum?) ) ⟹ flonum?

    Returns loge x. (C99 log)

    (scheme flonum) procedure (fllog1+ (x flonum?) ) ⟹ flonum?

    Returns loge (x+ 1), but is much more accurate than fllog for values of x near 0. It is recommended for use in algorithms where accuracy is important. (C99 log1p)

    (scheme flonum) procedure (fllog2 (x flonum?) ) ⟹ flonum?

    Returns log2 x. (C99 log2)

    (scheme flonum) procedure (fllog10 (x flonum?) ) ⟹ flonum?

    Returns log10 x. (C99 log10)

    (scheme flonum) procedure (make-fllog-base (base flonum?) ) ⟹ procedure?

    (return (x flonum?) ) ⟹ flonum?

    Returns a procedure that calculates the base-x logarithm of its argument. If x is 1.0 or less than 1.0, it is an error.

    (scheme flonum) procedure (flsin (x flonum?) ) ⟹ flonum?

    Returns sin x. (C99 sin)

    (scheme flonum) procedure (flcos (x flonum?) ) ⟹ flonum?

    Returns cos x. (C99 cos)

    (scheme flonum) procedure (fltan (x flonum?) ) ⟹ flonum?

    Returns tan x. (C99 tan)

    (scheme flonum) procedure (flasin (x flonum?) ) ⟹ flonum?

    Returns arcsin x. (C99 asin)

    (scheme flonum) procedure (flacos (x flonum?) ) ⟹ flonum?

    Returns arccos x. (C99 acos)

    (scheme flonum) procedure (flatan (x flonum?) ) ⟹ flonum?

    (scheme flonum) procedure (flatan (y flonum?) (x flonum?) ) ⟹ flonum?

    Returns arctan x. (C99 atan)

    With two arguments, returns arctan(y/x). in the range [-π,π], using the signs of x and y to choose the correct quadrant for the result. (C99 atan2)

    (scheme flonum) procedure (flsinh (x flonum?) ) ⟹ flonum?

    Returns sinh x. (C99 sinh)

    (scheme flonum) procedure (flcosh (x flonum?) ) ⟹ flonum?

    Returns cosh x. (C99 cosh)

    (scheme flonum) procedure (fltanh (x flonum?) ) ⟹ flonum?

    Returns tanh x. (C99 tanh)

    (scheme flonum) procedure (flasinh (x flonum?) ) ⟹ flonum?

    Returns arcsinh x. (C99 asinh)

    (scheme flonum) procedure (flacosh (x flonum?) ) ⟹ flonum?

    Returns arccosh x. (C99 acosh)

    (scheme flonum) procedure (flatanh (x flonum?) ) ⟹ flonum?

    Returns arctanh x. (C99 atanh)

    (scheme flonum) procedure (flquotient (x flonum?) (y flonum?) ) ⟹ flonum?

    Returns the quotient of x/y as an integral flonum, truncated towards zero.

    (scheme flonum) procedure (flremainder (x flonum?) (y flonum?) ) ⟹ flonum?

    Returns the truncating remainder of x/y as an integral flonum.

    (scheme flonum) procedure (flremquo (x flonum?) (y flonum?) ) ⟹ (values flonum?integer?)

    Returns two values, the rounded remainder of x/y and the low-order n bits (as a correctly signed exact integer) of the rounded quotient. The value of n is implementation-dependent but at least 3. This procedure can be used to reduce the argument of the inverse trigonometric functions, while preserving the correct quadrant or octant. (C99 remquo)

    (scheme flonum) procedure (flgamma (x flonum?) ) ⟹ flonum?

    Returns Γ(x), the gamma function applied to x. This is equal to (x-1)! for integers. (C99 tgamma)

    (scheme flonum) procedure (flloggamma (x flonum?) ) ⟹ flonum?

    Returns two values, log |Γ(x)| without internal overflow, and the sign of Γ(x) as 1.0 if it is positive and -1.0 if it is negative. (C99 lgamma)

    (scheme flonum) procedure (flfirst-bessel (n integer?) (x flonum?) ) ⟹ flonum?

    Returns the nth order Bessel function of the first kind applied to x, Jn(x). (jn, which is an XSI Extension of C99)

    (scheme flonum) procedure (flsecond-bessel (n integer?) (x flonum?) ) ⟹ flonum?

    Returns the nth order Bessel function of the second kind applied to x, Yn(x). (yn, which is an XSI Extension of C99)

    (scheme flonum) procedure (flerf (x flonum?) ) ⟹ flonum?

    Returns the error function erf(x). (C99 erf)

    (scheme flonum) procedure (flerfc (x flonum?) ) ⟹ flonum?

    Returns the complementary error function, 1 - erf(x). (C99 erfc)

    library (scheme mapping)

    (scheme mapping) procedure (mapping (comparator comparator?) arg ... ) ⟹ mapping?

    Returns a newly allocated mapping. The comparator argument is a SRFI 128 comparator, which is used to control and distinguish the keys of the mapping. The args alternate between keys and values and are used to initialize the mapping. In particular, the number of args has to be even. Earlier associations with equal keys take precedence over later arguments.

    (scheme mapping) procedure (mapping-unfold (stop? procedure?) (mapper procedure?) (successor procedure?) seed (comparator comparator?) ) ⟹ mapping?

    (stop? seed ) ⟹ boolean?

    (mapper seed ) ⟹ (values **)

    (successor seed ) ⟹ *

    Create a newly allocated mapping as if by mapping using comparator. If the result of applying the predicate stop? to seed is true, return the mapping. Otherwise, apply the procedure mapper to seed. Mapper returns two values which are added to the mapping as the key and the value, respectively. Then get a new seed by applying the procedure successor to seed, and repeat this algorithm. Associations earlier in the list take precedence over those that come later.

    (scheme mapping) procedure (mapping? obj ) ⟹ boolean?

    Returns #t if obj is a mapping, and #f otherwise.

    (scheme mapping) procedure (mapping-contains? (mapping mapping?) key ) ⟹ boolean?

    Returns #t if key is the key of an association of mapping and #f otherwise.

    (scheme mapping) procedure (mapping-empty? (mapping mapping?) ) ⟹ boolean?

    Returns #t if mapping has no associations and #f otherwise.

    (scheme mapping) procedure (mapping-disjoint? (mapping1 mapping?) (mapping2 mapping?) ) ⟹ boolean?

    Returns #t if mapping1 and mapping2 have no keys in common and #f otherwise.

    (scheme mapping) procedure (mapping-ref (mapping mapping?) key ) ⟹ *

    (scheme mapping) procedure (mapping-ref (mapping mapping?) key (failure procedure?) ) ⟹ *

    (scheme mapping) procedure (mapping-ref (mapping mapping?) key (failure procedure?) (success procedure?) ) ⟹ *

    (failure ) ⟹ *

    (success value ) ⟹ *

    Extracts the value associated to key in the mapping mapping, invokes the procedure success in tail context on it, and returns its result; if success is not provided, then the value itself is returned. If key is not contained in mapping and failure is supplied, then failure is invoked in tail context on no arguments and its values are returned. Otherwise, it is an error.

    (scheme mapping) procedure (mapping-ref/default (mapping mapping?) key default ) ⟹ *

    Semantically equivalent to, but may be more efficient than, the following code:

    (mapping-ref mapping key (lambda () default))

    (scheme mapping) procedure (mapping-key-comparator (mapping mapping?) ) ⟹ comparator?

    Returns the comparator used to compare the keys of the mapping mapping.

    (scheme mapping) procedure (mapping-adjoin (mapping mapping?) key1 value1 ... ) ⟹ mapping?

    The mapping-adjoin procedure returns a newly allocated mapping that uses the same comparator as the mapping mapping and contains all the associations of mapping, and in addition new associations by processing the arguments from left to right. The args alternate between keys and values. Whenever there is a previous association for a key, the previous association prevails and the new association is skipped. It is an error to add an association to mapping whose key that does not return #t when passed to the type test procedure of the comparator.

    (scheme mapping) procedure (mapping-adjoin! (mapping mapping?) key1 value1 ... ) ⟹ mapping?

    The mapping-adjoin! procedure is the same as mapping-adjoin, except that it is permitted to mutate and return the mapping argument rather than allocating a new mapping.

    (scheme mapping) procedure (mapping-set (mapping mapping?) key1 value1 ... ) ⟹ mapping?

    The mapping-set procedure returns a newly allocated mapping that uses the same comparator as the mapping mapping and contains all the associations of mapping, and in addition new associations by processing the arguments from left to right. The args alternate between keys and values. Whenever there is a previous association for a key, it is deleted. It is an error to add an association to mapping whose key that does not return #t when passed to the type test procedure of the comparator.

    (scheme mapping) procedure (mapping-set! (mapping mapping?) key1 value1 ... ) ⟹ mapping?

    The mapping-set! procedure is the same as mapping-set, except that it is permitted to mutate and return the mapping argument rather than allocating a new mapping.

    (scheme mapping) procedure (mapping-replace (mapping mapping?) key value ) ⟹ mapping?

    The mapping-replace procedure returns a newly allocated mapping that uses the same comparator as the mapping mapping and contains all the associations of mapping except as follows: If key is equal (in the sense of mapping's comparator) to an existing key of mapping, then the association for that key is omitted and replaced the association defined by the pair key and value. If there is no such key in mapping, then mapping is returned unchanged.

    (scheme mapping) procedure (mapping-replace! (mapping mapping?) key value ) ⟹ mapping?

    The mapping-replace! procedure is the same as mapping-replace, except that it is permitted to mutate and return the mapping argument rather than allocating a new mapping.

    (scheme mapping) procedure (mapping-delete (mapping mapping?) key ... ) ⟹ mapping?

    (scheme mapping) procedure (mapping-delete! (mapping mapping?) key ... ) ⟹ mapping?

    (scheme mapping) procedure (mapping-delete-all (mapping mapping?) (keys list?) ) ⟹ mapping?

    (scheme mapping) procedure (mapping-delete-all! (mapping mapping?) (keys list?) ) ⟹ mapping?

    The mapping-delete procedure returns a newly allocated mapping containing all the associations of the mapping mapping except for any whose keys are equal (in the sense of mapping's comparator) to one or more of the keys. Any key that is not equal to some key of the mapping is ignored.

    The mapping-delete! procedure is the same as mapping-delete, except that it is permitted to mutate and return the mapping argument rather than allocating a new mapping.

    The mapping-delete-all and mapping-delete-all! procedures are the same as mapping-delete and mapping-delete!, respectively, except that they accept a single argument which is a list of keys whose associations are to be deleted.

    (scheme mapping) procedure (mapping-intern (mapping mapping?) key (failure procedure?) ) ⟹ (values mapping?*)

    (failure ) ⟹ *

    Extracts the value associated to key in the mapping mapping, and returns mapping and the value as two values. If key is not contained in mapping, failure is invoked on no arguments. The procedure then returns two values, a newly allocated mapping that uses the same comparator as the mapping and contains all the associations of mapping, and in addition a new association mapping key to the result of invoking failure, and the result of invoking failure.

    (scheme mapping) procedure (mapping-intern! (mapping mapping?) key (failure procedure?) ) ⟹ (values mapping?*)

    (failure ) ⟹ *

    The mapping-intern! procedure is the same as mapping-intern, except that it is permitted to mutate and return the mapping argument as its first value rather than allocating a new mapping.

    (scheme mapping) procedure (mapping-update (mapping mapping?) key (updater procedure?) ) ⟹ mapping?

    (scheme mapping) procedure (mapping-update (mapping mapping?) key (updater procedure?) (failure procedure?) ) ⟹ mapping?

    (scheme mapping) procedure (mapping-update (mapping mapping?) key (updater procedure?) (failure procedure?) (success procedure?) ) ⟹ mapping?

    (updater value ) ⟹ *

    (failure ) ⟹ *

    (success value ) ⟹ *

    Semantically equivalent to, but may be more efficient than, the following code

    (mapping-set mapping key (updater (mapping-ref mapping key failure success)))

    (scheme mapping) procedure (mapping-update! (mapping mapping?) key (updater procedure?) ) ⟹ mapping?

    (scheme mapping) procedure (mapping-update! (mapping mapping?) key (updater procedure?) (failure procedure?) ) ⟹ mapping?

    (scheme mapping) procedure (mapping-update! (mapping mapping?) key (updater procedure?) (failure procedure?) (success procedure?) ) ⟹ mapping?

    (updater value ) ⟹ *

    (failure ) ⟹ *

    (success value ) ⟹ *

    The mapping-update! procedure is the same as mapping-update, except that it is permitted to mutate and return the mapping argument rather than allocating a new mapping.

    (scheme mapping) procedure (mapping-update/default (mapping mapping?) key (updater procedure?) default ) ⟹ mapping?

    (updater value ) ⟹ *

    Semantically equivalent to, but may be more efficient than, the following code

    (mapping-set mapping key (updater (mapping-ref/default mapping key default)))

    (scheme mapping) procedure (mapping-update!/default (mapping mapping?) key (updater procedure?) default ) ⟹ mapping?

    (updater value ) ⟹ *

    The mapping-update!/default procedure is the same as mapping-update/default, except that it is permitted to mutate and return the mapping argument rather than allocating a new mapping.

    (scheme mapping) procedure (mapping-pop (mapping mapping?) ) ⟹ (values mapping?**)

    (scheme mapping) procedure (mapping-pop (mapping mapping?) (failure procedure?) ) ⟹ (values mapping?**)

    (failure ) ⟹ (values mapping?**)

    The mapping-pop procedure exported from (srfi 146) chooses the association with the least key from mapping and returns three values, a newly allocated mapping that uses the same comparator as mapping and contains all associations of mapping except the chosen one, and the key and the value of the chosen association. If mapping contains no association and failure is supplied, then failure is invoked in tail context on no arguments and its values returned. Otherwise, it is an error.

    (scheme mapping) procedure (mapping-pop! (mapping mapping?) ) ⟹ (values mapping?**)

    (scheme mapping) procedure (mapping-pop! (mapping mapping?) (failure procedure?) ) ⟹ (values mapping?**)

    (failure ) ⟹ (values mapping?**)

    The mapping-pop! procedure is the same as mapping-pop, except that it is permitted to mutate and return the mapping argument rather than allocating a new mapping.

    (scheme mapping) procedure (mapping-search! (mapping mapping?) key (failure procedure?) (success procedure?) ) ⟹ (values mapping?*)

    (failure (insert procedure?) (ignore procedure?) ) ⟹ *

    (insert value obj ) ⟹ *

    (ignore obj ) ⟹ *

    (success key value (update procedure?) (remove procedure?) ) ⟹ *

    (update new-key new-value obj ) ⟹ *

    (remove obj ) ⟹ *

    The mapping-search! procedure is the same as mapping-search, except that it is permitted to mutate and return the mapping argument rather than allocating a new mapping.

    (scheme mapping) procedure (mapping-size (mapping mapping?) ) ⟹ integer?

    Returns the number of associations in mapping as an exact integer.

    (scheme mapping) procedure (mapping-find (predicate procedure?) (mapping mapping?) (failure procedure?) ) ⟹ (values **)

    (predicate key value ) ⟹ boolean?

    (failure ) ⟹ *

    Returns the association with the least key of the mapping mapping consisting of a key and value as two values such that predicate returns a true value when invoked with key and value as arguments, or the result of tail-calling failure with no arguments if there is none. There are no guarantees how many times and with which keys and values predicate is invoked.

    (scheme mapping) procedure (mapping-count (predicate procedure?) (mapping mapping?) ) ⟹ integer?

    (predicate key value ) ⟹ boolean?

    Returns the number of associations of the mapping mapping that satisfy predicate (in the sense of mapping-find) as an exact integer. There are no guarantees how many times and with which keys and values predicate is invoked.

    (scheme mapping) procedure (mapping-any? (predicate procedure?) (mapping mapping?) ) ⟹ boolean?

    (predicate key value ) ⟹ boolean?

    Returns #t if any association of the mapping mapping satisfies predicate (in the sense of mapping-find), or #f otherwise. There are no guarantees how many times and with which keys and values predicate is invoked.

    (scheme mapping) procedure (mapping-every? (predicate procedure?) (mapping mapping?) ) ⟹ boolean?

    (predicate key value ) ⟹ boolean?

    Returns #t if every association of the mapping mapping satisfies predicate (in the sense of mapping-find), or #f otherwise. There are no guarantees how many times and with which keys and values predicate is invoked.

    (scheme mapping) procedure (mapping-keys (mapping mapping?) ) ⟹ list?

    Returns a newly allocated list of all the keys in increasing order in the mapping mapping.

    (scheme mapping) procedure (mapping-values (mapping mapping?) ) ⟹ list?

    Returns a newly allocated list of all the values in increasing order of the keys in the mapping mapping.

    (scheme mapping) procedure (mapping-entries (mapping mapping?) ) ⟹ (values list?list?)

    Returns two values, a newly allocated list of all the keys in the mapping mapping, and a newly allocated list of all the values in the mapping mapping in increasing order of the keys.

    (scheme mapping) procedure (mapping-map (proc procedure?) (comparator comparator?) (mapping mapping?) ) ⟹ mapping?

    (proc key value ) ⟹ (values **)

    Applies proc, which returns two values, on two arguments, the key and value of each association of mapping in increasing order of the keys and returns a newly allocated mapping that uses the comparator comparator, and which contains the results of the applications inserted as keys and values.

    Note that, when proc defines a mapping that is not 1:1 between the keys, some of the mapped objects may be equivalent in the sense of the comparator's equality predicate, and in this case duplicate associations are omitted as in the mapping constructor. It is unpredictable which one will be preserved in the result.

    (scheme mapping) procedure (mapping-for-each (proc procedure?) (comparator comparator?) (mapping mapping?) ) ⟹ undefined

    (proc key value ) ⟹ undefined

    Invokes proc for every association in the mapping mapping in increasing order of the keys, discarding the returned values, with two arguments: the key of the association and the value of the association. Returns an unspecified value.

    (scheme mapping) procedure (mapping-fold (proc procedure?) nil (mapping mapping?) ) ⟹ *

    (proc key value state ) ⟹ *

    Invokes proc for each association of the mapping mapping in increasing order of the keys with three arguments: the key of the association, the value of the association, and an accumulated result of the previous invocation. For the first invocation, nil is used as the third argument. Returns the result of the last invocation, or nil if there was no invocation.

    (scheme mapping) procedure (mapping-map->list (proc procedure?) (mapping mapping?) ) ⟹ list?

    (proc key value ) ⟹ *

    Calls proc for every association in increasing order of the keys in the mapping mapping with two arguments: the key of the association and the value of the association. The values returned by the invocations of proc are accumulated into a list, which is returned.

    (scheme mapping) procedure (mapping-filter (predicate procedure?) (mapping mapping?) ) ⟹ mapping?

    (predicate key value ) ⟹ boolean?

    Returns a newly allocated mapping with the same comparator as the mapping mapping, containing just the associations of mapping that satisfy predicate (in the sense of mapping-find).

    (scheme mapping) procedure (mapping-filter! (predicate procedure?) (mapping mapping?) ) ⟹ mapping?

    (predicate key value ) ⟹ boolean?

    A linear update procedure that returns a mapping containing just the associations of mapping that satisfy predicate.

    (scheme mapping) procedure (mapping-remove (predicate procedure?) (mapping mapping?) ) ⟹ mapping?

    (predicate key value ) ⟹ boolean?

    Returns a newly allocated mapping with the same comparator as the mapping mapping, containing just the associations of mapping that do not satisfy predicate (in the sense of mapping-find).

    (scheme mapping) procedure (mapping-remove! (predicate procedure?) (mapping mapping?) ) ⟹ mapping?

    (predicate key value ) ⟹ boolean?

    A linear update procedure that returns a mapping containing just the associations of mapping that do not satisfy predicate.

    (scheme mapping) procedure (mapping-partition (predicate procedure?) (mapping mapping?) ) ⟹ (values mapping?mapping?)

    (predicate key value ) ⟹ boolean?

    Returns two values: a newly allocated mapping with the same comparator as the mapping mapping that contains just the associations of mapping that satisfy predicate (in the sense of mapping-find), and another newly allocated mapping, also with the same comparator, that contains just the associations of mapping that do not satisfy predicate.

    (scheme mapping) procedure (mapping-partition! (predicate procedure?) (mapping mapping?) ) ⟹ (values mapping?mapping?)

    (predicate key value ) ⟹ boolean?

    A linear update procedure that returns two mappings containing the associations of mapping that do and do not, respectively, satisfy predicate.

    (scheme mapping) procedure (mapping-copy (mapping mapping?) ) ⟹ mapping?

    Returns a newly allocated mapping containing the associations of the mapping mapping, and using the same comparator.

    (scheme mapping) procedure (mapping->alist (mapping mapping?) ) ⟹ list?

    Returns a newly allocated association list containing the associations of the mapping in increasing order of the keys. Each association in the list is a pair whose car is the key and whose cdr is the associated value.

    (scheme mapping) procedure (alist->mapping (comparator comparator?) (alist list?) ) ⟹ mapping?

    Returns a newly allocated mapping, created as if by mapping using the comparator comparator, that contains the associations in the list, which consist of a pair whose car is the key and whose cdr is the value. Associations earlier in the list take precedence over those that come later.

    (scheme mapping) procedure (alist->mapping! (mapping mapping?) (alist list?) ) ⟹ mapping?

    A linear update procedure that returns a mapping that contains the associations of both mapping and alist. Associations in the mapping and those earlier in the list take precedence over those that come later.

    (scheme mapping) procedure (mapping=? (comparator comparator?) (mapping1 mapping?) (mapping2 mapping?) ... ) ⟹ boolean?

    Returns #t if each mapping mapping contains the same associations, and #f otherwise.

    Furthermore, it is explicitly not an error if mapping=? is invoked on mappings that do not share the same (key) comparator. In that case, #f is returned.

    (scheme mapping) procedure (mapping<? (comparator comparator?) (mapping1 mapping?) (mapping2 mapping?) ... ) ⟹ boolean?

    Returns #t if the set of associations of each mapping mapping other than the last is a proper subset of the following mapping, and #f otherwise.

    (scheme mapping) procedure (mapping>? (comparator comparator?) (mapping1 mapping?) (mapping2 mapping?) ... ) ⟹ boolean?

    Returns #t if the set of associations of each mapping mapping other than the last is a proper superset of the following mapping, and #f otherwise.

    (scheme mapping) procedure (mapping<=? (comparator comparator?) (mapping1 mapping?) (mapping2 mapping?) ... ) ⟹ boolean?

    Returns #t if the set of associations of each mapping mapping other than the last is a subset of the following mapping, and #f otherwise.

    (scheme mapping) procedure (mapping>=? (comparator comparator?) (mapping1 mapping?) (mapping2 mapping?) ... ) ⟹ boolean?

    Returns #t if the set of associations of each mapping mapping other than the last is a superset of the following mapping, and #f otherwise.

    (scheme mapping) procedure (mapping-union (mapping1 mapping?) (mapping2 mapping?) ... ) ⟹ mapping?

    (scheme mapping) procedure (mapping-intersection (mapping1 mapping?) (mapping2 mapping?) ... ) ⟹ mapping?

    (scheme mapping) procedure (mapping-difference (mapping1 mapping?) (mapping2 mapping?) ... ) ⟹ mapping?

    (scheme mapping) procedure (mapping-xor (mapping1 mapping?) (mapping2 mapping?) ) ⟹ mapping?

    Return a newly allocated mapping whose set of associations is the union, intersection, asymmetric difference, or symmetric difference of the sets of associations of the mappings mappings. Asymmetric difference is extended to more than two mappings by taking the difference between the first mapping and the union of the others. Symmetric difference is not extended beyond two mappings. When comparing associations, only the keys are compared. In case of duplicate keys (in the sense of the mappings comparators), associations in the result mapping are drawn from the first mapping in which they appear.

    (scheme mapping) procedure (mapping-union! (mapping1 mapping?) (mapping2 mapping?) ... ) ⟹ mapping?

    (scheme mapping) procedure (mapping-intersection! (mapping1 mapping?) (mapping2 mapping?) ... ) ⟹ mapping?

    (scheme mapping) procedure (mapping-difference! (mapping1 mapping?) (mapping2 mapping?) ... ) ⟹ mapping?

    (scheme mapping) procedure (mapping-xor! (mapping1 mapping?) (mapping2 mapping?) ) ⟹ mapping?

    These procedures are the linear update analogs of the corresponding pure functional procedures above.

    (scheme mapping) procedure (mapping/ordered (comparator comparator?) arg ... ) ⟹ mapping?

    (scheme mapping) procedure (mapping-unfold/ordered (stop? procedure?) (mapper procedure?) (successor procedure?) seed (comparator comparator?) ) ⟹ mapping?

    (stop? seed ) ⟹ boolean?

    (mapper seed ) ⟹ (values **)

    (successor seed ) ⟹ *

    These are the same as mapping and mapping-unfold, except that it is an error if the keys are not in order, and they may be more efficient.

    (scheme mapping) procedure (alist->mapping/ordered (comparator comparator?) (alist list?) ) ⟹ mapping?

    (scheme mapping) procedure (alist->mapping/ordered! (mapping mapping?) (alist list?) ) ⟹ mapping?

    These are the same as alist->mapping and alist->mapping!, except that it is an error if the keys are not in order, and they may be more efficient.

    (scheme mapping) procedure (mapping-min-key (mapping mapping?) ) ⟹ *

    (scheme mapping) procedure (mapping-max-key (mapping mapping?) ) ⟹ *

    Returns the least/greatest key contained in the mapping mapping. It is an error for mapping to be empty.

    (scheme mapping) procedure (mapping-min-value (mapping mapping?) ) ⟹ *

    (scheme mapping) procedure (mapping-max-value (mapping mapping?) ) ⟹ *

    Returns the value associated with the least/greatest key contained in the mapping mapping. It is an error for mapping to be empty.

    (scheme mapping) procedure (mapping-min-entry (mapping mapping?) ) ⟹ (values **)

    (scheme mapping) procedure (mapping-max-entry (mapping mapping?) ) ⟹ (values **)

    Returns the entry associated with the least/greatest key contained in the mapping mapping as two values, the key and its associated value. It is an error for mapping to be empty.

    (scheme mapping) procedure (mapping-key-predecessor (mapping mapping?) obj (failure procedure?) ) ⟹ *

    (failure ) ⟹ *

    (scheme mapping) procedure (mapping-key-successor (mapping mapping?) obj (failure procedure?) ) ⟹ *

    (failure ) ⟹ *

    Returns the key contained in the mapping mapping that immediately precedes/succeeds obj in the mapping's order of keys. If no such key is contained in mapping (because obj is the minimum/maximum key, or because mapping is empty), returns the result of tail-calling the thunk failure.

    (scheme mapping) procedure (mapping-range= (mapping mapping?) obj ) ⟹ mapping?

    (scheme mapping) procedure (mapping-range< (mapping mapping?) obj ) ⟹ mapping?

    (scheme mapping) procedure (mapping-range> (mapping mapping?) obj ) ⟹ mapping?

    (scheme mapping) procedure (mapping-range<= (mapping mapping?) obj ) ⟹ mapping?

    (scheme mapping) procedure (mapping-range>= (mapping mapping?) obj ) ⟹ mapping?

    Returns a mapping containing only the associations of the mapping whose keys are equal to, less than, greater than, less than or equal to, or greater than or equal to obj.

    (scheme mapping) procedure (mapping-range=! (mapping mapping?) obj ) ⟹ mapping?

    (scheme mapping) procedure (mapping-range<! (mapping mapping?) obj ) ⟹ mapping?

    (scheme mapping) procedure (mapping-range>! (mapping mapping?) obj ) ⟹ mapping?

    (scheme mapping) procedure (mapping-range<=! (mapping mapping?) obj ) ⟹ mapping?

    (scheme mapping) procedure (mapping-range>=! (mapping mapping?) obj ) ⟹ mapping?

    Linear update procedures returning a mapping containing only the associations of the mapping whose keys are equal to, less than, greater than, less than or equal to, or greater than or equal to obj.

    (scheme mapping) procedure (mapping-split (mapping mapping?) obj ) ⟹ (values mapping?mapping?mapping?mapping?mapping?)

    Returns five values, equivalent to the results of invoking (mapping-range< mapping obj), (mapping-range<= mapping obj), (mapping-range= mapping obj), (mapping-range>= mapping obj), and (mapping-range> mapping obj), but may be more efficient.

    (scheme mapping) procedure (mapping-split! (mapping mapping?) obj ) ⟹ (values mapping?mapping?mapping?mapping?mapping?)

    The mapping-split! procedure is the same as mapping-split, except that it is permitted to mutate and return the mapping rather than allocating a new mapping.

    (scheme mapping) procedure (mapping-catenate (mapping1 mapping?) key value (mapping2 mapping?) ) ⟹ mapping?

    Returns a newly allocated mapping using the comparator comparator whose set of associations is the union of the sets of associations of the mapping mapping1, the association mapping key to value, and the associations of mapping2. It is an error if the keys contained in mapping1 in their natural order, the key key, and the keys contained in mapping2 in their natural order (in that order) do not form a strictly monotone sequence with respect to the ordering of comparator.

    (scheme mapping) procedure (mapping-catenate! (mapping1 mapping?) key value (mapping2 mapping?) ) ⟹ mapping?

    The mapping-catenate! procedure is the same as mapping-catenate, except that it is permitted to mutate and return one of the mappings rather than allocating a new mapping.

    (scheme mapping) procedure (mapping-map/monotone (proc procedure?) (comparator comparator?) (mapping mapping?) ) ⟹ mapping?

    (proc key value ) ⟹ (values **)

    Equivalent to (mapping-map proc comparator mapping), but it is an error if proc does not induce a strictly monotone mapping between the keys with respect to the ordering of the comparator of mapping and the ordering of comparator. Maybe be implemented more efficiently than mapping-map.

    (scheme mapping) procedure (mapping-map/monotone! (proc procedure?) (comparator comparator?) (mapping mapping?) ) ⟹ mapping?

    (proc key value ) ⟹ (values **)

    The mapping-map/monotone! procedure is the same as mapping-map/monotone, except that it is permitted to mutate and return the mapping argument rather than allocating a new mapping.

    (scheme mapping) procedure (mapping-fold/reverse (proc procedure?) nil (mapping mapping?) ) ⟹ *

    (proc key value state ) ⟹ *

    Equivalent to (mapping-fold proc nil mapping) except that the associations are processed in reverse order with respect to the natural ordering of the keys.

    (scheme mapping) procedure (comparator? obj ) ⟹ boolean?

    Type predicate for comparators as exported by (srfi 128).

    (scheme mapping) procedure (make-mapping-comparator (comparator comparator?) ) ⟹ comparator?

    Returns a comparator for mappings that is compatible with the equality predicate (mapping=? comparator mapping1 mapping2). It provides a (partial) ordering predicate that is applicable to pairs of mappings with the same (key) comparator. The lexicographic ordering with respect to the keys (and, in case a tiebreak is necessary, with respect to the ordering of the values) is used for mappings sharing a comparator. The existence of comparators returned by make-mapping-comparator allows mappings whose keys are mappings themselves, and it allows to compare mappings whose values are mappings.

    mapping-comparatorcomparator?

    mapping-comparator is constructed by invoking make-mapping-comparator on (make-default-comparator).

    library (scheme hashmap)

    (scheme hashmap) procedure (hashmap (comparator comparator?) arg ... ) ⟹ hashmap?

    Returns a newly allocated hashmap. The comparator argument is a SRFI 128 comparator, which is used to control and distinguish the keys of the hashmap. The args alternate between keys and values and are used to initialize the hashmap. In particular, the number of args has to be even. Earlier associations with equal keys take precedence over later arguments.

    (scheme hashmap) procedure (hashmap-unfold (stop? procedure?) (mapper procedure?) (successor procedure?) seed (comparator comparator?) ) ⟹ hashmap?

    (stop? seed ) ⟹ boolean?

    (mapper seed ) ⟹ (values **)

    (successor seed ) ⟹ *

    Create a newly allocated hashmap as if by hashmap using comparator. If the result of applying the predicate stop? to seed is true, return the hashmap. Otherwise, apply the procedure mapper to seed. Mapper returns two values which are added to the hashmap as the key and the value, respectively. Then get a new seed by applying the procedure successor to seed, and repeat this algorithm. Associations earlier in the list take precedence over those that come later.

    (scheme hashmap) procedure (hashmap? obj ) ⟹ boolean?

    Returns #t if obj is a hashmap, and #f otherwise.

    (scheme hashmap) procedure (hashmap-contains? (hashmap hashmap?) key ) ⟹ boolean?

    Returns #t if key is the key of an association of hashmap and #f otherwise.

    (scheme hashmap) procedure (hashmap-empty? (hashmap hashmap?) ) ⟹ boolean?

    Returns #t if hashmap has no associations and #f otherwise.

    (scheme hashmap) procedure (hashmap-disjoint? (hashmap1 hashmap?) (hashmap2 hashmap?) ) ⟹ boolean?

    Returns #t if hashmap1 and hashmap2 have no keys in common and #f otherwise.

    (scheme hashmap) procedure (hashmap-ref (hashmap hashmap?) key ) ⟹ *

    (scheme hashmap) procedure (hashmap-ref (hashmap hashmap?) key (failure procedure?) ) ⟹ *

    (scheme hashmap) procedure (hashmap-ref (hashmap hashmap?) key (failure procedure?) (success procedure?) ) ⟹ *

    (failure ) ⟹ *

    (success value ) ⟹ *

    Extracts the value associated to key in the hashmap hashmap, invokes the procedure success in tail context on it, and returns its result; if success is not provided, then the value itself is returned. If key is not contained in hashmap and failure is supplied, then failure is invoked in tail context on no arguments and its values are returned. Otherwise, it is an error.

    (scheme hashmap) procedure (hashmap-ref/default (hashmap hashmap?) key default ) ⟹ *

    Semantically equivalent to, but may be more efficient than, the following code:

    (hashmap-ref hashmap key (lambda () default))

    (scheme hashmap) procedure (hashmap-key-comparator (hashmap hashmap?) ) ⟹ comparator?

    Returns the comparator used to compare the keys of the hashmap hashmap.

    (scheme hashmap) procedure (hashmap-adjoin (hashmap hashmap?) key1 value1 ... ) ⟹ hashmap?

    The hashmap-adjoin procedure returns a newly allocated hashmap that uses the same comparator as the hashmap hashmap and contains all the associations of hashmap, and in addition new associations by processing the arguments from left to right. The args alternate between keys and values. Whenever there is a previous association for a key, the previous association prevails and the new association is skipped. It is an error to add an association to hashmap whose key that does not return #t when passed to the type test procedure of the comparator.

    (scheme hashmap) procedure (hashmap-adjoin! (hashmap hashmap?) key1 value1 ... ) ⟹ hashmap?

    The hashmap-adjoin! procedure is the same as hashmap-adjoin, except that it is permitted to mutate and return the hashmap argument rather than allocating a new hashmap.

    (scheme hashmap) procedure (hashmap-set (hashmap hashmap?) key1 value1 ... ) ⟹ hashmap?

    The hashmap-set procedure returns a newly allocated hashmap that uses the same comparator as the hashmap hashmap and contains all the associations of hashmap, and in addition new associations by processing the arguments from left to right. The args alternate between keys and values. Whenever there is a previous association for a key, it is deleted. It is an error to add an association to hashmap whose key that does not return #t when passed to the type test procedure of the comparator.

    (scheme hashmap) procedure (hashmap-set! (hashmap hashmap?) key1 value1 ... ) ⟹ hashmap?

    The hashmap-set! procedure is the same as hashmap-set, except that it is permitted to mutate and return the hashmap argument rather than allocating a new hashmap.

    (scheme hashmap) procedure (hashmap-replace (hashmap hashmap?) key value ) ⟹ hashmap?

    The hashmap-replace procedure returns a newly allocated hashmap that uses the same comparator as the hashmap hashmap and contains all the associations of hashmap except as follows: If key is equal (in the sense of hashmap's comparator) to an existing key of hashmap, then the association for that key is omitted and replaced the association defined by the pair key and value. If there is no such key in hashmap, then hashmap is returned unchanged.

    (scheme hashmap) procedure (hashmap-replace! (hashmap hashmap?) key value ) ⟹ hashmap?

    The hashmap-replace! procedure is the same as hashmap-replace, except that it is permitted to mutate and return the hashmap argument rather than allocating a new hashmap.

    (scheme hashmap) procedure (hashmap-delete (hashmap hashmap?) key ... ) ⟹ hashmap?

    (scheme hashmap) procedure (hashmap-delete! (hashmap hashmap?) key ... ) ⟹ hashmap?

    (scheme hashmap) procedure (hashmap-delete-all (hashmap hashmap?) (keys list?) ) ⟹ hashmap?

    (scheme hashmap) procedure (hashmap-delete-all! (hashmap hashmap?) (keys list?) ) ⟹ hashmap?

    The hashmap-delete procedure returns a newly allocated hashmap containing all the associations of the hashmap hashmap except for any whose keys are equal (in the sense of hashmap's comparator) to one or more of the keys. Any key that is not equal to some key of the hashmap is ignored.

    The hashmap-delete! procedure is the same as hashmap-delete, except that it is permitted to mutate and return the hashmap argument rather than allocating a new hashmap.

    The hashmap-delete-all and hashmap-delete-all! procedures are the same as hashmap-delete and hashmap-delete!, respectively, except that they accept a single argument which is a list of keys whose associations are to be deleted.

    (scheme hashmap) procedure (hashmap-intern (hashmap hashmap?) key (failure procedure?) ) ⟹ (values hashmap?*)

    (failure ) ⟹ *

    Extracts the value associated to key in the hashmap hashmap, and returns hashmap and the value as two values. If key is not contained in hashmap, failure is invoked on no arguments. The procedure then returns two values, a newly allocated hashmap that uses the same comparator as the hashmap and contains all the associations of hashmap, and in addition a new association hashmap key to the result of invoking failure, and the result of invoking failure.

    (scheme hashmap) procedure (hashmap-intern! (hashmap hashmap?) key (failure procedure?) ) ⟹ (values hashmap?*)

    (failure ) ⟹ *

    The hashmap-intern! procedure is the same as hashmap-intern, except that it is permitted to mutate and return the hashmap argument as its first value rather than allocating a new hashmap.

    (scheme hashmap) procedure (hashmap-update (hashmap hashmap?) key (updater procedure?) ) ⟹ hashmap?

    (scheme hashmap) procedure (hashmap-update (hashmap hashmap?) key (updater procedure?) (failure procedure?) ) ⟹ hashmap?

    (scheme hashmap) procedure (hashmap-update (hashmap hashmap?) key (updater procedure?) (failure procedure?) (success procedure?) ) ⟹ hashmap?

    (updater value ) ⟹ *

    (failure ) ⟹ *

    (success value ) ⟹ *

    Semantically equivalent to, but may be more efficient than, the following code

    (hashmap-set hashmap key (updater (hashmap-ref hashmap key failure success)))

    (scheme hashmap) procedure (hashmap-update! (hashmap hashmap?) key (updater procedure?) ) ⟹ hashmap?

    (scheme hashmap) procedure (hashmap-update! (hashmap hashmap?) key (updater procedure?) (failure procedure?) ) ⟹ hashmap?

    (scheme hashmap) procedure (hashmap-update! (hashmap hashmap?) key (updater procedure?) (failure procedure?) (success procedure?) ) ⟹ hashmap?

    (updater value ) ⟹ *

    (failure ) ⟹ *

    (success value ) ⟹ *

    The hashmap-update! procedure is the same as hashmap-update, except that it is permitted to mutate and return the hashmap argument rather than allocating a new hashmap.

    (scheme hashmap) procedure (hashmap-update/default (hashmap hashmap?) key (updater procedure?) default ) ⟹ hashmap?

    (updater value ) ⟹ *

    Semantically equivalent to, but may be more efficient than, the following code

    (hashmap-set hashmap key (updater (hashmap-ref/default hashmap key default)))

    (scheme hashmap) procedure (hashmap-update!/default (hashmap hashmap?) key (updater procedure?) default ) ⟹ hashmap?

    (updater value ) ⟹ *

    The hashmap-update!/default procedure is the same as hashmap-update/default, except that it is permitted to mutate and return the hashmap argument rather than allocating a new hashmap.

    (scheme hashmap) procedure (hashmap-pop (hashmap hashmap?) ) ⟹ (values hashmap?**)

    (scheme hashmap) procedure (hashmap-pop (hashmap hashmap?) (failure procedure?) ) ⟹ (values hashmap?**)

    (failure ) ⟹ (values hashmap?**)

    The hashmap-pop procedure exported from (srfi 146 hash) chooses arbitrary association from hashmap and returns three values, a newly allocated hashmap that uses the same comparator as hashmap and contains all associations of hashmap except the chosen one, and the key and the value of the chosen association. If hashmap contains no association and failure is supplied, then failure is invoked in tail context on no arguments and its values returned. Otherwise, it is an error.

    (scheme hashmap) procedure (hashmap-pop! (hashmap hashmap?) ) ⟹ (values hashmap?**)

    (scheme hashmap) procedure (hashmap-pop! (hashmap hashmap?) (failure procedure?) ) ⟹ (values hashmap?**)

    (failure ) ⟹ (values hashmap?**)

    The hashmap-pop! procedure is the same as hashmap-pop, except that it is permitted to mutate and return the hashmap argument rather than allocating a new hashmap.

    (scheme hashmap) procedure (hashmap-search! (hashmap hashmap?) key (failure procedure?) (success procedure?) ) ⟹ (values hashmap?*)

    (failure (insert procedure?) (ignore procedure?) ) ⟹ *

    (insert value obj ) ⟹ *

    (ignore obj ) ⟹ *

    (success key value (update procedure?) (remove procedure?) ) ⟹ *

    (update new-key new-value obj ) ⟹ *

    (remove obj ) ⟹ *

    The hashmap-search! procedure is the same as hashmap-search, except that it is permitted to mutate and return the hashmap argument rather than allocating a new hashmap.

    (scheme hashmap) procedure (hashmap-size (hashmap hashmap?) ) ⟹ integer?

    Returns the number of associations in hashmap as an exact integer.

    (scheme hashmap) procedure (hashmap-find (predicate procedure?) (hashmap hashmap?) (failure procedure?) ) ⟹ (values **)

    (predicate key value ) ⟹ boolean?

    (failure ) ⟹ *

    Returns arbitrary association of the hashmap hashmap consisting of a key and value as two values such that predicate returns a true value when invoked with key and value as arguments, or the result of tail-calling failure with no arguments if there is none. There are no guarantees how many times and with which keys and values predicate is invoked.

    (scheme hashmap) procedure (hashmap-count (predicate procedure?) (hashmap hashmap?) ) ⟹ integer?

    (predicate key value ) ⟹ boolean?

    Returns the number of associations of the hashmap hashmap that satisfy predicate (in the sense of hashmap-find) as an exact integer. There are no guarantees how many times and with which keys and values predicate is invoked.

    (scheme hashmap) procedure (hashmap-any? (predicate procedure?) (hashmap hashmap?) ) ⟹ boolean?

    (predicate key value ) ⟹ boolean?

    Returns #t if any association of the hashmap hashmap satisfies predicate (in the sense of hashmap-find), or #f otherwise. There are no guarantees how many times and with which keys and values predicate is invoked.

    (scheme hashmap) procedure (hashmap-every? (predicate procedure?) (hashmap hashmap?) ) ⟹ boolean?

    (predicate key value ) ⟹ boolean?

    Returns #t if every association of the hashmap hashmap satisfies predicate (in the sense of hashmap-find), or #f otherwise. There are no guarantees how many times and with which keys and values predicate is invoked.

    (scheme hashmap) procedure (hashmap-keys (hashmap hashmap?) ) ⟹ list?

    Returns a newly allocated list of all the keys in arbitrary order in the hashmap hashmap.

    (scheme hashmap) procedure (hashmap-values (hashmap hashmap?) ) ⟹ list?

    Returns a newly allocated list of all the values in arbitrary order of the keys in the hashmap hashmap.

    (scheme hashmap) procedure (hashmap-entries (hashmap hashmap?) ) ⟹ (values list?list?)

    Returns two values, a newly allocated list of all the keys in the hashmap hashmap, and a newly allocated list of all the values in the hashmap hashmap in arbitrary but consistent order.

    (scheme hashmap) procedure (hashmap-map (proc procedure?) (comparator comparator?) (hashmap hashmap?) ) ⟹ hashmap?

    (proc key value ) ⟹ (values **)

    Applies proc, which returns two values, on two arguments, the key and value of each association of hashmap in arbitrary order and returns a newly allocated hashmap that uses the comparator comparator, and which contains the results of the applications inserted as keys and values.

    Note that, when proc defines a hashmap that is not 1:1 between the keys, some of the mapped objects may be equivalent in the sense of the comparator's equality predicate, and in this case duplicate associations are omitted as in the hashmap constructor. It is unpredictable which one will be preserved in the result.

    (scheme hashmap) procedure (hashmap-for-each (proc procedure?) (comparator comparator?) (hashmap hashmap?) ) ⟹ undefined

    (proc key value ) ⟹ undefined

    Invokes proc for every association in the hashmap hashmap in arbitrary order, discarding the returned values, with two arguments: the key of the association and the value of the association. Returns an unspecified value.

    (scheme hashmap) procedure (hashmap-fold (proc procedure?) nil (hashmap hashmap?) ) ⟹ *

    (proc key value state ) ⟹ *

    Invokes proc for each association of the hashmap hashmap in arbitrary order with three arguments: the key of the association, the value of the association, and an accumulated result of the previous invocation. For the first invocation, nil is used as the third argument. Returns the result of the last invocation, or nil if there was no invocation.

    (scheme hashmap) procedure (hashmap-map->list (proc procedure?) (hashmap hashmap?) ) ⟹ list?

    (proc key value ) ⟹ *

    Calls proc for every association in arbitrary order in the hashmap hashmap with two arguments: the key of the association and the value of the association. The values returned by the invocations of proc are accumulated into a list, which is returned.

    (scheme hashmap) procedure (hashmap-filter (predicate procedure?) (hashmap hashmap?) ) ⟹ hashmap?

    (predicate key value ) ⟹ boolean?

    Returns a newly allocated hashmap with the same comparator as the hashmap hashmap, containing just the associations of hashmap that satisfy predicate (in the sense of hashmap-find).

    (scheme hashmap) procedure (hashmap-filter! (predicate procedure?) (hashmap hashmap?) ) ⟹ hashmap?

    (predicate key value ) ⟹ boolean?

    A linear update procedure that returns a hashmap containing just the associations of hashmap that satisfy predicate.

    (scheme hashmap) procedure (hashmap-remove (predicate procedure?) (hashmap hashmap?) ) ⟹ hashmap?

    (predicate key value ) ⟹ boolean?

    Returns a newly allocated hashmap with the same comparator as the hashmap hashmap, containing just the associations of hashmap that do not satisfy predicate (in the sense of hashmap-find).

    (scheme hashmap) procedure (hashmap-remove! (predicate procedure?) (hashmap hashmap?) ) ⟹ hashmap?

    (predicate key value ) ⟹ boolean?

    A linear update procedure that returns a hashmap containing just the associations of hashmap that do not satisfy predicate.

    (scheme hashmap) procedure (hashmap-partition (predicate procedure?) (hashmap hashmap?) ) ⟹ (values hashmap?hashmap?)

    (predicate key value ) ⟹ boolean?

    Returns two values: a newly allocated hashmap with the same comparator as the hashmap hashmap that contains just the associations of hashmap that satisfy predicate (in the sense of hashmap-find), and another newly allocated hashmap, also with the same comparator, that contains just the associations of hashmap that do not satisfy predicate.

    (scheme hashmap) procedure (hashmap-partition! (predicate procedure?) (hashmap hashmap?) ) ⟹ (values hashmap?hashmap?)

    (predicate key value ) ⟹ boolean?

    A linear update procedure that returns two hashmaps containing the associations of hashmap that do and do not, respectively, satisfy predicate.

    (scheme hashmap) procedure (hashmap-copy (hashmap hashmap?) ) ⟹ hashmap?

    Returns a newly allocated hashmap containing the associations of the hashmap hashmap, and using the same comparator.

    (scheme hashmap) procedure (hashmap->alist (hashmap hashmap?) ) ⟹ list?

    Returns a newly allocated association list containing the associations of the hashmap in arbitrary order. Each association in the list is a pair whose car is the key and whose cdr is the associated value.

    (scheme hashmap) procedure (alist->hashmap (comparator comparator?) (alist list?) ) ⟹ hashmap?

    Returns a newly allocated hashmap, created as if by hashmap using the comparator comparator, that contains the associations in the list, which consist of a pair whose car is the key and whose cdr is the value. Associations earlier in the list take precedence over those that come later.

    (scheme hashmap) procedure (alist->hashmap! (hashmap hashmap?) (alist list?) ) ⟹ hashmap?

    A linear update procedure that returns a hashmap that contains the associations of both hashmap and alist. Associations in the hashmap and those earlier in the list take precedence over those that come later.

    (scheme hashmap) procedure (hashmap=? (comparator comparator?) (hashmap1 hashmap?) (hashmap2 hashmap?) ... ) ⟹ boolean?

    Returns #t if each hashmap hashmap contains the same associations, and #f otherwise.

    Furthermore, it is explicitly not an error if hashmap=? is invoked on hashmaps that do not share the same (key) comparator. In that case, #f is returned.

    (scheme hashmap) procedure (hashmap<? (comparator comparator?) (hashmap1 hashmap?) (hashmap2 hashmap?) ... ) ⟹ boolean?

    Returns #t if the set of associations of each hashmap hashmap other than the last is a proper subset of the following hashmap, and #f otherwise.

    (scheme hashmap) procedure (hashmap>? (comparator comparator?) (hashmap1 hashmap?) (hashmap2 hashmap?) ... ) ⟹ boolean?

    Returns #t if the set of associations of each hashmap hashmap other than the last is a proper superset of the following hashmap, and #f otherwise.

    (scheme hashmap) procedure (hashmap<=? (comparator comparator?) (hashmap1 hashmap?) (hashmap2 hashmap?) ... ) ⟹ boolean?

    Returns #t if the set of associations of each hashmap hashmap other than the last is a subset of the following hashmap, and #f otherwise.

    (scheme hashmap) procedure (hashmap>=? (comparator comparator?) (hashmap1 hashmap?) (hashmap2 hashmap?) ... ) ⟹ boolean?

    Returns #t if the set of associations of each hashmap hashmap other than the last is a superset of the following hashmap, and #f otherwise.

    (scheme hashmap) procedure (hashmap-union (hashmap1 hashmap?) (hashmap2 hashmap?) ... ) ⟹ hashmap?

    (scheme hashmap) procedure (hashmap-intersection (hashmap1 hashmap?) (hashmap2 hashmap?) ... ) ⟹ hashmap?

    (scheme hashmap) procedure (hashmap-difference (hashmap1 hashmap?) (hashmap2 hashmap?) ... ) ⟹ hashmap?

    (scheme hashmap) procedure (hashmap-xor (hashmap1 hashmap?) (hashmap2 hashmap?) ) ⟹ hashmap?

    Return a newly allocated hashmap whose set of associations is the union, intersection, asymmetric difference, or symmetric difference of the sets of associations of the hashmaps hashmaps. Asymmetric difference is extended to more than two hashmaps by taking the difference between the first hashmap and the union of the others. Symmetric difference is not extended beyond two hashmaps. When comparing associations, only the keys are compared. In case of duplicate keys (in the sense of the hashmaps comparators), associations in the result hashmap are drawn from the first hashmap in which they appear.

    (scheme hashmap) procedure (hashmap-union! (hashmap1 hashmap?) (hashmap2 hashmap?) ... ) ⟹ hashmap?

    (scheme hashmap) procedure (hashmap-intersection! (hashmap1 hashmap?) (hashmap2 hashmap?) ... ) ⟹ hashmap?

    (scheme hashmap) procedure (hashmap-difference! (hashmap1 hashmap?) (hashmap2 hashmap?) ... ) ⟹ hashmap?

    (scheme hashmap) procedure (hashmap-xor! (hashmap1 hashmap?) (hashmap2 hashmap?) ) ⟹ hashmap?

    These procedures are the linear update analogs of the corresponding pure functional procedures above.

    (scheme hashmap) procedure (comparator? obj ) ⟹ boolean?

    Type predicate for comparators as exported by (srfi 128).

    (scheme hashmap) procedure (make-hashmap-comparator (comparator comparator?) ) ⟹ comparator?

    Returns a comparator for hashmaps that is compatible with the equality predicate (hashmap=? comparator hashmap1 hashmap2). It provides an implementation-dependent hash function. The existence of comparators returned by make-hashmap-comparator allows hashmaps whose keys are hashmaps themselves, and it allows to compare hashmaps whose values are hashmaps.

    hashmap-comparatorcomparator?

    hashmap-comparator is constructed by invoking make-hashmap-comparator on (make-default-comparator).

    library (scheme regex)

    (scheme regex) procedure (regexp re ) ⟹ regexp?

    Compiles a regexp if given an object whose structure matches the SRE syntax. This may be written as a literal or partial literal with quote or quasiquote, or may be generated entirely programmatically. Returns re unmodified if it is already a regexp. Raises an error if re is neither a regexp nor a valid representation of an SRE.

    Mutating re may invalidate the resulting regexp, causing unspecified results if subsequently used for matching.

    SRE syntax:

    <sre> ::=

    | <string> ; A literal string match.

    | <cset-sre> ; A character set match.

    | (* <sre> ...) ; 0 or more matches.

    | (zero-or-more <sre> ...)

    | (+ <sre> ...) ; 1 or more matches.

    | (one-or-more <sre> ...)

    | (? <sre> ...) ; 0 or 1 matches.

    | (optional <sre> ...)

    | (= <n> <sre> ...) ; <n> matches.

    | (exactly <n> <sre> ...)

    | (>= <n> <sre> ...) ; <n> or more matches.

    | (at-least <n> <sre> ...)

    | (** <n> <m> <sre> ...) ; <n> to <m> matches.

    | (repeated <n> <m> <sre> ...)

    | (| <sre> ...) ; Alternation.

    | (or <sre> ...)

    | (: <sre> ...) ; Sequence.

    | (seq <sre> ...)

    | ($ <sre> ...) ; Numbered submatch.

    | (submatch <sre> ...)

    | (-> <name> <sre> ...) ; Named submatch. <name> is

    | (submatch-named <name> <sre> ...) ; a symbol.

    | (w/case <sre> ...) ; Introduce a case-sensitive context.

    | (w/nocase <sre> ...) ; Introduce a case-insensitive context.

    | (w/unicode <sre> ...) ; Introduce a unicode context.

    | (w/ascii <sre> ...) ; Introduce an ascii context.

    | (w/nocapture <sre> ...) ; Ignore all enclosed submatches.

    | bos ; Beginning of string.

    | eos ; End of string.

    | bol ; Beginning of line.

    | eol ; End of line.

    | bog ; Beginning of grapheme cluster.

    | eog ; End of grapheme cluster.

    | grapheme ; A single grapheme cluster.

    | bow ; Beginning of word.

    | eow ; End of word.

    | nwb ; A non-word boundary.

    | (word <sre> ...) ; An SRE wrapped in word boundaries.

    | (word+ <cset-sre> ...) ; A single word restricted to a cset.

    | word ; A single word.

    | (?? <sre> ...) ; A non-greedy pattern, 0 or 1 match.

    | (non-greedy-optional <sre> ...)

    | (*? <sre> ...) ; Non-greedy 0 or more matches.

    | (non-greedy-zero-or-more <sre> ...)

    | (**? <m> <n> <sre> ...) ; Non-greedy <m> to <n> matches.

    | (non-greedy-repeated <sre> ...)

    | (look-ahead <sre> ...) ; Zero-width look-ahead assertion.

    | (look-behind <sre> ...) ; Zero-width look-behind assertion.

    | (neg-look-ahead <sre> ...) ; Zero-width negative look-ahead assertion.

    | (neg-look-behind <sre> ...) ; Zero-width negative look-behind assertion.

    | (backref <n-or-name>) ; Match a previous submatch.

    The grammar for cset-sre is as follows.

    <cset-sre> ::=

    | <char> ; literal char

    | "<char>" ; string of one char

    | <char-set> ; embedded SRFI 14 char set

    | (<string>) ; literal char set

    | (char-set <string>)

    | (/ <range-spec> ...) ; ranges

    | (char-range <range-spec> ...)

    | (or <cset-sre> ...) ; union

    | (|\|| <cset-sre> ...)

    | (and <cset-sre> ...) ; intersection

    | (& <cset-sre> ...)

    | (- <cset-sre> ...) ; difference

    | (- <difference> ...)

    | (~ <cset-sre> ...) ; complement of union

    | (complement <cset-sre> ...)

    | (w/case <cset-sre> ...) ; case and unicode toggling

    | (w/nocase <cset-sre> ...)

    | (w/ascii <cset-sre> ...)

    | (w/unicode <cset-sre> ...)

    | any | nonl | ascii | lower-case | lower

    | upper-case | upper | title-case | title

    | alphabetic | alpha | alphanumeric | alphanum | alnum

    | numeric | num | punctuation | punct | symbol

    | graphic | graph | whitespace | white | space

    | printing | print | control | cntrl | hex-digit | xdigit

    <range-spec> ::= <string> | <char>

    (scheme regex) syntax (rx (* one-or-more ? optional = exactly at-least ** repeated | or : seq $ submatch -> sumatch-named w/case w/nocase w/unicode w/ascii w/nocapture bos eos bol eol bog eog grapheme bow eow nwb word word+ ?? non-greedy-optional *? non-greedy-zero-or-more **? non-greedy-repeated look-ahead look-behind neg-look-ahead neg-look-behind backref ) ((_ sre ...) regexp?) )

    string charset (* sre ...) (one-or-more sre ...) (? sre ...) (optional sre ...) (= n sre ...) (exactly n sre ...) (>= n sre ...) (at-least n sre ...) (** n m sre ...) (repeated n m sre ...) (|\|| sre ...) (or sre ...) (: sre ...) (seq sre ...) ($ sre ...) (submatch sre ...) (-> name sre ...) (submatch-named name sre ...) (w/case sre ...) (w/nocase sre ...) (w/unicode sre ...) (w/ascii sre ...) (w/nocapture sre ...) bos eos bol eol bog eog grapheme bow eow nwb (word sre ...) (word+ cset-sre ...) word (?? sre ...) (non-greedy-optional sre ...) (*? sre ...) (non-greedy-zero-or-more sre ...) (**? m n sre ...) (non-greedy-repeated sre ...) (look-ahead sre ...) (look-behind sre ...) (neg-look-ahead sre ...) (neg-look-behind sre ...) (backref n-or-name)

    Macro shorthand for (regexp `(: sre ...)). May be able to perform some or all computation at compile time if sre is not unquoted. Note because of this equivalence with the procedural constructor regexp, the semantics of unquote differs from the original SCSH implementation in that unquoted expressions can expand into any object matching the SRE syntax, but not a compiled regexp object. Further, unquote and unquote-splicing both expand all matches.

    (scheme regex) procedure (regexp->sre (re regexp?) ) ⟹ *

    Returns an SRE corresponding to the given regexp re. The SRE will be equivalent to (will match the same strings) but not necessarily equal? to the SRE originally used to compile re. Mutating the result may invalidate re, causing unspecified results if subsequently used for matching.

    (scheme regex) procedure (char-set->sre (char-set charset?) ) ⟹ *

    Returns an SRE corresponding to the given SRFI 14 character set. The resulting SRE expands the character set into notation which does not make use of embedded SRFI 14 character sets, and so is suitable for writing portably.

    (scheme regex) procedure (valid-sre? obj ) ⟹ boolean?

    Returns true iff obj can be safely passed to regexp.

    (scheme regex) procedure (regexp? obj ) ⟹ boolean?

    Returns true iff obj is a regexp.

    (scheme regex) procedure (regexp-matches re (str string?) ) ⟹ regexp-match? / #f /

    (scheme regex) procedure (regexp-matches re (str string?) (start integer?) ) ⟹ regexp-match? / #f /

    (scheme regex) procedure (regexp-matches re (str string?) (start integer?) (end integer?) ) ⟹ regexp-match? / #f /

    Returns an regexp-match object if re successfully matches the entire string str from start (inclusive) to end (exclusive), or #f is the match fails. The regexp-match object will contain information needed to extract any submatches.

    (scheme regex) procedure (regexp-matches? re (str string?) ) ⟹ boolean?

    (scheme regex) procedure (regexp-matches? re (str string?) (start integer?) ) ⟹ boolean?

    (scheme regex) procedure (regexp-matches? re (str string?) (start integer?) (end integer?) ) ⟹ boolean?

    Returns #t if re matches str as in regexp-matches, or #f otherwise. May be faster than regexp-matches since it doesn't need to return submatch data.

    (scheme regex) procedure (regexp-fold re (kons procedure?) knil (str string?) ) ⟹ *

    (scheme regex) procedure (regexp-fold re (kons procedure?) knil (str string?) (finish procedure?) ) ⟹ *

    (scheme regex) procedure (regexp-fold re (kons procedure?) knil (str string?) (finish procedure?) (start integer?) ) ⟹ *

    (scheme regex) procedure (regexp-fold re (kons procedure?) knil (str string?) (finish procedure?) (start integer?) (end integer?) ) ⟹ *

    (kons (i integer?) (match regexp-match?) (str string?) acc ) ⟹ *

    (finish (i integer?) (match #f) (str string?) acc ) ⟹ *

    The fundamental regexp matching iterator. Repeatedly searches str for the regexp re so long as a match can be found. On each successful match, applies (kons i regexp-match str acc) where i is the index since the last match (beginning with start), regexp-match is the resulting match, and acc is the result of the previous kons application, beginning with knil. When no more matches can be found, calls finish with the same arguments, except that regexp-match is #f.

    By default finish just returns acc.

    (scheme regex) procedure (regexp-extract re (str string?) ) ⟹ list?

    (scheme regex) procedure (regexp-extract re (str string?) (start integer?) ) ⟹ list?

    (scheme regex) procedure (regexp-extract re (str string?) (start integer?) (end integer?) ) ⟹ list?

    Extracts all non-empty substrings of str which match re between start and end as a list of strings.

    (scheme regex) procedure (regexp-split re (str string?) ) ⟹ list?

    (scheme regex) procedure (regexp-split re (str string?) (start integer?) ) ⟹ list?

    (scheme regex) procedure (regexp-split re (str string?) (start integer?) (end integer?) ) ⟹ list?

    Splits str into a list of (possibly empty) strings separated by non-empty matches of re.

    (scheme regex) procedure (regexp-partition re (str string?) ) ⟹ list?

    (scheme regex) procedure (regexp-partition re (str string?) (start integer?) ) ⟹ list?

    (scheme regex) procedure (regexp-partition re (str string?) (start integer?) (end integer?) ) ⟹ list?

    Partitions str into a list of non-empty strings matching re, interspersed with the unmatched portions of the string. The first and every odd element is an unmatched substring, which will be the empty string if re matches at the beginning of the string or end of the previous match. The second and every even element will be a substring matching re. If the final match ends at the end of the string, no trailing empty string will be included. Thus, in the degenerate case where str is the empty string, the result is ("").

    Note that regexp-partition is equivalent to interleaving the results of regexp-split and regexp-extract, starting with the former.

    (scheme regex) procedure (regexp-replace re (str string?) (subst (or string?integer?symbol?)) ) ⟹ string?

    (scheme regex) procedure (regexp-replace re (str string?) (subst (or string?integer?symbol?)) (start integer?) ) ⟹ string?

    (scheme regex) procedure (regexp-replace re (str string?) (subst (or string?integer?symbol?)) (start integer?) (end integer?) ) ⟹ string?

    (scheme regex) procedure (regexp-replace re (str string?) (subst (or string?integer?symbol?)) (start integer?) (end integer?) (count integer?) ) ⟹ string?

    Returns a new string replacing the countth match of re in str the subst, where the zero-indexed count defaults to zero (i.e. the first match). If there are not count matches, returns the selected substring unmodified.

    subst can be a string, an integer or symbol indicating the contents of a numbered or named submatch of re, 'pre for the substring to the left of the match, or 'post for the substring to the right of the match.

    The optional parameters start and end restrict both the matching and the substitution, to the given indices, such that the result is equivalent to omitting these parameters and replacing on (substring str start end). As a convenience, a value of #f for end is equivalent to (string-length str).

    (scheme regex) procedure (regexp-replace-all re (str string?) (subst (or string?integer?symbol?)) (start integer?) ) ⟹ string?

    (scheme regex) procedure (regexp-replace-all re (str string?) (subst (or string?integer?symbol?)) (start integer?) (end integer?) ) ⟹ string?

    Equivalent to regexp-replace, but replaces all occurrences of re in str.

    (scheme regex) procedure (regexp-match? obj ) ⟹ boolean?

    Returns true iff obj is a successful match from regexp-matches or regexp-search.

    (scheme regex) procedure (regexp-match-count (obj regexp-match?) ) ⟹ integer?

    Returns the number of submatches of regexp-match, regardless of whether they matched or not. Does not include the implicit zero full match in the count.

    (scheme regex) procedure (regexp-match-submatch (obj regexp-match?) (field (or integer?symbol?)) ) ⟹ string? / #f /

    Returns the substring matched in regexp-match corresponding to field, either an integer or a symbol for a named submatch. Index 0 refers to the entire match, index 1 to the first lexicographic submatch, and so on. If there are multiple submatches with the same name, the first which matched is returned. If passed an integer outside the range of matches, or a symbol which does not correspond to a named submatch of the pattern, it is an error. If the corresponding submatch did not match, returns false.

    The result of extracting a submatch after the original matched string has been mutated is unspecified.

    (scheme regex) procedure (regexp-match-submatch-start (obj regexp-match?) (field (or integer?symbol?)) ) ⟹ integer? / #f /

    Returns the start index regexp-match corresponding to field, as in regexp-match-submatch.

    (scheme regex) procedure (regexp-match-submatch-end (obj regexp-match?) (field (or integer?symbol?)) ) ⟹ integer? / #f /

    Returns the end index in regexp-match corresponding to field, as in regexp-match-submatch.

    (scheme regex) procedure (regexp-match->list (obj regexp-match?) ) ⟹ list?

    Returns a list of all submatches in regexp-match as string or false, beginning with the entire match 0.

    library (scheme show)

    (scheme show) procedure (show (port #f) (fmt formatter) ... ) ⟹ string?

    (scheme show) procedure (show (port (or output-port?boolean?)) (fmt formatter) ... ) ⟹ undefined

    The entry point for all formatting. Applies the fmt formatters in sequence, accumulating the output to output-dest. As with SRFI 28 format, output-dest can be an output port, #t to indicate the current output port, or #f to accumulate the output into a string and return that as the result of show.

    (scheme show) procedure (displayed obj ) ⟹ formatter

    If obj is a formatter, returns obj as is. Otherwise, outputs obj using display semantics. Specifically, strings are output as if by write-string and characters are written as if by write-char. Other objects are output as with written (including nested strings and chars inside obj). This is the default behavior for top-level formats in show, each and most other high-level formatters.

    (scheme show) procedure (written obj ) ⟹ formatter

    Outputs obj using write semantics. Uses the current numeric formatting settings to the extent that the written result can still be passed to read, possibly with loss of precision. Specifically, the current radix is used if set to any of 2, 8, 10 or 16, and the fixed point precision is used if specified and the radix is 10.

    (scheme show) procedure (written-simply obj ) ⟹ formatter

    Same as "written", but doesn't handle shared structures. Infinite loops can still be avoided if used inside a formatter that truncates data (see trimmed and fitted below).

    (scheme show) procedure (pretty obj ) ⟹ formatter

    Pretty-prints obj. The result should be identical to written except possibly for differences in whitespace to make the output resemble formatted source code. Implementations should print vectors and data lists (lists that don't begin with a (nested) symbol) in a tabular format when possible to reduce vertical space.

    (scheme show) procedure (pretty-simply obj ) ⟹ formatter

    Same as "pretty", but doesn't handle shared structures. Infinite loops can still be avoided if used inside a formatter that truncates data (see trimmed and fitted below).

    (scheme show) procedure (escaped (str string?) ) ⟹ formatter

    (scheme show) procedure (escaped (str string?) (quote-ch char?) ) ⟹ formatter

    (scheme show) procedure (escaped (str string?) (quote-ch char?) (esc-ch char?) ) ⟹ formatter

    (scheme show) procedure (escaped (str string?) (quote-ch char?) (esc-ch char?) (renamer procedure?) ) ⟹ formatter

    (renamer (c char?) ) ⟹ char?

    Outputs the string str, escaping any quote or escape characters. If esc-ch, which defaults to #\\, is #f, escapes only the quote-ch, which defaults to #\", by doubling it, as in SQL strings and CSV values. If renamer is provided, it should be a procedure of one character which maps that character to its escape value, e.g. #\newline => #\n, or #f if there is no escape value.

    (scheme show) procedure (maybe-escaped (str string?) (pred procedure?) ) ⟹ formatter

    (scheme show) procedure (maybe-escaped (str string?) (pred procedure?) (quote-ch char?) ) ⟹ formatter

    (scheme show) procedure (maybe-escaped (str string?) (pred procedure?) (quote-ch char?) (esc-ch char?) ) ⟹ formatter

    (scheme show) procedure (maybe-escaped (str string?) (pred procedure?) (quote-ch char?) (esc-ch char?) (renamer procedure?) ) ⟹ formatter

    (pred (c char?) ) ⟹ boolean?

    (renamer (c char?) ) ⟹ char?

    Like escaped, but first checks if any quoting is required (by the existence of either any quote or escape characters, or any character matching pred), and if so outputs the string in quotes and with escapes. Otherwise outputs the string as is. This is useful for quoting symbols and CSV output, etc.

    (scheme show) procedure (numeric (num number?) ) ⟹ formatter

    (scheme show) procedure (numeric (num number?) (radix integer?) ) ⟹ formatter

    (scheme show) procedure (numeric (num number?) (radix integer?) (precision integer?) ) ⟹ formatter

    (scheme show) procedure (numeric (num number?) (radix integer?) (precision integer?) (sign (or boolean?pair?)) ) ⟹ formatter

    (scheme show) procedure (numeric (num number?) (radix integer?) (precision integer?) (sign (or boolean?pair?)) (comma integer?) ) ⟹ formatter

    (scheme show) procedure (numeric (num number?) (radix integer?) (precision integer?) (sign (or boolean?pair?)) (comma integer?) (comma-sep char?) ) ⟹ formatter

    (scheme show) procedure (numeric (num number?) (radix integer?) (precision integer?) (sign (or boolean?pair?)) (comma integer?) (comma-sep char?) (decimal-sep char?) ) ⟹ formatter

    Formats a single number num. You can optionally specify any radix from 2 to 36 (even if num isn't an integer). precision forces a fixed-point format.

    A sign of #t indicates to output a plus sign (+) for positive integers. However, if sign is a pair of two strings, it means to wrap negative numbers with the two strings. For example, ("(" . ")") prints negative numbers in parentheses, financial style: -1.99 => (1.99).

    comma is an integer specifying the number of digits between commas.

    comma-sep is the character to use for commas, defaulting to #\,.

    decimal-sep is the character to use for decimals, defaulting to #\., or to #\, (European style) if comma-sep is already #\..

    These parameters may seem unwieldy, but they can also take their defaults from state variables

    (scheme show) procedure (numeric/comma (num number?) ) ⟹ formatter

    (scheme show) procedure (numeric/comma (num number?) (radix integer?) ) ⟹ formatter

    (scheme show) procedure (numeric/comma (num number?) (radix integer?) (precision integer?) ) ⟹ formatter

    (scheme show) procedure (numeric/comma (num number?) (radix integer?) (precision integer?) (sign (or boolean?pair?)) ) ⟹ formatter

    Shortcut for numeric to print with commas.

    (scheme show) procedure (numeric/si (num number?) ) ⟹ formatter

    (scheme show) procedure (numeric/si (num number?) (base integer?) ) ⟹ formatter

    (scheme show) procedure (numeric/si (num number?) (base integer?) (separator string?) ) ⟹ formatter

    Abbreviates num with an SI suffix as in the -h or --si option to many GNU commands. The base defaults to 1024, using suffix names like Ki, Mi, Gi, etc. Other bases (e.g. the standard 1000) have the suffixes k, M, G, etc. If separator is provided, it is inserted after the number, before any suffix.

    (scheme show) procedure (numeric/fitted (num number?) ) ⟹ formatter

    (scheme show) procedure (numeric/fitted (num number?) (radix integer?) ) ⟹ formatter

    (scheme show) procedure (numeric/fitted (num number?) (radix integer?) (precision integer?) ) ⟹ formatter

    (scheme show) procedure (numeric/fitted (num number?) (radix integer?) (precision integer?) (sign (or boolean?pair?)) ) ⟹ formatter

    (scheme show) procedure (numeric/fitted (num number?) (radix integer?) (precision integer?) (sign (or boolean?pair?)) (comma integer?) ) ⟹ formatter

    (scheme show) procedure (numeric/fitted (num number?) (radix integer?) (precision integer?) (sign (or boolean?pair?)) (comma integer?) (comma-sep char?) ) ⟹ formatter

    (scheme show) procedure (numeric/fitted (num number?) (radix integer?) (precision integer?) (sign (or boolean?pair?)) (comma integer?) (comma-sep char?) (decimal-sep char?) ) ⟹ formatter

    Like numeric, but if the result doesn't fit in width using the current precision, output instead a string of hashes rather than showing an incorrectly truncated number.

    nlformatter

    Outputs a newline.

    flformatter

    Short for "fresh line," outputs a newline only if we're not already at the start of a line.

    (scheme show) procedure (space-to (column integer?) ) ⟹ formatter

    Outputs spaces up to the given column. If the current column is already >= column, does nothing. The character used for spacing is the current value of pad-char, described below, which defaults to space. Columns are zero-based.

    (scheme show) procedure (tab-to ) ⟹ formatter

    (scheme show) procedure (tab-to (tab-width integer?) ) ⟹ formatter

    Outputs spaces up to the next tab stop, using tab stops of width tab-width, which defaults to 8. If already on a tab stop, does nothing. If you want to ensure you always tab at least one space, you can use (each " " (tab-to width)). Columns are zero-based.

    nothingformatter

    Outputs nothing (useful in combinators and as a default noop in conditionals).

    (scheme show) procedure (each (fmt formatter) ... ) ⟹ formatter

    Applies each fmt in sequence, as in the top-level of show.

    (scheme show) procedure (each-in-list (list-of-fmts list?) ) ⟹ formatter

    Equivalent to (apply each list-of-fmts) but may be more efficient.

    (scheme show) procedure (joined (mapper procedure?) (list list?) ) ⟹ formatter

    (scheme show) procedure (joined (mapper procedure?) (list list?) (separator (or string?formatter)) ) ⟹ formatter

    (mapper element ) ⟹ formatter

    Formats each element elt of list with (mapper elt), inserting sep in between. sep defaults to the empty string, but can be any format or string.

    (scheme show) procedure (joined/prefix (mapper procedure?) (list list?) ) ⟹ formatter

    (scheme show) procedure (joined/prefix (mapper procedure?) (list list?) (separator (or string?formatter)) ) ⟹ formatter

    (mapper element ) ⟹ formatter

    As joined, but inserts sep before every element.

    (scheme show) procedure (joined/suffix (mapper procedure?) (list list?) ) ⟹ formatter

    (scheme show) procedure (joined/suffix (mapper procedure?) (list list?) (separator (or string?formatter)) ) ⟹ formatter

    (mapper element ) ⟹ formatter

    As joined, but inserts sep after every element.

    (scheme show) procedure (joined/last (mapper procedure?) (last-mapper procedure?) (list list?) ) ⟹ formatter

    (scheme show) procedure (joined/last (mapper procedure?) (last-mapper procedure?) (list list?) (separator (or string?formatter)) ) ⟹ formatter

    (mapper element ) ⟹ formatter

    (last-mapper element ) ⟹ formatter

    As joined, but the last element of the list is formatted with last-mapper instead.

    (scheme show) procedure (joined/dot (mapper procedure?) (dot-mapper procedure?) (list (or list?dotted-list?)) ) ⟹ formatter

    (scheme show) procedure (joined/dot (mapper procedure?) (dot-mapper procedure?) (list (or list?dotted-list?)) (separator (or string?formatter)) ) ⟹ formatter

    (mapper element ) ⟹ formatter

    (dot-mapper tail ) ⟹ formatter

    As joined, but if the list is a dotted list, then formats the dotted value with dot-mapper instead.

    (scheme show) procedure (joined/range (mapper procedure?) (start integer?) ) ⟹ formatter

    (scheme show) procedure (joined/range (mapper procedure?) (start integer?) (end (or integer?#f)) ) ⟹ formatter

    (scheme show) procedure (joined/range (mapper procedure?) (start integer?) (end (or integer?#f)) (separator (or string?formatter)) ) ⟹ formatter

    (mapper (value integer?) ) ⟹ formatter

    As joined, but counts from start (inclusive) to end (exclusive), formatting each integer in the range with mapper. If end is #f or unspecified, produces an infinite stream of output.

    (scheme show) procedure (padded (width integer?) (fmt formatter) ... ) ⟹ formatter

    Add extra space to the left side of the output generated by the fmts to pad it to width.

    (scheme show) procedure (padded/right (width integer?) (fmt formatter) ... ) ⟹ formatter

    Add extra space to the right side of the output generated by the fmts to pad it to width.

    (scheme show) procedure (padded/both (width integer?) (fmt formatter) ... ) ⟹ formatter

    Add extra space to the both sides of the output generated by the fmts to pad it to width.

    (scheme show) procedure (trimmed (width integer?) (fmt formatter) ... ) ⟹ formatter

    Truncates the output of the fmts to force it in under width columns. As soon as any of the fmts exceeds width, stop formatting and truncate the result, returning control to whoever called trimmed. If a truncation ellipsis is set, then when any truncation occurs trimmed will prepend the ellipsis.

    (scheme show) procedure (trimmed/right (width integer?) (fmt formatter) ... ) ⟹ formatter

    Truncates the output of the fmts to force it in under width columns. As soon as any of the fmts exceeds width, stop formatting and truncate the result, returning control to whoever called trimmed. If a truncation ellipsis is set, then when any truncation occurs trimmed/right will append the ellipsis.

    (scheme show) procedure (trimmed/both (width integer?) (fmt formatter) ... ) ⟹ formatter

    Truncates the output of the fmts to force it in under width columns. As soon as any of the fmts exceeds width, stop formatting and truncate the result, returning control to whoever called trimmed. If a truncation ellipsis is set, then when any truncation occurs trimmed/bith will both prepend and append the ellipsis.

    (scheme show) procedure (trimmed/lazy (width integer?) (fmt formatter) ... ) ⟹ formatter

    A variant of trimmed which generates each fmt in left to right order, and truncates and terminates immediately if more than width characters are generated. Thus this is safe to use with an infinite amount of output, e.g. from written-simply on an infinite list.

    (scheme show) procedure (fitted (width integer?) (fmt formatter) ... ) ⟹ formatter

    A combination of padded and trimmed that ensures that the output width is exactly width, truncating if it goes over and padding if it goes under.

    (scheme show) procedure (fitted/right (width integer?) (fmt formatter) ... ) ⟹ formatter

    A combination of padded and trimmed that ensures that the output width is exactly width, truncating if it goes over and padding if it goes under.

    (scheme show) procedure (fitted/both (width integer?) (fmt formatter) ... ) ⟹ formatter

    A combination of padded and trimmed that ensures that the output width is exactly width, truncating if it goes over and padding if it goes under.

    (scheme show) procedure (columnar (column (or formatterstring?symbol?number?)) ... ) ⟹ formatter

    Formats each column side-by-side, i.e. as though each were formatted separately and then the individual lines concatenated together. The current line width (from the width state variable) is divided evenly among the columns, and all but the last column are right-padded.

    You may also prefix any column with any of the symbols 'left, 'right or 'center to control the justification. The symbol 'infinite can be used to indicate the column generates an infinite stream of output.

    You can further prefix any column with a width modifier. Any positive integer is treated as a fixed width, ignoring the available width. Any real number between 0 and 1 indicates a fraction of the available width (after subtracting out any fixed widths). Columns with unspecified width divide up the remaining width evenly. If the extra space does not divide evenly, it is allocated column-wise left to right, e.g. if the width of 78 is divided among 5 columns, the column widths become 16, 16, 16, 15, 15 in order.

    Note that columnar builds its output incrementally, interleaving calls to the generators until each has produced a line, then concatenating that line together and outputting it. This is important because as noted above, some columns may produce an infinite stream of output, and in general you may want to format data larger than can fit into memory. Thus columnar would be suitable for line numbering a file of arbitrary size, or implementing the Unix yes(1) command, etc.

    (scheme show) procedure (tabular (column (or formatterstring?symbol?number?)) ... ) ⟹ formatter

    Equivalent to columnar except that each column is padded at least to the minimum width required on any of its lines.

    This makes it easier to generate tables without knowing widths in advance. However, because it requires generating the entire output in advance to determine the correct column widths, tabular cannot format a table larger than would fit in memory.

    (scheme show) procedure (wrapped (fmt formatter) ... ) ⟹ formatter

    Behaves like each, except text is accumulated and lines are wrapped to fit in the current width as in the Unix fmt(1) command. Specifically, words are tokenized by splitting on all characters which satisfy the predicate in the parameter word-separator?, which defaults to char-whitespace?. Words are grouped into lines separating them by space, and line breaks are introduced to minimize the sum of the cube of trailing whitespace on every line.

    (scheme show) procedure (wrapped/list (list-of-strings list?) ... ) ⟹ formatter

    Like wrapped, but taking a pre-tokenized list of strings.

    (scheme show) procedure (wrapped/char (fmt formatter) ... ) ⟹ formatter

    As wrapped, but splits simply on individual characters exactly as the current width is reached on each line. Thus there is nothing to optimize and this formatter doesn't buffer output.

    (scheme show) procedure (justified (fmt formatter) ... ) ⟹ formatter

    Like wrapped except the lines are full-justified.

    (scheme show) procedure (from-file (pathname string?) ) ⟹ formatter

    Displays the contents of the file pathname one line at a time, so that in typical formatters such as columnar only constant memory is consumed, making this suitable for formatting files of arbitrary size.

    (scheme show) procedure (line-numbers ) ⟹ formatter

    (scheme show) procedure (line-numbers (start integer?) ) ⟹ formatter

    A convenience utility, just formats an infinite stream of numbers (in the current radix) beginning with start, which defaults to 1.

    (scheme show) procedure (as-red (fmt formatter) ... ) ⟹ formatter

    Outputs the formatters colored or (boldened or underline) with ANSI escapes, for use when formatting to a terminal.

    (scheme show) procedure (as-blue (fmt formatter) ... ) ⟹ formatter

    Outputs the formatters colored or (boldened or underline) with ANSI escapes, for use when formatting to a terminal.

    (scheme show) procedure (as-green (fmt formatter) ... ) ⟹ formatter

    Outputs the formatters colored or (boldened or underline) with ANSI escapes, for use when formatting to a terminal.

    (scheme show) procedure (as-cyan (fmt formatter) ... ) ⟹ formatter

    Outputs the formatters colored or (boldened or underline) with ANSI escapes, for use when formatting to a terminal.

    (scheme show) procedure (as-yellow (fmt formatter) ... ) ⟹ formatter

    Outputs the formatters colored or (boldened or underline) with ANSI escapes, for use when formatting to a terminal.

    (scheme show) procedure (as-magenta (fmt formatter) ... ) ⟹ formatter

    Outputs the formatters colored or (boldened or underline) with ANSI escapes, for use when formatting to a terminal.

    (scheme show) procedure (as-white (fmt formatter) ... ) ⟹ formatter

    Outputs the formatters colored or (boldened or underline) with ANSI escapes, for use when formatting to a terminal.

    (scheme show) procedure (as-black (fmt formatter) ... ) ⟹ formatter

    Outputs the formatters colored or (boldened or underline) with ANSI escapes, for use when formatting to a terminal.

    (scheme show) procedure (as-bold (fmt formatter) ... ) ⟹ formatter

    Outputs the formatters colored or (boldened or underline) with ANSI escapes, for use when formatting to a terminal.

    (scheme show) procedure (as-underline (fmt formatter) ... ) ⟹ formatter

    Outputs the formatters colored or (boldened or underline) with ANSI escapes, for use when formatting to a terminal.

    (scheme show) procedure (as-unicode (fmt formatter) ... ) ⟹ formatter

    Padding, trimming and tabbing, etc. will generally not do the right thing in the presence of zero-width and double-width Unicode characters. This formatter overrides the string-width state var used in column tracking to do the right thing in such cases, considering Unicode double or full width characters as 2 characters wide (as they typically are in fixed-width terminals), while treating combining and non-spacing characters as 0 characters wide.

    (scheme show) procedure (unicode-terminal-width (str string?) ) ⟹ integer?

    A utility function which returns the integer number of columns str would require in a terminal

    (scheme show) syntax (fn () ((_ (binding ...) expr ... fmt) formatter) )

    (id state-var) id

    state-var ⟹ formatter-variable

    Short for "function," this is the analog to lambda. Returns a formatter which on application evaluates each expr and fmt in left-to-right order, in a lexical environment extended with each identifier id bound to the current value of the state variable named by the symbol state-var. The result of the fmt is then applied as a formatter.

    (scheme show) syntax (with () ((_ ((state-var value) ...) fmt ...)) )

    state-var ⟹ formatter-variable

    Conceptually the formatting equivalent of parameterize, temporarily altering state variables. Applies each of the formatters fmt with each state-var bound to the corresponding value. The resulting state is then updated to restore each state-var to its original value.

    (scheme show) syntax (with! () ((_ (state-var value) ...)) )

    state-var ⟹ formatter-variable

    Similar to with but does not restore the original values, changing the value of each state-var for any remaining formatters in a sequence.

    (scheme show) procedure (forked (fmt1 formatter) (fmt2 formatter) ) ⟹ formatter

    Calls fmt1 on (a conceptual copy of) the current state, then fmt2 on the same original state as though fmt1 had not been called.

    (scheme show) procedure (call-with-output (fmt formatter) (mapper procedure?) ) ⟹ formatter

    (mapper (result-string string?) ) ⟹ formatter

    A utility, calls formatter on a copy of the current state (as with forked), accumulating the results into a string. Then calls the formatter resulting from (mapper result-string) on the original state.

    portformatter-variable

    The textual port output is written to, this can be overridden to capture intermediate output.

    rowformatter-variable

    The current row of output.

    colformatter-variable

    The current column of output, used for padding and spacing, etc.

    widthformatter-variable

    The current line width, used for wrapping, pretty-printing, and columnar formatting. The default is implementation-defined.

    outputformatter-variable

    The underlying standard formatter for writing a single string. The default value outputs the string while tracking the current row and col. This can be overridden both to capture intermediate output and perform transformations on strings before outputting, but should generally wrap the existing output to preserve expected behavior.

    writerformatter-variable

    The mapper for automatic formatting of non-string/char values in top-level show, each and other formatters. Default value is implementation-defined.

    string-widthformatter-variable

    A function of a single string, it returns the length in columns of that string, used by the default output.

    pad-charformatter-variable

    The character used by space-to, tab-to and other padding formatters.

    ellipsisformatter-variable

    The string used when truncating as described in trimmed.

    radixformatter-variable

    The radix for numeric output, defaulting to 10, as used in numeric and written.

    precisionformatter-variable

    The precision for numeric output, as described in numeric and written. The precision specifies the number of digits written after the decimal point. If the numeric value to be written out requires more digits to represent it than precision, the written representation is chosen which is closest to the numeric value and representable with the specified precision. If the numeric value falls on the midpoint of two such representations, it is implementation dependent which representation is chosen.

    When the numeric value is an inexact floating-point number, there is more than one interpretation of this "rounding". One is to take the effective value the floating-point number represents (e.g. if we use binary floating-point numbers, we take the value of (* sign mantissa (expt 2 exponent))), and compare it to the two closest numeric representations of the given precision. Another way is to obtain the default notation of the floating-point number and apply rounding to it. The former (we call it effective rounding) is consistent with most floating-point number operations, but may lead to a more non-intuitive result than the latter (we call it notational rounding). For example, 5.015 can't be represented exactly in binary floating-point numbers. With IEEE754 floating-point numbers, the floating point number closest to 5.015 is smaller than exact 5.015, i.e. (< 5.015 5015/1000) => #t. With effective rounding with precision 2, it should result in "5.01". However, users who look at the notation may be confused by "5.015" not being rounded up as they usually expect. With notational rounding the implementation chooses "5.02" (if it also adopts round-half-to-infinity or round-half-up rule). It is up to the implementation to choose which interpretation to adopt.

    decimal-sepformatter-variable

    The decimal separator for floating point output, default ".".

    decimal-alignformatter-variable

    Specifies an alignment for the decimal place when formatting numbers, and is useful for outputting tables of numbers.

    word-separator?formatter-variable

    A character predicate used to tokenize words for wrapped and justify. Defaults to char-whitespace?. More flexibility is available with wrapped/list.

    library (scheme vector base)

    (scheme vector base) procedure (make-u8vector (size integer?) ) ⟹ u8vector?

    (scheme vector base) procedure (make-u8vector (size integer?) (fill u8?) ) ⟹ u8vector?

    Returns a u8vector whose length is size. If fill is provided, all the elements of the u8vector are initialized to it.

    (scheme vector base) procedure (u8vector (value u8?) ... ) ⟹ u8vector?

    Returns a u8vector initialized with values.

    (scheme vector base) procedure (u8vector? obj ) ⟹ boolean?

    Returns #t if obj is a u8vector, and #f otherwise.

    (scheme vector base) procedure (u8vector-length (u8vec u8vector?) ) ⟹ integer?

    Returns the length of u8vec

    (scheme vector base) procedure (u8vector-ref (u8vec u8vector?) (i integer?) ) ⟹ u8?

    Returns the ith element of u8vec.

    (scheme vector base) procedure (u8vector-set! (u8vec u8vector?) (i integer?) (value u8?) ) ⟹ undefined

    Sets the ith element of u8vec to value.

    (scheme vector base) procedure (u8vector->list (u8vec u8vector?) ) ⟹ list?

    (scheme vector base) procedure (u8vector->list (u8vec u8vector?) (start integer?) ) ⟹ list?

    (scheme vector base) procedure (u8vector->list (u8vec u8vector?) (start integer?) (end integer?) ) ⟹ list?

    Returns a list with same elements as u8vec

    (scheme vector base) procedure (list->u8vector (proper-list list?) ) ⟹ u8vector?

    proper-list ⟹ (list u8?)

    Returns u8vector with same elements as list.

    (scheme vector base) procedure (u8? obj ) ⟹ boolean?

    Returns #t if obj is a valid element of an u8vector (ie., unsigned exact integer in the range 0 to (2^8)-1), and #f otherwise.

    (scheme vector base) procedure (make-s8vector (size integer?) ) ⟹ s8vector?

    (scheme vector base) procedure (make-s8vector (size integer?) (fill s8?) ) ⟹ s8vector?

    Returns a s8vector whose length is size. If fill is provided, all the elements of the s8vector are initialized to it.

    (scheme vector base) procedure (s8vector (value s8?) ... ) ⟹ s8vector?

    Returns a s8vector initialized with values.

    (scheme vector base) procedure (s8vector? obj ) ⟹ boolean?

    Returns #t if obj is a s8vector, and #f otherwise.

    (scheme vector base) procedure (s8vector-length (s8vec s8vector?) ) ⟹ integer?

    Returns the length of s8vec

    (scheme vector base) procedure (s8vector-ref (s8vec s8vector?) (i integer?) ) ⟹ s8?

    Returns the ith element of s8vec.

    (scheme vector base) procedure (s8vector-set! (s8vec s8vector?) (i integer?) (value s8?) ) ⟹ undefined

    Sets the ith element of s8vec to value.

    (scheme vector base) procedure (s8vector->list (s8vec s8vector?) ) ⟹ list?

    (scheme vector base) procedure (s8vector->list (s8vec s8vector?) (start integer?) ) ⟹ list?

    (scheme vector base) procedure (s8vector->list (s8vec s8vector?) (start integer?) (end integer?) ) ⟹ list?

    Returns a list with same elements as s8vec

    (scheme vector base) procedure (list->s8vector (proper-list list?) ) ⟹ s8vector?

    proper-list ⟹ (list s8?)

    Returns s8vector with same elements as list.

    (scheme vector base) procedure (s8? obj ) ⟹ boolean?

    Returns #t if obj is a valid element of an s8vector (ie., signed exact integer in the range -(2^7) to (2^7)-1), and #f otherwise.

    (scheme vector base) procedure (make-u16vector (size integer?) ) ⟹ u16vector?

    (scheme vector base) procedure (make-u16vector (size integer?) (fill u16?) ) ⟹ u16vector?

    Returns a u16vector whose length is size. If fill is provided, all the elements of the u16vector are initialized to it.

    (scheme vector base) procedure (u16vector (value u16?) ... ) ⟹ u16vector?

    Returns a u16vector initialized with values.

    (scheme vector base) procedure (u16vector? obj ) ⟹ boolean?

    Returns #t if obj is a u16vector, and #f otherwise.

    (scheme vector base) procedure (u16vector-length (u16vec u16vector?) ) ⟹ integer?

    Returns the length of u16vec

    (scheme vector base) procedure (u16vector-ref (u16vec u16vector?) (i integer?) ) ⟹ u16?

    Returns the ith element of u16vec.

    (scheme vector base) procedure (u16vector-set! (u16vec u16vector?) (i integer?) (value u16?) ) ⟹ undefined

    Sets the ith element of u16vec to value.

    (scheme vector base) procedure (u16vector->list (u16vec u16vector?) ) ⟹ list?

    (scheme vector base) procedure (u16vector->list (u16vec u16vector?) (start integer?) ) ⟹ list?

    (scheme vector base) procedure (u16vector->list (u16vec u16vector?) (start integer?) (end integer?) ) ⟹ list?

    Returns a list with same elements as u16vec

    (scheme vector base) procedure (list->u16vector (proper-list list?) ) ⟹ u16vector?

    proper-list ⟹ (list u16?)

    Returns u16vector with same elements as list.

    (scheme vector base) procedure (u16? obj ) ⟹ boolean?

    Returns #t if obj is a valid element of an u16vector (ie., unsigned exact integer in the range 0 to (2^16)-1), and #f otherwise.

    (scheme vector base) procedure (make-s16vector (size integer?) ) ⟹ s16vector?

    (scheme vector base) procedure (make-s16vector (size integer?) (fill s16?) ) ⟹ s16vector?

    Returns a s16vector whose length is size. If fill is provided, all the elements of the s16vector are initialized to it.

    (scheme vector base) procedure (s16vector (value s16?) ... ) ⟹ s16vector?

    Returns a s16vector initialized with values.

    (scheme vector base) procedure (s16vector? obj ) ⟹ boolean?

    Returns #t if obj is a s16vector, and #f otherwise.

    (scheme vector base) procedure (s16vector-length (s16vec s16vector?) ) ⟹ integer?

    Returns the length of s16vec

    (scheme vector base) procedure (s16vector-ref (s16vec s16vector?) (i integer?) ) ⟹ s16?

    Returns the ith element of s16vec.

    (scheme vector base) procedure (s16vector-set! (s16vec s16vector?) (i integer?) (value s16?) ) ⟹ undefined

    Sets the ith element of s16vec to value.

    (scheme vector base) procedure (s16vector->list (s16vec s16vector?) ) ⟹ list?

    (scheme vector base) procedure (s16vector->list (s16vec s16vector?) (start integer?) ) ⟹ list?

    (scheme vector base) procedure (s16vector->list (s16vec s16vector?) (start integer?) (end integer?) ) ⟹ list?

    Returns a list with same elements as s16vec

    (scheme vector base) procedure (list->s16vector (proper-list list?) ) ⟹ s16vector?

    proper-list ⟹ (list s16?)

    Returns s16vector with same elements as list.

    (scheme vector base) procedure (s16? obj ) ⟹ boolean?

    Returns #t if obj is a valid element of an s16vector (ie., signed exact integer in the range -(2^15) to (2^15)-1), and #f otherwise.

    (scheme vector base) procedure (make-u32vector (size integer?) ) ⟹ u32vector?

    (scheme vector base) procedure (make-u32vector (size integer?) (fill u32?) ) ⟹ u32vector?

    Returns a u32vector whose length is size. If fill is provided, all the elements of the u32vector are initialized to it.

    (scheme vector base) procedure (u32vector (value u32?) ... ) ⟹ u32vector?

    Returns a u32vector initialized with values.

    (scheme vector base) procedure (u32vector? obj ) ⟹ boolean?

    Returns #t if obj is a u32vector, and #f otherwise.

    (scheme vector base) procedure (u32vector-length (u32vec u32vector?) ) ⟹ integer?

    Returns the length of u32vec

    (scheme vector base) procedure (u32vector-ref (u32vec u32vector?) (i integer?) ) ⟹ u32?

    Returns the ith element of u32vec.

    (scheme vector base) procedure (u32vector-set! (u32vec u32vector?) (i integer?) (value u32?) ) ⟹ undefined

    Sets the ith element of u32vec to value.

    (scheme vector base) procedure (u32vector->list (u32vec u32vector?) ) ⟹ list?

    (scheme vector base) procedure (u32vector->list (u32vec u32vector?) (start integer?) ) ⟹ list?

    (scheme vector base) procedure (u32vector->list (u32vec u32vector?) (start integer?) (end integer?) ) ⟹ list?

    Returns a list with same elements as u32vec

    (scheme vector base) procedure (list->u32vector (proper-list list?) ) ⟹ u32vector?

    proper-list ⟹ (list u32?)

    Returns u32vector with same elements as list.

    (scheme vector base) procedure (u32? obj ) ⟹ boolean?

    Returns #t if obj is a valid element of an u32vector (ie., unsigned exact integer in the range 0 to (2^32)-1), and #f otherwise.

    (scheme vector base) procedure (make-s32vector (size integer?) ) ⟹ s32vector?

    (scheme vector base) procedure (make-s32vector (size integer?) (fill s32?) ) ⟹ s32vector?

    Returns a s32vector whose length is size. If fill is provided, all the elements of the s32vector are initialized to it.

    (scheme vector base) procedure (s32vector (value s32?) ... ) ⟹ s32vector?

    Returns a s32vector initialized with values.

    (scheme vector base) procedure (s32vector? obj ) ⟹ boolean?

    Returns #t if obj is a s32vector, and #f otherwise.

    (scheme vector base) procedure (s32vector-length (s32vec s32vector?) ) ⟹ integer?

    Returns the length of s32vec

    (scheme vector base) procedure (s32vector-ref (s32vec s32vector?) (i integer?) ) ⟹ s32?

    Returns the ith element of s32vec.

    (scheme vector base) procedure (s32vector-set! (s32vec s32vector?) (i integer?) (value s32?) ) ⟹ undefined

    Sets the ith element of s32vec to value.

    (scheme vector base) procedure (s32vector->list (s32vec s32vector?) ) ⟹ list?

    (scheme vector base) procedure (s32vector->list (s32vec s32vector?) (start integer?) ) ⟹ list?

    (scheme vector base) procedure (s32vector->list (s32vec s32vector?) (start integer?) (end integer?) ) ⟹ list?

    Returns a list with same elements as s32vec

    (scheme vector base) procedure (list->s32vector (proper-list list?) ) ⟹ s32vector?

    proper-list ⟹ (list s32?)

    Returns s32vector with same elements as list.

    (scheme vector base) procedure (s32? obj ) ⟹ boolean?

    Returns #t if obj is a valid element of an s32vector (ie., signed exact integer in the range -(2^31) to (2^31)-1), and #f otherwise.

    (scheme vector base) procedure (make-u64vector (size integer?) ) ⟹ u64vector?

    (scheme vector base) procedure (make-u64vector (size integer?) (fill u64?) ) ⟹ u64vector?

    Returns a u64vector whose length is size. If fill is provided, all the elements of the u64vector are initialized to it.

    (scheme vector base) procedure (u64vector (value u64?) ... ) ⟹ u64vector?

    Returns a u64vector initialized with values.

    (scheme vector base) procedure (u64vector? obj ) ⟹ boolean?

    Returns #t if obj is a u64vector, and #f otherwise.

    (scheme vector base) procedure (u64vector-length (u64vec u64vector?) ) ⟹ integer?

    Returns the length of u64vec

    (scheme vector base) procedure (u64vector-ref (u64vec u64vector?) (i integer?) ) ⟹ u64?

    Returns the ith element of u64vec.

    (scheme vector base) procedure (u64vector-set! (u64vec u64vector?) (i integer?) (value u64?) ) ⟹ undefined

    Sets the ith element of u64vec to value.

    (scheme vector base) procedure (u64vector->list (u64vec u64vector?) ) ⟹ list?

    (scheme vector base) procedure (u64vector->list (u64vec u64vector?) (start integer?) ) ⟹ list?

    (scheme vector base) procedure (u64vector->list (u64vec u64vector?) (start integer?) (end integer?) ) ⟹ list?

    Returns a list with same elements as u64vec

    (scheme vector base) procedure (list->u64vector (proper-list list?) ) ⟹ u64vector?

    proper-list ⟹ (list u64?)

    Returns u64vector with same elements as list.

    (scheme vector base) procedure (u64? obj ) ⟹ boolean?

    Returns #t if obj is a valid element of an u64vector (ie., unsigned exact integer in the range 0 to (2^64)-1), and #f otherwise.

    (scheme vector base) procedure (make-s64vector (size integer?) ) ⟹ s64vector?

    (scheme vector base) procedure (make-s64vector (size integer?) (fill s64?) ) ⟹ s64vector?

    Returns a s64vector whose length is size. If fill is provided, all the elements of the s64vector are initialized to it.

    (scheme vector base) procedure (s64vector (value s64?) ... ) ⟹ s64vector?

    Returns a s64vector initialized with values.

    (scheme vector base) procedure (s64vector? obj ) ⟹ boolean?

    Returns #t if obj is a s64vector, and #f otherwise.

    (scheme vector base) procedure (s64vector-length (s64vec s64vector?) ) ⟹ integer?

    Returns the length of s64vec

    (scheme vector base) procedure (s64vector-ref (s64vec s64vector?) (i integer?) ) ⟹ s64?

    Returns the ith element of s64vec.

    (scheme vector base) procedure (s64vector-set! (s64vec s64vector?) (i integer?) (value s64?) ) ⟹ undefined

    Sets the ith element of s64vec to value.

    (scheme vector base) procedure (s64vector->list (s64vec s64vector?) ) ⟹ list?

    (scheme vector base) procedure (s64vector->list (s64vec s64vector?) (start integer?) ) ⟹ list?

    (scheme vector base) procedure (s64vector->list (s64vec s64vector?) (start integer?) (end integer?) ) ⟹ list?

    Returns a list with same elements as s64vec

    (scheme vector base) procedure (list->s64vector (proper-list list?) ) ⟹ s64vector?

    proper-list ⟹ (list s64?)

    Returns s64vector with same elements as list.

    (scheme vector base) procedure (s64? obj ) ⟹ boolean?

    Returns #t if obj is a valid element of an s64vector (ie., signed exact integer in the range -(2^63) to (2^63)-1), and #f otherwise.

    (scheme vector base) procedure (make-f32vector (size integer?) ) ⟹ f32vector?

    (scheme vector base) procedure (make-f32vector (size integer?) (fill f32?) ) ⟹ f32vector?

    Returns a f32vector whose length is size. If fill is provided, all the elements of the f32vector are initialized to it.

    (scheme vector base) procedure (f32vector (value f32?) ... ) ⟹ f32vector?

    Returns a f32vector initialized with values.

    (scheme vector base) procedure (f32vector? obj ) ⟹ boolean?

    Returns #t if obj is a f32vector, and #f otherwise.

    (scheme vector base) procedure (f32vector-length (f32vec f32vector?) ) ⟹ integer?

    Returns the length of f32vec

    (scheme vector base) procedure (f32vector-ref (f32vec f32vector?) (i integer?) ) ⟹ f32?

    Returns the ith element of f32vec.

    (scheme vector base) procedure (f32vector-set! (f32vec f32vector?) (i integer?) (value f32?) ) ⟹ undefined

    Sets the ith element of f32vec to value.

    (scheme vector base) procedure (f32vector->list (f32vec f32vector?) ) ⟹ list?

    (scheme vector base) procedure (f32vector->list (f32vec f32vector?) (start integer?) ) ⟹ list?

    (scheme vector base) procedure (f32vector->list (f32vec f32vector?) (start integer?) (end integer?) ) ⟹ list?

    Returns a list with same elements as f32vec

    (scheme vector base) procedure (list->f32vector (proper-list list?) ) ⟹ f32vector?

    proper-list ⟹ (list f32?)

    Returns f32vector with same elements as list.

    (scheme vector base) procedure (f32? obj ) ⟹ boolean?

    Returns #t if obj is a valid element of an f32vector (ie., inexact real), and #f otherwise.

    (scheme vector base) procedure (make-f64vector (size integer?) ) ⟹ f64vector?

    (scheme vector base) procedure (make-f64vector (size integer?) (fill f64?) ) ⟹ f64vector?

    Returns a f64vector whose length is size. If fill is provided, all the elements of the f64vector are initialized to it.

    (scheme vector base) procedure (f64vector (value f64?) ... ) ⟹ f64vector?

    Returns a f64vector initialized with values.

    (scheme vector base) procedure (f64vector? obj ) ⟹ boolean?

    Returns #t if obj is a f64vector, and #f otherwise.

    (scheme vector base) procedure (f64vector-length (f64vec f64vector?) ) ⟹ integer?

    Returns the length of f64vec

    (scheme vector base) procedure (f64vector-ref (f64vec f64vector?) (i integer?) ) ⟹ f64?

    Returns the ith element of f64vec.

    (scheme vector base) procedure (f64vector-set! (f64vec f64vector?) (i integer?) (value f64?) ) ⟹ undefined

    Sets the ith element of f64vec to value.

    (scheme vector base) procedure (f64vector->list (f64vec f64vector?) ) ⟹ list?

    (scheme vector base) procedure (f64vector->list (f64vec f64vector?) (start integer?) ) ⟹ list?

    (scheme vector base) procedure (f64vector->list (f64vec f64vector?) (start integer?) (end integer?) ) ⟹ list?

    Returns a list with same elements as f64vec

    (scheme vector base) procedure (list->f64vector (proper-list list?) ) ⟹ f64vector?

    proper-list ⟹ (list f64?)

    Returns f64vector with same elements as list.

    (scheme vector base) procedure (f64? obj ) ⟹ boolean?

    Returns #t if obj is a valid element of an f64vector (ie., inexact real), and #f otherwise.

    (scheme vector base) procedure (make-c64vector (size integer?) ) ⟹ c64vector?

    (scheme vector base) procedure (make-c64vector (size integer?) (fill c64?) ) ⟹ c64vector?

    Returns a c64vector whose length is size. If fill is provided, all the elements of the c64vector are initialized to it.

    (scheme vector base) procedure (c64vector (value c64?) ... ) ⟹ c64vector?

    Returns a c64vector initialized with values.

    (scheme vector base) procedure (c64vector? obj ) ⟹ boolean?

    Returns #t if obj is a c64vector, and #f otherwise.

    (scheme vector base) procedure (c64vector-length (c64vec c64vector?) ) ⟹ integer?

    Returns the length of c64vec

    (scheme vector base) procedure (c64vector-ref (c64vec c64vector?) (i integer?) ) ⟹ c64?

    Returns the ith element of c64vec.

    (scheme vector base) procedure (c64vector-set! (c64vec c64vector?) (i integer?) (value c64?) ) ⟹ undefined

    Sets the ith element of c64vec to value.

    (scheme vector base) procedure (c64vector->list (c64vec c64vector?) ) ⟹ list?

    (scheme vector base) procedure (c64vector->list (c64vec c64vector?) (start integer?) ) ⟹ list?

    (scheme vector base) procedure (c64vector->list (c64vec c64vector?) (start integer?) (end integer?) ) ⟹ list?

    Returns a list with same elements as c64vec

    (scheme vector base) procedure (list->c64vector (proper-list list?) ) ⟹ c64vector?

    proper-list ⟹ (list c64?)

    Returns c64vector with same elements as list.

    (scheme vector base) procedure (c64? obj ) ⟹ boolean?

    Returns #t if obj is a valid element of an c64vector (ie., inexact complex), and #f otherwise.

    (scheme vector base) procedure (make-c128vector (size integer?) ) ⟹ c128vector?

    (scheme vector base) procedure (make-c128vector (size integer?) (fill c128?) ) ⟹ c128vector?

    Returns a c128vector whose length is size. If fill is provided, all the elements of the c128vector are initialized to it.

    (scheme vector base) procedure (c128vector (value c128?) ... ) ⟹ c128vector?

    Returns a c128vector initialized with values.

    (scheme vector base) procedure (c128vector? obj ) ⟹ boolean?

    Returns #t if obj is a c128vector, and #f otherwise.

    (scheme vector base) procedure (c128vector-length (c128vec c128vector?) ) ⟹ integer?

    Returns the length of c128vec

    (scheme vector base) procedure (c128vector-ref (c128vec c128vector?) (i integer?) ) ⟹ c128?

    Returns the ith element of c128vec.

    (scheme vector base) procedure (c128vector-set! (c128vec c128vector?) (i integer?) (value c128?) ) ⟹ undefined

    Sets the ith element of c128vec to value.

    (scheme vector base) procedure (c128vector->list (c128vec c128vector?) ) ⟹ list?

    (scheme vector base) procedure (c128vector->list (c128vec c128vector?) (start integer?) ) ⟹ list?

    (scheme vector base) procedure (c128vector->list (c128vec c128vector?) (start integer?) (end integer?) ) ⟹ list?

    Returns a list with same elements as c128vec

    (scheme vector base) procedure (list->c128vector (proper-list list?) ) ⟹ c128vector?

    proper-list ⟹ (list c128?)

    Returns c128vector with same elements as list.

    (scheme vector base) procedure (c128? obj ) ⟹ boolean?

    Returns #t if obj is a valid element of an c128vector (ie., inexact complex), and #f otherwise.

    library (scheme vector u8)

    (scheme vector u8) procedure (make-u8vector (size integer?) ) ⟹ u8vector?

    (scheme vector u8) procedure (make-u8vector (size integer?) (fill u8?) ) ⟹ u8vector?

    Returns a u8vector whose length is size. If fill is provided, all the elements of the u8vector are initialized to it.

    (scheme vector u8) procedure (u8vector (value u8?) ... ) ⟹ u8vector?

    Returns a u8vector initialized with values.

    (scheme vector u8) procedure (u8vector? obj ) ⟹ boolean?

    Returns #t if obj is a u8vector, and #f otherwise.

    (scheme vector u8) procedure (u8vector-length (u8vec u8vector?) ) ⟹ integer?

    Returns the length of u8vec

    (scheme vector u8) procedure (u8vector-ref (u8vec u8vector?) (i integer?) ) ⟹ u8?

    Returns the ith element of u8vec.

    (scheme vector u8) procedure (u8vector-set! (u8vec u8vector?) (i integer?) (value u8?) ) ⟹ undefined

    Sets the ith element of u8vec to value.

    (scheme vector u8) procedure (u8vector->list (u8vec u8vector?) ) ⟹ list?

    (scheme vector u8) procedure (u8vector->list (u8vec u8vector?) (start integer?) ) ⟹ list?

    (scheme vector u8) procedure (u8vector->list (u8vec u8vector?) (start integer?) (end integer?) ) ⟹ list?

    Returns a list with same elements as u8vec

    (scheme vector u8) procedure (list->u8vector (proper-list list?) ) ⟹ u8vector?

    proper-list ⟹ (list u8?)

    Returns u8vector with same elements as list.

    (scheme vector u8) procedure (u8? obj ) ⟹ boolean?

    Returns #t if obj is a valid element of an u8vector (ie., unsigned exact integer in the range 0 to (2^8)-1), and #f otherwise.

    (scheme vector u8) procedure (u8vector-unfold (f procedure?) (length integer?) seed ) ⟹ u8vector?

    (scheme vector u8) procedure (u8vector-unfold (f procedure?) (length integer?) seed ) ⟹ u8vector?

    (f (index integer?) state ) ⟹ (values u8?*)

    Creates a vector whose length is length and iterates across each index k between 0 and length - 1, applying f at each iteration to the current index and current state, in that order, to receive two values: the element to put in the kth slot of the new vector and a new state for the next iteration. On the first call to f, the state's value is seed.

    (scheme vector u8) procedure (u8vector-copy (u8vec u8vector?) ) ⟹ u8vector?

    (scheme vector u8) procedure (u8vector-copy (u8vec u8vector?) (start integer?) ) ⟹ u8vector?

    (scheme vector u8) procedure (u8vector-copy (u8vec u8vector?) (start integer?) (end integer?) ) ⟹ u8vector?

    Makes a copy of the portion of u8vec from start to end and returns it.

    (scheme vector u8) procedure (u8vector-reverse-copy (u8vec u8vector?) ) ⟹ u8vector?

    (scheme vector u8) procedure (u8vector-reverse-copy (u8vec u8vector?) (start integer?) ) ⟹ u8vector?

    (scheme vector u8) procedure (u8vector-reverse-copy (u8vec u8vector?) (start integer?) (end integer?) ) ⟹ u8vector?

    The same as u8vector-copy, but in reverse order.

    (scheme vector u8) procedure (u8vector-append (u8vec u8vector?) ... ) ⟹ u8vector?

    Returns a u8vector containing all the elements of the u8vecs in order.

    (scheme vector u8) procedure (u8vector-concatenate (list-of-u8vectors list?) ) ⟹ u8vector?

    list-of-u8vectors ⟹ (list u8vector?)

    The same as u8vector-append, but takes a list of u8vectors rather than multiple arguments.

    (scheme vector u8) procedure (u8vector-append-subvectors (u8vec1 u8vector?) (start1 integer?) (end1 integer?) ... ) ⟹ u8vector?

    Concatenates the result of applying u8vector-copy to each triplet of u8vec, start, end arguments, but may be implemented more efficiently.

    (scheme vector u8) procedure (u8vector-empty? (u8vec u8vector?) ) ⟹ boolean?

    Returns #t if u8vec has a length of zero, and #f otherwise.

    (scheme vector u8) procedure (u8vector= (u8vec u8vector?) ... ) ⟹ boolean?

    Compares the u8vecs for elementwise equality, using = to do the comparisons. Returns #f unless all u8vectors are the same length.

    (scheme vector u8) procedure (u8vector-take (u8vec u8vector?) (n integer?) ) ⟹ u8vector?

    (scheme vector u8) procedure (u8vector-take-right (u8vec u8vector?) (n integer?) ) ⟹ u8vector?

    Returns a u8vector containing the first/last n elements of u8vec.

    (scheme vector u8) procedure (u8vector-drop (u8vec u8vector?) (n integer?) ) ⟹ u8vector?

    (scheme vector u8) procedure (u8vector-drop-right (u8vec u8vector?) (n integer?) ) ⟹ u8vector?

    Returns a u8vector containing all except the first/last n elements of u8vec.

    (scheme vector u8) procedure (u8vector-segment (u8vec u8vector?) (n integer?) ) ⟹ list?

    Returns a list of u8vectors, each of which contains n consecutive elements of u8vec. The last u8vector may be shorter than n. It is an error if n is not an exact positive integer.

    (scheme vector u8) procedure (u8vector-fold (kons procedure?) knil (u8vec1 u8vector?) (u8vec2 u8vector?) ... ) ⟹ *

    (kons state (obj1 u8?) (obj2 u8?) ... ) ⟹ *

    (scheme vector u8) procedure (u8vector-fold-right (kons procedure?) knil (u8vec1 u8vector?) (u8vec2 u8vector?) ... ) ⟹ *

    (kons state (obj1 u8?) (obj2 u8?) ... ) ⟹ *

    When one u8vector argument u8vec is given, folds kons over the elements of u8vec in increasing/decreasing order using knil as the initial value. The kons procedure is called with the state first and the element second, as in SRFIs 43 and 133 (heterogeneous vectors). This is the opposite order to that used in SRFI 1 (lists) and the various string SRFIs.

    When multiple u8vector arguments are given, kons is called with the current state value and each value from all the vectors; u8vector-fold scans elements from left to right, while u8vector-fold-right does from right to left. If the lengths of vectors differ, only the portion of each vector up to the length of the shortest vector is scanned.

    (scheme vector u8) procedure (u8vector-map (proc procedure?) (u8vec1 u8vector?) (u8vec2 u8vector?) ... ) ⟹ vector?

    (proc (val1 u8?) ... ) ⟹ *

    (scheme vector u8) procedure (u8vector-map! (proc procedure?) (u8vec1 u8vector?) (u8vec2 u8vector?) ... ) ⟹ undefined

    (proc (val1 u8?) ... ) ⟹ *

    (scheme vector u8) procedure (u8vector-for-each (proc procedure?) (u8vec1 u8vector?) (u8vec2 u8vector?) ... ) ⟹ undefined

    (proc (val1 u8?) ... ) ⟹ undefined

    Iterate over the elements of u8vec and apply f to each, returning respectively a u8vector of the results, an undefined value with the results placed back in u8vec, and an undefined value with no change to u8vec.

    If more than one vector is passed, f gets one element from each vector as arguments. If the lengths of the vectors differ, iteration stops at the end of the shortest vector. For u8vector-map!, only u8vec is modified even when multiple vectors are passed.

    If u8vector-map or u8vector-map! returns more than once (i.e. because of a continuation captured by f), the values returned or stored by earlier returns may be mutated.

    (scheme vector u8) procedure (u8vector-count (pred? procedure?) (u8vec1 u8vector?) (u8vec2 u8vector?) ... ) ⟹ integer?

    (pred? (val1 u8?) (val2 u8?) ... ) ⟹ *

    Call pred? on each element of u8vec and return the number of calls that return true.

    When multiple vectors are given, pred? must take the same number of arguments as the number of vectors, and corresponding elements from each vector are given for each iteration, which stops at the end of the shortest vector.

    (scheme vector u8) procedure (u8vector-cumulate (f procedure?) knil (u8vec u8vector?) ) ⟹ u8vector?

    (f state (value u8?) ) ⟹ *

    Like u8vector-fold, but returns an u8vector of partial results rather than just the final result.

    (scheme vector u8) procedure (u8vector-take-while (pred? procedure?) (u8vec u8vector?) ) ⟹ u8vector?

    (pred? (value u8?) ) ⟹ boolean?

    (scheme vector u8) procedure (u8vector-take-while-right (pred? procedure?) (u8vec u8vector?) ) ⟹ u8vector?

    (pred? (value u8?) ) ⟹ boolean?

    Return the shortest prefix/suffix of u8vec all of whose elements satisfy pred?.

    (scheme vector u8) procedure (u8vector-drop-while (pred? procedure?) (u8vec u8vector?) ) ⟹ u8vector?

    (pred? (value u8?) ) ⟹ boolean?

    (scheme vector u8) procedure (u8vector-drop-while-right (pred? procedure?) (u8vec u8vector?) ) ⟹ u8vector?

    (pred? (value u8?) ) ⟹ boolean?

    Drops the longest initial prefix/suffix of u8vec such that all its elements satisfy pred.

    (scheme vector u8) procedure (u8vector-index (pred? procedure?) (u8vec1 u8vector?) (u8vec2 u8vector?) ... ) ⟹ integer? / #f /

    (pred? (value1 u8?) (value2 u8?) ... ) ⟹ *

    (scheme vector u8) procedure (u8vector-index-right (pred? procedure?) (u8vec1 u8vector?) (u8vec2 u8vector?) ... ) ⟹ integer? / #f /

    (pred? (value1 u8?) (value2 u8?) ... ) ⟹ *

    Return the index of the first/last element of u8vec that satisfies pred?.

    When multiple vectors are passed, pred? must take the same number of arguments as the number of vectors, and corresponding elements from each vector are passed for each iteration. If the lengths of vectors differ, u8vector-index stops iteration at the end of the shortest one. Lengths of vectors must be the same for u8vector-index-right.

    (scheme vector u8) procedure (u8vector-skip (pred? procedure?) (u8vec1 u8vector?) (u8vec2 u8vector?) ... ) ⟹ integer? / #f /

    (pred? (value1 u8?) (value2 u8?) ... ) ⟹ *

    (scheme vector u8) procedure (u8vector-skip-right (pred? procedure?) (u8vec1 u8vector?) (u8vec2 u8vector?) ... ) ⟹ integer? / #f /

    (pred? (value1 u8?) (value2 u8?) ... ) ⟹ *

    Returns the index of the first/last element of u8vec that does not satisfy pred?.

    When multiple vectors are passed, pred? must take the same number of arguments as the number of vectors, and corresponding elements from each vector are passed for each iteration. If the lengths of vectors differ, u8vector-skip stops iteration at the end of the shortest one. Lengths of vectors must be the same for u8vector-skip-right.

    (scheme vector u8) procedure (u8vector-any (pred? procedure?) (u8vec1 u8vector?) (u8vec2 u8vector?) ... ) ⟹ *

    (pred? (val1 u8?) (val2 u8?) ... ) ⟹ *

    Returns first non-false result of applying pred? on a element from the u8vec, or #f if there is no such element. If u8vec is empty, returns #t

    When multiple vectors are passed, pred? must take the same number of arguments as the number of vectors, and corresponding elements from each vector are passed for each iteration. If the lengths of vectors differ, it stops at the end of the shortest one.

    (scheme vector u8) procedure (u8vector-every (pred? procedure?) (u8vec1 u8vector?) (u8vec2 u8vector?) ... ) ⟹ *

    (pred? (val1 u8?) (val2 u8?) ... ) ⟹ *

    If all elements from u8vec satisfy pred?, return the last result of pred?. If not all do, return #f. If u8vec is empty, return #t

    When multiple vectors are passed, pred? must take the same number of arguments as the number of vectors, and corresponding elements from each vector is passed for each iteration. If the lengths of vectors differ, it stops at the end of the shortest one.

    (scheme vector u8) procedure (u8vector-partition (pred? procedure?) (u8vec u8vector?) ) ⟹ (values u8vector?integer?)

    (pred? (value u8?) ) ⟹ boolean?

    Returns an u8vector of the same type as u8vec, but with all elements satisfying pred? in the leftmost part of the vector and the other elements in the remaining part. The order of elements is otherwise preserved. Returns two values, the new u8vector and the number of elements satisfying pred?.

    (scheme vector u8) procedure (u8vector-filter (pred? procedure?) (u8vec1 u8vector?) ) ⟹ u8vector?

    (pred? (val u8?) ) ⟹ boolean?

    (scheme vector u8) procedure (u8vector-remove (pred? procedure?) (u8vec1 u8vector?) ) ⟹ u8vector?

    (pred? (val u8?) ) ⟹ boolean?

    Return an u8vector containing the elements of u8vec that satisfy / do not satisfy pred?.

    (scheme vector u8) procedure (u8vector-swap! (u8vec u8vector?) (i integer?) (j integer?) ) ⟹ undefined

    Interchanges the ith and jth elements of u8vec.

    (scheme vector u8) procedure (u8vector-fill! (u8vec u8vector?) (fill u8?) ) ⟹ undefined

    (scheme vector u8) procedure (u8vector-fill! (u8vec u8vector?) (fill u8?) (start integer?) ) ⟹ undefined

    (scheme vector u8) procedure (u8vector-fill! (u8vec u8vector?) (fill u8?) (start integer?) (end integer?) ) ⟹ undefined

    Fills the portion of u8vec from start to end with the value fill.

    (scheme vector u8) procedure (u8vector-reverse! (u8vec u8vector?) ) ⟹ undefined

    (scheme vector u8) procedure (u8vector-reverse! (u8vec u8vector?) (start integer?) ) ⟹ undefined

    (scheme vector u8) procedure (u8vector-reverse! (u8vec u8vector?) (start integer?) (end integer?) ) ⟹ undefined

    Reverses the portion of u8vec from start to end.

    (scheme vector u8) procedure (u8vector-copy! (u8to u8vector?) (at integer?) (u8from u8vector?) ) ⟹ undefined

    (scheme vector u8) procedure (u8vector-copy! (u8to u8vector?) (at integer?) (u8from u8vector?) (start integer?) ) ⟹ undefined

    (scheme vector u8) procedure (u8vector-copy! (u8to u8vector?) (at integer?) (u8from u8vector?) (start integer?) (end integer?) ) ⟹ undefined

    Copies the portion of u8from from start to end onto u8to, starting at index at.

    (scheme vector u8) procedure (u8vector-reverse-copy! (u8to u8vector?) (at integer?) (u8from u8vector?) ) ⟹ undefined

    (scheme vector u8) procedure (u8vector-reverse-copy! (u8to u8vector?) (at integer?) (u8from u8vector?) (start integer?) ) ⟹ undefined

    (scheme vector u8) procedure (u8vector-reverse-copy! (u8to u8vector?) (at integer?) (u8from u8vector?) (start integer?) (end integer?) ) ⟹ undefined

    The same as u8vector-copy!, but copies in reverse

    (scheme vector u8) procedure (u8vector-unfold! (f procedure?) (u8vec u8vector?) (start integer?) (end integer?) initial-seed ... ) ⟹ undefined

    (f (index integer?) seed ... ) ⟹ (values **...)

    Like u8vector-unfold, but the elements are copied into the vector u8vec starting at element start rather than into a newly allocated vector. Terminates when end - start elements have been generated.

    (scheme vector u8) procedure (u8vector-unfold-right! (f procedure?) (u8vec u8vector?) (start integer?) (end integer?) initial-seed ... ) ⟹ undefined

    (f (index integer?) seed ... ) ⟹ (values **...)

    The same as u8vector-unfold!, but initializes the u8vector from right to left.

    (scheme vector u8) procedure (reverse-u8vector->list (u8vec u8vector?) ) ⟹ list?

    (scheme vector u8) procedure (reverse-u8vector->list (u8vec u8vector?) (start integer?) ) ⟹ list?

    (scheme vector u8) procedure (reverse-u8vector->list (u8vec u8vector?) (start integer?) (end integer?) ) ⟹ list?

    Returns a list with same elements as u8vec in reverse order.

    (scheme vector u8) procedure (reverse-list->u8vector (proper-list list?) ) ⟹ u8vector?

    Returns u8vector with same elements as list in reverse order.

    (scheme vector u8) procedure (u8vector->vector (u8vec u8vector?) ) ⟹ vector?

    (scheme vector u8) procedure (u8vector->vector (u8vec u8vector?) (start integer?) ) ⟹ vector?

    (scheme vector u8) procedure (u8vector->vector (u8vec u8vector?) (start integer?) (end integer?) ) ⟹ vector?

    Returns vector with same elements as u8vec.

    (scheme vector u8) procedure (vector->u8vector (vec vector?) ) ⟹ u8vector?

    (scheme vector u8) procedure (vector->u8vector (vec vector?) (start integer?) ) ⟹ u8vector?

    (scheme vector u8) procedure (vector->u8vector (vec vector?) (start integer?) (end integer?) ) ⟹ u8vector?

    Returns u8vector with same elements as vec.

    (scheme vector u8) procedure (make-u8vector-generator (u8vector u8vector?) ) ⟹ procedure?

    (return ) ⟹ eof-object? / u8? /

    Returns a SRFI 121 generator that generates all the values of u8vector in order. Note that the generator is finite.

    u8vector-comparatorcomparator?

    Variable containing a SRFI 128 comparator whose components provide ordering and hashing of u8vector.

    (scheme vector u8) procedure (write-u8vector (u8vec u8vector) ) ⟹ undefined

    (scheme vector u8) procedure (write-u8vector (u8vec u8vector) (port output-port?) ) ⟹ undefined

    Prints to port (the current output port by default) a representation of u8vec in the lexical syntax explained below.

    library (scheme vector s8)

    (scheme vector s8) procedure (make-s8vector (size integer?) ) ⟹ s8vector?

    (scheme vector s8) procedure (make-s8vector (size integer?) (fill s8?) ) ⟹ s8vector?

    Returns a s8vector whose length is size. If fill is provided, all the elements of the s8vector are initialized to it.

    (scheme vector s8) procedure (s8vector (value s8?) ... ) ⟹ s8vector?

    Returns a s8vector initialized with values.

    (scheme vector s8) procedure (s8vector? obj ) ⟹ boolean?

    Returns #t if obj is a s8vector, and #f otherwise.

    (scheme vector s8) procedure (s8vector-length (s8vec s8vector?) ) ⟹ integer?

    Returns the length of s8vec

    (scheme vector s8) procedure (s8vector-ref (s8vec s8vector?) (i integer?) ) ⟹ s8?

    Returns the ith element of s8vec.

    (scheme vector s8) procedure (s8vector-set! (s8vec s8vector?) (i integer?) (value s8?) ) ⟹ undefined

    Sets the ith element of s8vec to value.

    (scheme vector s8) procedure (s8vector->list (s8vec s8vector?) ) ⟹ list?

    (scheme vector s8) procedure (s8vector->list (s8vec s8vector?) (start integer?) ) ⟹ list?

    (scheme vector s8) procedure (s8vector->list (s8vec s8vector?) (start integer?) (end integer?) ) ⟹ list?

    Returns a list with same elements as s8vec

    (scheme vector s8) procedure (list->s8vector (proper-list list?) ) ⟹ s8vector?

    proper-list ⟹ (list s8?)

    Returns s8vector with same elements as list.

    (scheme vector s8) procedure (s8? obj ) ⟹ boolean?

    Returns #t if obj is a valid element of an s8vector (ie., signed exact integer in the range -(2^7) to (2^7)-1), and #f otherwise.

    (scheme vector s8) procedure (s8vector-unfold (f procedure?) (length integer?) seed ) ⟹ s8vector?

    (scheme vector s8) procedure (s8vector-unfold (f procedure?) (length integer?) seed ) ⟹ s8vector?

    (f (index integer?) state ) ⟹ (values s8?*)

    Creates a vector whose length is length and iterates across each index k between 0 and length - 1, applying f at each iteration to the current index and current state, in that order, to receive two values: the element to put in the kth slot of the new vector and a new state for the next iteration. On the first call to f, the state's value is seed.

    (scheme vector s8) procedure (s8vector-copy (s8vec s8vector?) ) ⟹ s8vector?

    (scheme vector s8) procedure (s8vector-copy (s8vec s8vector?) (start integer?) ) ⟹ s8vector?

    (scheme vector s8) procedure (s8vector-copy (s8vec s8vector?) (start integer?) (end integer?) ) ⟹ s8vector?

    Makes a copy of the portion of s8vec from start to end and returns it.

    (scheme vector s8) procedure (s8vector-reverse-copy (s8vec s8vector?) ) ⟹ s8vector?

    (scheme vector s8) procedure (s8vector-reverse-copy (s8vec s8vector?) (start integer?) ) ⟹ s8vector?

    (scheme vector s8) procedure (s8vector-reverse-copy (s8vec s8vector?) (start integer?) (end integer?) ) ⟹ s8vector?

    The same as s8vector-copy, but in reverse order.

    (scheme vector s8) procedure (s8vector-append (s8vec s8vector?) ... ) ⟹ s8vector?

    Returns a s8vector containing all the elements of the s8vecs in order.

    (scheme vector s8) procedure (s8vector-concatenate (list-of-s8vectors list?) ) ⟹ s8vector?

    list-of-s8vectors ⟹ (list s8vector?)

    The same as s8vector-append, but takes a list of s8vectors rather than multiple arguments.

    (scheme vector s8) procedure (s8vector-append-subvectors (s8vec1 s8vector?) (start1 integer?) (end1 integer?) ... ) ⟹ s8vector?

    Concatenates the result of applying s8vector-copy to each triplet of s8vec, start, end arguments, but may be implemented more efficiently.

    (scheme vector s8) procedure (s8vector-empty? (s8vec s8vector?) ) ⟹ boolean?

    Returns #t if s8vec has a length of zero, and #f otherwise.

    (scheme vector s8) procedure (s8vector= (s8vec s8vector?) ... ) ⟹ boolean?

    Compares the s8vecs for elementwise equality, using = to do the comparisons. Returns #f unless all s8vectors are the same length.

    (scheme vector s8) procedure (s8vector-take (s8vec s8vector?) (n integer?) ) ⟹ s8vector?

    (scheme vector s8) procedure (s8vector-take-right (s8vec s8vector?) (n integer?) ) ⟹ s8vector?

    Returns a s8vector containing the first/last n elements of s8vec.

    (scheme vector s8) procedure (s8vector-drop (s8vec s8vector?) (n integer?) ) ⟹ s8vector?

    (scheme vector s8) procedure (s8vector-drop-right (s8vec s8vector?) (n integer?) ) ⟹ s8vector?

    Returns a s8vector containing all except the first/last n elements of s8vec.

    (scheme vector s8) procedure (s8vector-segment (s8vec s8vector?) (n integer?) ) ⟹ list?

    Returns a list of s8vectors, each of which contains n consecutive elements of s8vec. The last s8vector may be shorter than n. It is an error if n is not an exact positive integer.

    (scheme vector s8) procedure (s8vector-fold (kons procedure?) knil (s8vec1 s8vector?) (s8vec2 s8vector?) ... ) ⟹ *

    (kons state (obj1 s8?) (obj2 s8?) ... ) ⟹ *

    (scheme vector s8) procedure (s8vector-fold-right (kons procedure?) knil (s8vec1 s8vector?) (s8vec2 s8vector?) ... ) ⟹ *

    (kons state (obj1 s8?) (obj2 s8?) ... ) ⟹ *

    When one s8vector argument s8vec is given, folds kons over the elements of s8vec in increasing/decreasing order using knil as the initial value. The kons procedure is called with the state first and the element second, as in SRFIs 43 and 133 (heterogeneous vectors). This is the opposite order to that used in SRFI 1 (lists) and the various string SRFIs.

    When multiple s8vector arguments are given, kons is called with the current state value and each value from all the vectors; s8vector-fold scans elements from left to right, while s8vector-fold-right does from right to left. If the lengths of vectors differ, only the portion of each vector up to the length of the shortest vector is scanned.

    (scheme vector s8) procedure (s8vector-map (proc procedure?) (s8vec1 s8vector?) (s8vec2 s8vector?) ... ) ⟹ vector?

    (proc (val1 s8?) ... ) ⟹ *

    (scheme vector s8) procedure (s8vector-map! (proc procedure?) (s8vec1 s8vector?) (s8vec2 s8vector?) ... ) ⟹ undefined

    (proc (val1 s8?) ... ) ⟹ *

    (scheme vector s8) procedure (s8vector-for-each (proc procedure?) (s8vec1 s8vector?) (s8vec2 s8vector?) ... ) ⟹ undefined

    (proc (val1 s8?) ... ) ⟹ undefined

    Iterate over the elements of s8vec and apply f to each, returning respectively a s8vector of the results, an undefined value with the results placed back in s8vec, and an undefined value with no change to s8vec.

    If more than one vector is passed, f gets one element from each vector as arguments. If the lengths of the vectors differ, iteration stops at the end of the shortest vector. For s8vector-map!, only s8vec is modified even when multiple vectors are passed.

    If s8vector-map or s8vector-map! returns more than once (i.e. because of a continuation captured by f), the values returned or stored by earlier returns may be mutated.

    (scheme vector s8) procedure (s8vector-count (pred? procedure?) (s8vec1 s8vector?) (s8vec2 s8vector?) ... ) ⟹ integer?

    (pred? (val1 s8?) (val2 s8?) ... ) ⟹ *

    Call pred? on each element of s8vec and return the number of calls that return true.

    When multiple vectors are given, pred? must take the same number of arguments as the number of vectors, and corresponding elements from each vector are given for each iteration, which stops at the end of the shortest vector.

    (scheme vector s8) procedure (s8vector-cumulate (f procedure?) knil (s8vec s8vector?) ) ⟹ s8vector?

    (f state (value s8?) ) ⟹ *

    Like s8vector-fold, but returns an s8vector of partial results rather than just the final result.

    (scheme vector s8) procedure (s8vector-take-while (pred? procedure?) (s8vec s8vector?) ) ⟹ s8vector?

    (pred? (value s8?) ) ⟹ boolean?

    (scheme vector s8) procedure (s8vector-take-while-right (pred? procedure?) (s8vec s8vector?) ) ⟹ s8vector?

    (pred? (value s8?) ) ⟹ boolean?

    Return the shortest prefix/suffix of s8vec all of whose elements satisfy pred?.

    (scheme vector s8) procedure (s8vector-drop-while (pred? procedure?) (s8vec s8vector?) ) ⟹ s8vector?

    (pred? (value s8?) ) ⟹ boolean?

    (scheme vector s8) procedure (s8vector-drop-while-right (pred? procedure?) (s8vec s8vector?) ) ⟹ s8vector?

    (pred? (value s8?) ) ⟹ boolean?

    Drops the longest initial prefix/suffix of s8vec such that all its elements satisfy pred.

    (scheme vector s8) procedure (s8vector-index (pred? procedure?) (s8vec1 s8vector?) (s8vec2 s8vector?) ... ) ⟹ integer? / #f /

    (pred? (value1 s8?) (value2 s8?) ... ) ⟹ *

    (scheme vector s8) procedure (s8vector-index-right (pred? procedure?) (s8vec1 s8vector?) (s8vec2 s8vector?) ... ) ⟹ integer? / #f /

    (pred? (value1 s8?) (value2 s8?) ... ) ⟹ *

    Return the index of the first/last element of s8vec that satisfies pred?.

    When multiple vectors are passed, pred? must take the same number of arguments as the number of vectors, and corresponding elements from each vector are passed for each iteration. If the lengths of vectors differ, s8vector-index stops iteration at the end of the shortest one. Lengths of vectors must be the same for s8vector-index-right.

    (scheme vector s8) procedure (s8vector-skip (pred? procedure?) (s8vec1 s8vector?) (s8vec2 s8vector?) ... ) ⟹ integer? / #f /

    (pred? (value1 s8?) (value2 s8?) ... ) ⟹ *

    (scheme vector s8) procedure (s8vector-skip-right (pred? procedure?) (s8vec1 s8vector?) (s8vec2 s8vector?) ... ) ⟹ integer? / #f /

    (pred? (value1 s8?) (value2 s8?) ... ) ⟹ *

    Returns the index of the first/last element of s8vec that does not satisfy pred?.

    When multiple vectors are passed, pred? must take the same number of arguments as the number of vectors, and corresponding elements from each vector are passed for each iteration. If the lengths of vectors differ, s8vector-skip stops iteration at the end of the shortest one. Lengths of vectors must be the same for s8vector-skip-right.

    (scheme vector s8) procedure (s8vector-any (pred? procedure?) (s8vec1 s8vector?) (s8vec2 s8vector?) ... ) ⟹ *

    (pred? (val1 s8?) (val2 s8?) ... ) ⟹ *

    Returns first non-false result of applying pred? on a element from the s8vec, or #f if there is no such element. If s8vec is empty, returns #t

    When multiple vectors are passed, pred? must take the same number of arguments as the number of vectors, and corresponding elements from each vector are passed for each iteration. If the lengths of vectors differ, it stops at the end of the shortest one.

    (scheme vector s8) procedure (s8vector-every (pred? procedure?) (s8vec1 s8vector?) (s8vec2 s8vector?) ... ) ⟹ *

    (pred? (val1 s8?) (val2 s8?) ... ) ⟹ *

    If all elements from s8vec satisfy pred?, return the last result of pred?. If not all do, return #f. If s8vec is empty, return #t

    When multiple vectors are passed, pred? must take the same number of arguments as the number of vectors, and corresponding elements from each vector is passed for each iteration. If the lengths of vectors differ, it stops at the end of the shortest one.

    (scheme vector s8) procedure (s8vector-partition (pred? procedure?) (s8vec s8vector?) ) ⟹ (values s8vector?integer?)

    (pred? (value s8?) ) ⟹ boolean?

    Returns an s8vector of the same type as s8vec, but with all elements satisfying pred? in the leftmost part of the vector and the other elements in the remaining part. The order of elements is otherwise preserved. Returns two values, the new s8vector and the number of elements satisfying pred?.

    (scheme vector s8) procedure (s8vector-filter (pred? procedure?) (s8vec1 s8vector?) ) ⟹ s8vector?

    (pred? (val s8?) ) ⟹ boolean?

    (scheme vector s8) procedure (s8vector-remove (pred? procedure?) (s8vec1 s8vector?) ) ⟹ s8vector?

    (pred? (val s8?) ) ⟹ boolean?

    Return an s8vector containing the elements of s8vec that satisfy / do not satisfy pred?.

    (scheme vector s8) procedure (s8vector-swap! (s8vec s8vector?) (i integer?) (j integer?) ) ⟹ undefined

    Interchanges the ith and jth elements of s8vec.

    (scheme vector s8) procedure (s8vector-fill! (s8vec s8vector?) (fill s8?) ) ⟹ undefined

    (scheme vector s8) procedure (s8vector-fill! (s8vec s8vector?) (fill s8?) (start integer?) ) ⟹ undefined

    (scheme vector s8) procedure (s8vector-fill! (s8vec s8vector?) (fill s8?) (start integer?) (end integer?) ) ⟹ undefined

    Fills the portion of s8vec from start to end with the value fill.

    (scheme vector s8) procedure (s8vector-reverse! (s8vec s8vector?) ) ⟹ undefined

    (scheme vector s8) procedure (s8vector-reverse! (s8vec s8vector?) (start integer?) ) ⟹ undefined

    (scheme vector s8) procedure (s8vector-reverse! (s8vec s8vector?) (start integer?) (end integer?) ) ⟹ undefined

    Reverses the portion of s8vec from start to end.

    (scheme vector s8) procedure (s8vector-copy! (s8to s8vector?) (at integer?) (s8from s8vector?) ) ⟹ undefined

    (scheme vector s8) procedure (s8vector-copy! (s8to s8vector?) (at integer?) (s8from s8vector?) (start integer?) ) ⟹ undefined

    (scheme vector s8) procedure (s8vector-copy! (s8to s8vector?) (at integer?) (s8from s8vector?) (start integer?) (end integer?) ) ⟹ undefined

    Copies the portion of s8from from start to end onto s8to, starting at index at.

    (scheme vector s8) procedure (s8vector-reverse-copy! (s8to s8vector?) (at integer?) (s8from s8vector?) ) ⟹ undefined

    (scheme vector s8) procedure (s8vector-reverse-copy! (s8to s8vector?) (at integer?) (s8from s8vector?) (start integer?) ) ⟹ undefined

    (scheme vector s8) procedure (s8vector-reverse-copy! (s8to s8vector?) (at integer?) (s8from s8vector?) (start integer?) (end integer?) ) ⟹ undefined

    The same as s8vector-copy!, but copies in reverse

    (scheme vector s8) procedure (s8vector-unfold! (f procedure?) (s8vec s8vector?) (start integer?) (end integer?) initial-seed ... ) ⟹ undefined

    (f (index integer?) seed ... ) ⟹ (values **...)

    Like s8vector-unfold, but the elements are copied into the vector s8vec starting at element start rather than into a newly allocated vector. Terminates when end - start elements have been generated.

    (scheme vector s8) procedure (s8vector-unfold-right! (f procedure?) (s8vec s8vector?) (start integer?) (end integer?) initial-seed ... ) ⟹ undefined

    (f (index integer?) seed ... ) ⟹ (values **...)

    The same as s8vector-unfold!, but initializes the s8vector from right to left.

    (scheme vector s8) procedure (reverse-s8vector->list (s8vec s8vector?) ) ⟹ list?

    (scheme vector s8) procedure (reverse-s8vector->list (s8vec s8vector?) (start integer?) ) ⟹ list?

    (scheme vector s8) procedure (reverse-s8vector->list (s8vec s8vector?) (start integer?) (end integer?) ) ⟹ list?

    Returns a list with same elements as s8vec in reverse order.

    (scheme vector s8) procedure (reverse-list->s8vector (proper-list list?) ) ⟹ s8vector?

    Returns s8vector with same elements as list in reverse order.

    (scheme vector s8) procedure (s8vector->vector (s8vec s8vector?) ) ⟹ vector?

    (scheme vector s8) procedure (s8vector->vector (s8vec s8vector?) (start integer?) ) ⟹ vector?

    (scheme vector s8) procedure (s8vector->vector (s8vec s8vector?) (start integer?) (end integer?) ) ⟹ vector?

    Returns vector with same elements as s8vec.

    (scheme vector s8) procedure (vector->s8vector (vec vector?) ) ⟹ s8vector?

    (scheme vector s8) procedure (vector->s8vector (vec vector?) (start integer?) ) ⟹ s8vector?

    (scheme vector s8) procedure (vector->s8vector (vec vector?) (start integer?) (end integer?) ) ⟹ s8vector?

    Returns s8vector with same elements as vec.

    (scheme vector s8) procedure (make-s8vector-generator (s8vector s8vector?) ) ⟹ procedure?

    (return ) ⟹ eof-object? / s8? /

    Returns a SRFI 121 generator that generates all the values of s8vector in order. Note that the generator is finite.

    s8vector-comparatorcomparator?

    Variable containing a SRFI 128 comparator whose components provide ordering and hashing of s8vector.

    (scheme vector s8) procedure (write-s8vector (s8vec s8vector) ) ⟹ undefined

    (scheme vector s8) procedure (write-s8vector (s8vec s8vector) (port output-port?) ) ⟹ undefined

    Prints to port (the current output port by default) a representation of s8vec in the lexical syntax explained below.

    library (scheme vector u16)

    (scheme vector u16) procedure (make-u16vector (size integer?) ) ⟹ u16vector?

    (scheme vector u16) procedure (make-u16vector (size integer?) (fill u16?) ) ⟹ u16vector?

    Returns a u16vector whose length is size. If fill is provided, all the elements of the u16vector are initialized to it.

    (scheme vector u16) procedure (u16vector (value u16?) ... ) ⟹ u16vector?

    Returns a u16vector initialized with values.

    (scheme vector u16) procedure (u16vector? obj ) ⟹ boolean?

    Returns #t if obj is a u16vector, and #f otherwise.

    (scheme vector u16) procedure (u16vector-length (u16vec u16vector?) ) ⟹ integer?

    Returns the length of u16vec

    (scheme vector u16) procedure (u16vector-ref (u16vec u16vector?) (i integer?) ) ⟹ u16?

    Returns the ith element of u16vec.

    (scheme vector u16) procedure (u16vector-set! (u16vec u16vector?) (i integer?) (value u16?) ) ⟹ undefined

    Sets the ith element of u16vec to value.

    (scheme vector u16) procedure (u16vector->list (u16vec u16vector?) ) ⟹ list?

    (scheme vector u16) procedure (u16vector->list (u16vec u16vector?) (start integer?) ) ⟹ list?

    (scheme vector u16) procedure (u16vector->list (u16vec u16vector?) (start integer?) (end integer?) ) ⟹ list?

    Returns a list with same elements as u16vec

    (scheme vector u16) procedure (list->u16vector (proper-list list?) ) ⟹ u16vector?

    proper-list ⟹ (list u16?)

    Returns u16vector with same elements as list.

    (scheme vector u16) procedure (u16? obj ) ⟹ boolean?

    Returns #t if obj is a valid element of an u16vector (ie., unsigned exact integer in the range 0 to (2^16)-1), and #f otherwise.

    (scheme vector u16) procedure (u16vector-unfold (f procedure?) (length integer?) seed ) ⟹ u16vector?

    (scheme vector u16) procedure (u16vector-unfold (f procedure?) (length integer?) seed ) ⟹ u16vector?

    (f (index integer?) state ) ⟹ (values u16?*)

    Creates a vector whose length is length and iterates across each index k between 0 and length - 1, applying f at each iteration to the current index and current state, in that order, to receive two values: the element to put in the kth slot of the new vector and a new state for the next iteration. On the first call to f, the state's value is seed.

    (scheme vector u16) procedure (u16vector-copy (u16vec u16vector?) ) ⟹ u16vector?

    (scheme vector u16) procedure (u16vector-copy (u16vec u16vector?) (start integer?) ) ⟹ u16vector?

    (scheme vector u16) procedure (u16vector-copy (u16vec u16vector?) (start integer?) (end integer?) ) ⟹ u16vector?

    Makes a copy of the portion of u16vec from start to end and returns it.

    (scheme vector u16) procedure (u16vector-reverse-copy (u16vec u16vector?) ) ⟹ u16vector?

    (scheme vector u16) procedure (u16vector-reverse-copy (u16vec u16vector?) (start integer?) ) ⟹ u16vector?

    (scheme vector u16) procedure (u16vector-reverse-copy (u16vec u16vector?) (start integer?) (end integer?) ) ⟹ u16vector?

    The same as u16vector-copy, but in reverse order.

    (scheme vector u16) procedure (u16vector-append (u16vec u16vector?) ... ) ⟹ u16vector?

    Returns a u16vector containing all the elements of the u16vecs in order.

    (scheme vector u16) procedure (u16vector-concatenate (list-of-u16vectors list?) ) ⟹ u16vector?

    list-of-u16vectors ⟹ (list u16vector?)

    The same as u16vector-append, but takes a list of u16vectors rather than multiple arguments.

    (scheme vector u16) procedure (u16vector-append-subvectors (u16vec1 u16vector?) (start1 integer?) (end1 integer?) ... ) ⟹ u16vector?

    Concatenates the result of applying u16vector-copy to each triplet of u16vec, start, end arguments, but may be implemented more efficiently.

    (scheme vector u16) procedure (u16vector-empty? (u16vec u16vector?) ) ⟹ boolean?

    Returns #t if u16vec has a length of zero, and #f otherwise.

    (scheme vector u16) procedure (u16vector= (u16vec u16vector?) ... ) ⟹ boolean?

    Compares the u16vecs for elementwise equality, using = to do the comparisons. Returns #f unless all u16vectors are the same length.

    (scheme vector u16) procedure (u16vector-take (u16vec u16vector?) (n integer?) ) ⟹ u16vector?

    (scheme vector u16) procedure (u16vector-take-right (u16vec u16vector?) (n integer?) ) ⟹ u16vector?

    Returns a u16vector containing the first/last n elements of u16vec.

    (scheme vector u16) procedure (u16vector-drop (u16vec u16vector?) (n integer?) ) ⟹ u16vector?

    (scheme vector u16) procedure (u16vector-drop-right (u16vec u16vector?) (n integer?) ) ⟹ u16vector?

    Returns a u16vector containing all except the first/last n elements of u16vec.

    (scheme vector u16) procedure (u16vector-segment (u16vec u16vector?) (n integer?) ) ⟹ list?

    Returns a list of u16vectors, each of which contains n consecutive elements of u16vec. The last u16vector may be shorter than n. It is an error if n is not an exact positive integer.

    (scheme vector u16) procedure (u16vector-fold (kons procedure?) knil (u16vec1 u16vector?) (u16vec2 u16vector?) ... ) ⟹ *

    (kons state (obj1 u16?) (obj2 u16?) ... ) ⟹ *

    (scheme vector u16) procedure (u16vector-fold-right (kons procedure?) knil (u16vec1 u16vector?) (u16vec2 u16vector?) ... ) ⟹ *

    (kons state (obj1 u16?) (obj2 u16?) ... ) ⟹ *

    When one u16vector argument u16vec is given, folds kons over the elements of u16vec in increasing/decreasing order using knil as the initial value. The kons procedure is called with the state first and the element second, as in SRFIs 43 and 133 (heterogeneous vectors). This is the opposite order to that used in SRFI 1 (lists) and the various string SRFIs.

    When multiple u16vector arguments are given, kons is called with the current state value and each value from all the vectors; u16vector-fold scans elements from left to right, while u16vector-fold-right does from right to left. If the lengths of vectors differ, only the portion of each vector up to the length of the shortest vector is scanned.

    (scheme vector u16) procedure (u16vector-map (proc procedure?) (u16vec1 u16vector?) (u16vec2 u16vector?) ... ) ⟹ vector?

    (proc (val1 u16?) ... ) ⟹ *

    (scheme vector u16) procedure (u16vector-map! (proc procedure?) (u16vec1 u16vector?) (u16vec2 u16vector?) ... ) ⟹ undefined

    (proc (val1 u16?) ... ) ⟹ *

    (scheme vector u16) procedure (u16vector-for-each (proc procedure?) (u16vec1 u16vector?) (u16vec2 u16vector?) ... ) ⟹ undefined

    (proc (val1 u16?) ... ) ⟹ undefined

    Iterate over the elements of u16vec and apply f to each, returning respectively a u16vector of the results, an undefined value with the results placed back in u16vec, and an undefined value with no change to u16vec.

    If more than one vector is passed, f gets one element from each vector as arguments. If the lengths of the vectors differ, iteration stops at the end of the shortest vector. For u16vector-map!, only u16vec is modified even when multiple vectors are passed.

    If u16vector-map or u16vector-map! returns more than once (i.e. because of a continuation captured by f), the values returned or stored by earlier returns may be mutated.

    (scheme vector u16) procedure (u16vector-count (pred? procedure?) (u16vec1 u16vector?) (u16vec2 u16vector?) ... ) ⟹ integer?

    (pred? (val1 u16?) (val2 u16?) ... ) ⟹ *

    Call pred? on each element of u16vec and return the number of calls that return true.

    When multiple vectors are given, pred? must take the same number of arguments as the number of vectors, and corresponding elements from each vector are given for each iteration, which stops at the end of the shortest vector.

    (scheme vector u16) procedure (u16vector-cumulate (f procedure?) knil (u16vec u16vector?) ) ⟹ u16vector?

    (f state (value u16?) ) ⟹ *

    Like u16vector-fold, but returns an u16vector of partial results rather than just the final result.

    (scheme vector u16) procedure (u16vector-take-while (pred? procedure?) (u16vec u16vector?) ) ⟹ u16vector?

    (pred? (value u16?) ) ⟹ boolean?

    (scheme vector u16) procedure (u16vector-take-while-right (pred? procedure?) (u16vec u16vector?) ) ⟹ u16vector?

    (pred? (value u16?) ) ⟹ boolean?

    Return the shortest prefix/suffix of u16vec all of whose elements satisfy pred?.

    (scheme vector u16) procedure (u16vector-drop-while (pred? procedure?) (u16vec u16vector?) ) ⟹ u16vector?

    (pred? (value u16?) ) ⟹ boolean?

    (scheme vector u16) procedure (u16vector-drop-while-right (pred? procedure?) (u16vec u16vector?) ) ⟹ u16vector?

    (pred? (value u16?) ) ⟹ boolean?

    Drops the longest initial prefix/suffix of u16vec such that all its elements satisfy pred.

    (scheme vector u16) procedure (u16vector-index (pred? procedure?) (u16vec1 u16vector?) (u16vec2 u16vector?) ... ) ⟹ integer? / #f /

    (pred? (value1 u16?) (value2 u16?) ... ) ⟹ *

    (scheme vector u16) procedure (u16vector-index-right (pred? procedure?) (u16vec1 u16vector?) (u16vec2 u16vector?) ... ) ⟹ integer? / #f /

    (pred? (value1 u16?) (value2 u16?) ... ) ⟹ *

    Return the index of the first/last element of u16vec that satisfies pred?.

    When multiple vectors are passed, pred? must take the same number of arguments as the number of vectors, and corresponding elements from each vector are passed for each iteration. If the lengths of vectors differ, u16vector-index stops iteration at the end of the shortest one. Lengths of vectors must be the same for u16vector-index-right.

    (scheme vector u16) procedure (u16vector-skip (pred? procedure?) (u16vec1 u16vector?) (u16vec2 u16vector?) ... ) ⟹ integer? / #f /

    (pred? (value1 u16?) (value2 u16?) ... ) ⟹ *

    (scheme vector u16) procedure (u16vector-skip-right (pred? procedure?) (u16vec1 u16vector?) (u16vec2 u16vector?) ... ) ⟹ integer? / #f /

    (pred? (value1 u16?) (value2 u16?) ... ) ⟹ *

    Returns the index of the first/last element of u16vec that does not satisfy pred?.

    When multiple vectors are passed, pred? must take the same number of arguments as the number of vectors, and corresponding elements from each vector are passed for each iteration. If the lengths of vectors differ, u16vector-skip stops iteration at the end of the shortest one. Lengths of vectors must be the same for u16vector-skip-right.

    (scheme vector u16) procedure (u16vector-any (pred? procedure?) (u16vec1 u16vector?) (u16vec2 u16vector?) ... ) ⟹ *

    (pred? (val1 u16?) (val2 u16?) ... ) ⟹ *

    Returns first non-false result of applying pred? on a element from the u16vec, or #f if there is no such element. If u16vec is empty, returns #t

    When multiple vectors are passed, pred? must take the same number of arguments as the number of vectors, and corresponding elements from each vector are passed for each iteration. If the lengths of vectors differ, it stops at the end of the shortest one.

    (scheme vector u16) procedure (u16vector-every (pred? procedure?) (u16vec1 u16vector?) (u16vec2 u16vector?) ... ) ⟹ *

    (pred? (val1 u16?) (val2 u16?) ... ) ⟹ *

    If all elements from u16vec satisfy pred?, return the last result of pred?. If not all do, return #f. If u16vec is empty, return #t

    When multiple vectors are passed, pred? must take the same number of arguments as the number of vectors, and corresponding elements from each vector is passed for each iteration. If the lengths of vectors differ, it stops at the end of the shortest one.

    (scheme vector u16) procedure (u16vector-partition (pred? procedure?) (u16vec u16vector?) ) ⟹ (values u16vector?integer?)

    (pred? (value u16?) ) ⟹ boolean?

    Returns an u16vector of the same type as u16vec, but with all elements satisfying pred? in the leftmost part of the vector and the other elements in the remaining part. The order of elements is otherwise preserved. Returns two values, the new u16vector and the number of elements satisfying pred?.

    (scheme vector u16) procedure (u16vector-filter (pred? procedure?) (u16vec1 u16vector?) ) ⟹ u16vector?

    (pred? (val u16?) ) ⟹ boolean?

    (scheme vector u16) procedure (u16vector-remove (pred? procedure?) (u16vec1 u16vector?) ) ⟹ u16vector?

    (pred? (val u16?) ) ⟹ boolean?

    Return an u16vector containing the elements of u16vec that satisfy / do not satisfy pred?.

    (scheme vector u16) procedure (u16vector-swap! (u16vec u16vector?) (i integer?) (j integer?) ) ⟹ undefined

    Interchanges the ith and jth elements of u16vec.

    (scheme vector u16) procedure (u16vector-fill! (u16vec u16vector?) (fill u16?) ) ⟹ undefined

    (scheme vector u16) procedure (u16vector-fill! (u16vec u16vector?) (fill u16?) (start integer?) ) ⟹ undefined

    (scheme vector u16) procedure (u16vector-fill! (u16vec u16vector?) (fill u16?) (start integer?) (end integer?) ) ⟹ undefined

    Fills the portion of u16vec from start to end with the value fill.

    (scheme vector u16) procedure (u16vector-reverse! (u16vec u16vector?) ) ⟹ undefined

    (scheme vector u16) procedure (u16vector-reverse! (u16vec u16vector?) (start integer?) ) ⟹ undefined

    (scheme vector u16) procedure (u16vector-reverse! (u16vec u16vector?) (start integer?) (end integer?) ) ⟹ undefined

    Reverses the portion of u16vec from start to end.

    (scheme vector u16) procedure (u16vector-copy! (u16to u16vector?) (at integer?) (u16from u16vector?) ) ⟹ undefined

    (scheme vector u16) procedure (u16vector-copy! (u16to u16vector?) (at integer?) (u16from u16vector?) (start integer?) ) ⟹ undefined

    (scheme vector u16) procedure (u16vector-copy! (u16to u16vector?) (at integer?) (u16from u16vector?) (start integer?) (end integer?) ) ⟹ undefined

    Copies the portion of u16from from start to end onto u16to, starting at index at.

    (scheme vector u16) procedure (u16vector-reverse-copy! (u16to u16vector?) (at integer?) (u16from u16vector?) ) ⟹ undefined

    (scheme vector u16) procedure (u16vector-reverse-copy! (u16to u16vector?) (at integer?) (u16from u16vector?) (start integer?) ) ⟹ undefined

    (scheme vector u16) procedure (u16vector-reverse-copy! (u16to u16vector?) (at integer?) (u16from u16vector?) (start integer?) (end integer?) ) ⟹ undefined

    The same as u16vector-copy!, but copies in reverse

    (scheme vector u16) procedure (u16vector-unfold! (f procedure?) (u16vec u16vector?) (start integer?) (end integer?) initial-seed ... ) ⟹ undefined

    (f (index integer?) seed ... ) ⟹ (values **...)

    Like u16vector-unfold, but the elements are copied into the vector u16vec starting at element start rather than into a newly allocated vector. Terminates when end - start elements have been generated.

    (scheme vector u16) procedure (u16vector-unfold-right! (f procedure?) (u16vec u16vector?) (start integer?) (end integer?) initial-seed ... ) ⟹ undefined

    (f (index integer?) seed ... ) ⟹ (values **...)

    The same as u16vector-unfold!, but initializes the u16vector from right to left.

    (scheme vector u16) procedure (reverse-u16vector->list (u16vec u16vector?) ) ⟹ list?

    (scheme vector u16) procedure (reverse-u16vector->list (u16vec u16vector?) (start integer?) ) ⟹ list?

    (scheme vector u16) procedure (reverse-u16vector->list (u16vec u16vector?) (start integer?) (end integer?) ) ⟹ list?

    Returns a list with same elements as u16vec in reverse order.

    (scheme vector u16) procedure (reverse-list->u16vector (proper-list list?) ) ⟹ u16vector?

    Returns u16vector with same elements as list in reverse order.

    (scheme vector u16) procedure (u16vector->vector (u16vec u16vector?) ) ⟹ vector?

    (scheme vector u16) procedure (u16vector->vector (u16vec u16vector?) (start integer?) ) ⟹ vector?

    (scheme vector u16) procedure (u16vector->vector (u16vec u16vector?) (start integer?) (end integer?) ) ⟹ vector?

    Returns vector with same elements as u16vec.

    (scheme vector u16) procedure (vector->u16vector (vec vector?) ) ⟹ u16vector?

    (scheme vector u16) procedure (vector->u16vector (vec vector?) (start integer?) ) ⟹ u16vector?

    (scheme vector u16) procedure (vector->u16vector (vec vector?) (start integer?) (end integer?) ) ⟹ u16vector?

    Returns u16vector with same elements as vec.

    (scheme vector u16) procedure (make-u16vector-generator (u16vector u16vector?) ) ⟹ procedure?

    (return ) ⟹ eof-object? / u16? /

    Returns a SRFI 121 generator that generates all the values of u16vector in order. Note that the generator is finite.

    u16vector-comparatorcomparator?

    Variable containing a SRFI 128 comparator whose components provide ordering and hashing of u16vector.

    (scheme vector u16) procedure (write-u16vector (u16vec u16vector) ) ⟹ undefined

    (scheme vector u16) procedure (write-u16vector (u16vec u16vector) (port output-port?) ) ⟹ undefined

    Prints to port (the current output port by default) a representation of u16vec in the lexical syntax explained below.

    library (scheme vector s16)

    (scheme vector s16) procedure (make-s16vector (size integer?) ) ⟹ s16vector?

    (scheme vector s16) procedure (make-s16vector (size integer?) (fill s16?) ) ⟹ s16vector?

    Returns a s16vector whose length is size. If fill is provided, all the elements of the s16vector are initialized to it.

    (scheme vector s16) procedure (s16vector (value s16?) ... ) ⟹ s16vector?

    Returns a s16vector initialized with values.

    (scheme vector s16) procedure (s16vector? obj ) ⟹ boolean?

    Returns #t if obj is a s16vector, and #f otherwise.

    (scheme vector s16) procedure (s16vector-length (s16vec s16vector?) ) ⟹ integer?

    Returns the length of s16vec

    (scheme vector s16) procedure (s16vector-ref (s16vec s16vector?) (i integer?) ) ⟹ s16?

    Returns the ith element of s16vec.

    (scheme vector s16) procedure (s16vector-set! (s16vec s16vector?) (i integer?) (value s16?) ) ⟹ undefined

    Sets the ith element of s16vec to value.

    (scheme vector s16) procedure (s16vector->list (s16vec s16vector?) ) ⟹ list?

    (scheme vector s16) procedure (s16vector->list (s16vec s16vector?) (start integer?) ) ⟹ list?

    (scheme vector s16) procedure (s16vector->list (s16vec s16vector?) (start integer?) (end integer?) ) ⟹ list?

    Returns a list with same elements as s16vec

    (scheme vector s16) procedure (list->s16vector (proper-list list?) ) ⟹ s16vector?

    proper-list ⟹ (list s16?)

    Returns s16vector with same elements as list.

    (scheme vector s16) procedure (s16? obj ) ⟹ boolean?

    Returns #t if obj is a valid element of an s16vector (ie., signed exact integer in the range -(2^15) to (2^15)-1), and #f otherwise.

    (scheme vector s16) procedure (s16vector-unfold (f procedure?) (length integer?) seed ) ⟹ s16vector?

    (scheme vector s16) procedure (s16vector-unfold (f procedure?) (length integer?) seed ) ⟹ s16vector?

    (f (index integer?) state ) ⟹ (values s16?*)

    Creates a vector whose length is length and iterates across each index k between 0 and length - 1, applying f at each iteration to the current index and current state, in that order, to receive two values: the element to put in the kth slot of the new vector and a new state for the next iteration. On the first call to f, the state's value is seed.

    (scheme vector s16) procedure (s16vector-copy (s16vec s16vector?) ) ⟹ s16vector?

    (scheme vector s16) procedure (s16vector-copy (s16vec s16vector?) (start integer?) ) ⟹ s16vector?

    (scheme vector s16) procedure (s16vector-copy (s16vec s16vector?) (start integer?) (end integer?) ) ⟹ s16vector?

    Makes a copy of the portion of s16vec from start to end and returns it.

    (scheme vector s16) procedure (s16vector-reverse-copy (s16vec s16vector?) ) ⟹ s16vector?

    (scheme vector s16) procedure (s16vector-reverse-copy (s16vec s16vector?) (start integer?) ) ⟹ s16vector?

    (scheme vector s16) procedure (s16vector-reverse-copy (s16vec s16vector?) (start integer?) (end integer?) ) ⟹ s16vector?

    The same as s16vector-copy, but in reverse order.

    (scheme vector s16) procedure (s16vector-append (s16vec s16vector?) ... ) ⟹ s16vector?

    Returns a s16vector containing all the elements of the s16vecs in order.

    (scheme vector s16) procedure (s16vector-concatenate (list-of-s16vectors list?) ) ⟹ s16vector?

    list-of-s16vectors ⟹ (list s16vector?)

    The same as s16vector-append, but takes a list of s16vectors rather than multiple arguments.

    (scheme vector s16) procedure (s16vector-append-subvectors (s16vec1 s16vector?) (start1 integer?) (end1 integer?) ... ) ⟹ s16vector?

    Concatenates the result of applying s16vector-copy to each triplet of s16vec, start, end arguments, but may be implemented more efficiently.

    (scheme vector s16) procedure (s16vector-empty? (s16vec s16vector?) ) ⟹ boolean?

    Returns #t if s16vec has a length of zero, and #f otherwise.

    (scheme vector s16) procedure (s16vector= (s16vec s16vector?) ... ) ⟹ boolean?

    Compares the s16vecs for elementwise equality, using = to do the comparisons. Returns #f unless all s16vectors are the same length.

    (scheme vector s16) procedure (s16vector-take (s16vec s16vector?) (n integer?) ) ⟹ s16vector?

    (scheme vector s16) procedure (s16vector-take-right (s16vec s16vector?) (n integer?) ) ⟹ s16vector?

    Returns a s16vector containing the first/last n elements of s16vec.

    (scheme vector s16) procedure (s16vector-drop (s16vec s16vector?) (n integer?) ) ⟹ s16vector?

    (scheme vector s16) procedure (s16vector-drop-right (s16vec s16vector?) (n integer?) ) ⟹ s16vector?

    Returns a s16vector containing all except the first/last n elements of s16vec.

    (scheme vector s16) procedure (s16vector-segment (s16vec s16vector?) (n integer?) ) ⟹ list?

    Returns a list of s16vectors, each of which contains n consecutive elements of s16vec. The last s16vector may be shorter than n. It is an error if n is not an exact positive integer.

    (scheme vector s16) procedure (s16vector-fold (kons procedure?) knil (s16vec1 s16vector?) (s16vec2 s16vector?) ... ) ⟹ *

    (kons state (obj1 s16?) (obj2 s16?) ... ) ⟹ *

    (scheme vector s16) procedure (s16vector-fold-right (kons procedure?) knil (s16vec1 s16vector?) (s16vec2 s16vector?) ... ) ⟹ *

    (kons state (obj1 s16?) (obj2 s16?) ... ) ⟹ *

    When one s16vector argument s16vec is given, folds kons over the elements of s16vec in increasing/decreasing order using knil as the initial value. The kons procedure is called with the state first and the element second, as in SRFIs 43 and 133 (heterogeneous vectors). This is the opposite order to that used in SRFI 1 (lists) and the various string SRFIs.

    When multiple s16vector arguments are given, kons is called with the current state value and each value from all the vectors; s16vector-fold scans elements from left to right, while s16vector-fold-right does from right to left. If the lengths of vectors differ, only the portion of each vector up to the length of the shortest vector is scanned.

    (scheme vector s16) procedure (s16vector-map (proc procedure?) (s16vec1 s16vector?) (s16vec2 s16vector?) ... ) ⟹ vector?

    (proc (val1 s16?) ... ) ⟹ *

    (scheme vector s16) procedure (s16vector-map! (proc procedure?) (s16vec1 s16vector?) (s16vec2 s16vector?) ... ) ⟹ undefined

    (proc (val1 s16?) ... ) ⟹ *

    (scheme vector s16) procedure (s16vector-for-each (proc procedure?) (s16vec1 s16vector?) (s16vec2 s16vector?) ... ) ⟹ undefined

    (proc (val1 s16?) ... ) ⟹ undefined

    Iterate over the elements of s16vec and apply f to each, returning respectively a s16vector of the results, an undefined value with the results placed back in s16vec, and an undefined value with no change to s16vec.

    If more than one vector is passed, f gets one element from each vector as arguments. If the lengths of the vectors differ, iteration stops at the end of the shortest vector. For s16vector-map!, only s16vec is modified even when multiple vectors are passed.

    If s16vector-map or s16vector-map! returns more than once (i.e. because of a continuation captured by f), the values returned or stored by earlier returns may be mutated.

    (scheme vector s16) procedure (s16vector-count (pred? procedure?) (s16vec1 s16vector?) (s16vec2 s16vector?) ... ) ⟹ integer?

    (pred? (val1 s16?) (val2 s16?) ... ) ⟹ *

    Call pred? on each element of s16vec and return the number of calls that return true.

    When multiple vectors are given, pred? must take the same number of arguments as the number of vectors, and corresponding elements from each vector are given for each iteration, which stops at the end of the shortest vector.

    (scheme vector s16) procedure (s16vector-cumulate (f procedure?) knil (s16vec s16vector?) ) ⟹ s16vector?

    (f state (value s16?) ) ⟹ *

    Like s16vector-fold, but returns an s16vector of partial results rather than just the final result.

    (scheme vector s16) procedure (s16vector-take-while (pred? procedure?) (s16vec s16vector?) ) ⟹ s16vector?

    (pred? (value s16?) ) ⟹ boolean?

    (scheme vector s16) procedure (s16vector-take-while-right (pred? procedure?) (s16vec s16vector?) ) ⟹ s16vector?

    (pred? (value s16?) ) ⟹ boolean?

    Return the shortest prefix/suffix of s16vec all of whose elements satisfy pred?.

    (scheme vector s16) procedure (s16vector-drop-while (pred? procedure?) (s16vec s16vector?) ) ⟹ s16vector?

    (pred? (value s16?) ) ⟹ boolean?

    (scheme vector s16) procedure (s16vector-drop-while-right (pred? procedure?) (s16vec s16vector?) ) ⟹ s16vector?

    (pred? (value s16?) ) ⟹ boolean?

    Drops the longest initial prefix/suffix of s16vec such that all its elements satisfy pred.

    (scheme vector s16) procedure (s16vector-index (pred? procedure?) (s16vec1 s16vector?) (s16vec2 s16vector?) ... ) ⟹ integer? / #f /

    (pred? (value1 s16?) (value2 s16?) ... ) ⟹ *

    (scheme vector s16) procedure (s16vector-index-right (pred? procedure?) (s16vec1 s16vector?) (s16vec2 s16vector?) ... ) ⟹ integer? / #f /

    (pred? (value1 s16?) (value2 s16?) ... ) ⟹ *

    Return the index of the first/last element of s16vec that satisfies pred?.

    When multiple vectors are passed, pred? must take the same number of arguments as the number of vectors, and corresponding elements from each vector are passed for each iteration. If the lengths of vectors differ, s16vector-index stops iteration at the end of the shortest one. Lengths of vectors must be the same for s16vector-index-right.

    (scheme vector s16) procedure (s16vector-skip (pred? procedure?) (s16vec1 s16vector?) (s16vec2 s16vector?) ... ) ⟹ integer? / #f /

    (pred? (value1 s16?) (value2 s16?) ... ) ⟹ *

    (scheme vector s16) procedure (s16vector-skip-right (pred? procedure?) (s16vec1 s16vector?) (s16vec2 s16vector?) ... ) ⟹ integer? / #f /

    (pred? (value1 s16?) (value2 s16?) ... ) ⟹ *

    Returns the index of the first/last element of s16vec that does not satisfy pred?.

    When multiple vectors are passed, pred? must take the same number of arguments as the number of vectors, and corresponding elements from each vector are passed for each iteration. If the lengths of vectors differ, s16vector-skip stops iteration at the end of the shortest one. Lengths of vectors must be the same for s16vector-skip-right.

    (scheme vector s16) procedure (s16vector-any (pred? procedure?) (s16vec1 s16vector?) (s16vec2 s16vector?) ... ) ⟹ *

    (pred? (val1 s16?) (val2 s16?) ... ) ⟹ *

    Returns first non-false result of applying pred? on a element from the s16vec, or #f if there is no such element. If s16vec is empty, returns #t

    When multiple vectors are passed, pred? must take the same number of arguments as the number of vectors, and corresponding elements from each vector are passed for each iteration. If the lengths of vectors differ, it stops at the end of the shortest one.

    (scheme vector s16) procedure (s16vector-every (pred? procedure?) (s16vec1 s16vector?) (s16vec2 s16vector?) ... ) ⟹ *

    (pred? (val1 s16?) (val2 s16?) ... ) ⟹ *

    If all elements from s16vec satisfy pred?, return the last result of pred?. If not all do, return #f. If s16vec is empty, return #t

    When multiple vectors are passed, pred? must take the same number of arguments as the number of vectors, and corresponding elements from each vector is passed for each iteration. If the lengths of vectors differ, it stops at the end of the shortest one.

    (scheme vector s16) procedure (s16vector-partition (pred? procedure?) (s16vec s16vector?) ) ⟹ (values s16vector?integer?)

    (pred? (value s16?) ) ⟹ boolean?

    Returns an s16vector of the same type as s16vec, but with all elements satisfying pred? in the leftmost part of the vector and the other elements in the remaining part. The order of elements is otherwise preserved. Returns two values, the new s16vector and the number of elements satisfying pred?.

    (scheme vector s16) procedure (s16vector-filter (pred? procedure?) (s16vec1 s16vector?) ) ⟹ s16vector?

    (pred? (val s16?) ) ⟹ boolean?

    (scheme vector s16) procedure (s16vector-remove (pred? procedure?) (s16vec1 s16vector?) ) ⟹ s16vector?

    (pred? (val s16?) ) ⟹ boolean?

    Return an s16vector containing the elements of s16vec that satisfy / do not satisfy pred?.

    (scheme vector s16) procedure (s16vector-swap! (s16vec s16vector?) (i integer?) (j integer?) ) ⟹ undefined

    Interchanges the ith and jth elements of s16vec.

    (scheme vector s16) procedure (s16vector-fill! (s16vec s16vector?) (fill s16?) ) ⟹ undefined

    (scheme vector s16) procedure (s16vector-fill! (s16vec s16vector?) (fill s16?) (start integer?) ) ⟹ undefined

    (scheme vector s16) procedure (s16vector-fill! (s16vec s16vector?) (fill s16?) (start integer?) (end integer?) ) ⟹ undefined

    Fills the portion of s16vec from start to end with the value fill.

    (scheme vector s16) procedure (s16vector-reverse! (s16vec s16vector?) ) ⟹ undefined

    (scheme vector s16) procedure (s16vector-reverse! (s16vec s16vector?) (start integer?) ) ⟹ undefined

    (scheme vector s16) procedure (s16vector-reverse! (s16vec s16vector?) (start integer?) (end integer?) ) ⟹ undefined

    Reverses the portion of s16vec from start to end.

    (scheme vector s16) procedure (s16vector-copy! (s16to s16vector?) (at integer?) (s16from s16vector?) ) ⟹ undefined

    (scheme vector s16) procedure (s16vector-copy! (s16to s16vector?) (at integer?) (s16from s16vector?) (start integer?) ) ⟹ undefined

    (scheme vector s16) procedure (s16vector-copy! (s16to s16vector?) (at integer?) (s16from s16vector?) (start integer?) (end integer?) ) ⟹ undefined

    Copies the portion of s16from from start to end onto s16to, starting at index at.

    (scheme vector s16) procedure (s16vector-reverse-copy! (s16to s16vector?) (at integer?) (s16from s16vector?) ) ⟹ undefined

    (scheme vector s16) procedure (s16vector-reverse-copy! (s16to s16vector?) (at integer?) (s16from s16vector?) (start integer?) ) ⟹ undefined

    (scheme vector s16) procedure (s16vector-reverse-copy! (s16to s16vector?) (at integer?) (s16from s16vector?) (start integer?) (end integer?) ) ⟹ undefined

    The same as s16vector-copy!, but copies in reverse

    (scheme vector s16) procedure (s16vector-unfold! (f procedure?) (s16vec s16vector?) (start integer?) (end integer?) initial-seed ... ) ⟹ undefined

    (f (index integer?) seed ... ) ⟹ (values **...)

    Like s16vector-unfold, but the elements are copied into the vector s16vec starting at element start rather than into a newly allocated vector. Terminates when end - start elements have been generated.

    (scheme vector s16) procedure (s16vector-unfold-right! (f procedure?) (s16vec s16vector?) (start integer?) (end integer?) initial-seed ... ) ⟹ undefined

    (f (index integer?) seed ... ) ⟹ (values **...)

    The same as s16vector-unfold!, but initializes the s16vector from right to left.

    (scheme vector s16) procedure (reverse-s16vector->list (s16vec s16vector?) ) ⟹ list?

    (scheme vector s16) procedure (reverse-s16vector->list (s16vec s16vector?) (start integer?) ) ⟹ list?

    (scheme vector s16) procedure (reverse-s16vector->list (s16vec s16vector?) (start integer?) (end integer?) ) ⟹ list?

    Returns a list with same elements as s16vec in reverse order.

    (scheme vector s16) procedure (reverse-list->s16vector (proper-list list?) ) ⟹ s16vector?

    Returns s16vector with same elements as list in reverse order.

    (scheme vector s16) procedure (s16vector->vector (s16vec s16vector?) ) ⟹ vector?

    (scheme vector s16) procedure (s16vector->vector (s16vec s16vector?) (start integer?) ) ⟹ vector?

    (scheme vector s16) procedure (s16vector->vector (s16vec s16vector?) (start integer?) (end integer?) ) ⟹ vector?

    Returns vector with same elements as s16vec.

    (scheme vector s16) procedure (vector->s16vector (vec vector?) ) ⟹ s16vector?

    (scheme vector s16) procedure (vector->s16vector (vec vector?) (start integer?) ) ⟹ s16vector?

    (scheme vector s16) procedure (vector->s16vector (vec vector?) (start integer?) (end integer?) ) ⟹ s16vector?

    Returns s16vector with same elements as vec.

    (scheme vector s16) procedure (make-s16vector-generator (s16vector s16vector?) ) ⟹ procedure?

    (return ) ⟹ eof-object? / s16? /

    Returns a SRFI 121 generator that generates all the values of s16vector in order. Note that the generator is finite.

    s16vector-comparatorcomparator?

    Variable containing a SRFI 128 comparator whose components provide ordering and hashing of s16vector.

    (scheme vector s16) procedure (write-s16vector (s16vec s16vector) ) ⟹ undefined

    (scheme vector s16) procedure (write-s16vector (s16vec s16vector) (port output-port?) ) ⟹ undefined

    Prints to port (the current output port by default) a representation of s16vec in the lexical syntax explained below.

    library (scheme vector u32)

    (scheme vector u32) procedure (make-u32vector (size integer?) ) ⟹ u32vector?

    (scheme vector u32) procedure (make-u32vector (size integer?) (fill u32?) ) ⟹ u32vector?

    Returns a u32vector whose length is size. If fill is provided, all the elements of the u32vector are initialized to it.

    (scheme vector u32) procedure (u32vector (value u32?) ... ) ⟹ u32vector?

    Returns a u32vector initialized with values.

    (scheme vector u32) procedure (u32vector? obj ) ⟹ boolean?

    Returns #t if obj is a u32vector, and #f otherwise.

    (scheme vector u32) procedure (u32vector-length (u32vec u32vector?) ) ⟹ integer?

    Returns the length of u32vec

    (scheme vector u32) procedure (u32vector-ref (u32vec u32vector?) (i integer?) ) ⟹ u32?

    Returns the ith element of u32vec.

    (scheme vector u32) procedure (u32vector-set! (u32vec u32vector?) (i integer?) (value u32?) ) ⟹ undefined

    Sets the ith element of u32vec to value.

    (scheme vector u32) procedure (u32vector->list (u32vec u32vector?) ) ⟹ list?

    (scheme vector u32) procedure (u32vector->list (u32vec u32vector?) (start integer?) ) ⟹ list?

    (scheme vector u32) procedure (u32vector->list (u32vec u32vector?) (start integer?) (end integer?) ) ⟹ list?

    Returns a list with same elements as u32vec

    (scheme vector u32) procedure (list->u32vector (proper-list list?) ) ⟹ u32vector?

    proper-list ⟹ (list u32?)

    Returns u32vector with same elements as list.

    (scheme vector u32) procedure (u32? obj ) ⟹ boolean?

    Returns #t if obj is a valid element of an u32vector (ie., unsigned exact integer in the range 0 to (2^32)-1), and #f otherwise.

    (scheme vector u32) procedure (u32vector-unfold (f procedure?) (length integer?) seed ) ⟹ u32vector?

    (scheme vector u32) procedure (u32vector-unfold (f procedure?) (length integer?) seed ) ⟹ u32vector?

    (f (index integer?) state ) ⟹ (values u32?*)

    Creates a vector whose length is length and iterates across each index k between 0 and length - 1, applying f at each iteration to the current index and current state, in that order, to receive two values: the element to put in the kth slot of the new vector and a new state for the next iteration. On the first call to f, the state's value is seed.

    (scheme vector u32) procedure (u32vector-copy (u32vec u32vector?) ) ⟹ u32vector?

    (scheme vector u32) procedure (u32vector-copy (u32vec u32vector?) (start integer?) ) ⟹ u32vector?

    (scheme vector u32) procedure (u32vector-copy (u32vec u32vector?) (start integer?) (end integer?) ) ⟹ u32vector?

    Makes a copy of the portion of u32vec from start to end and returns it.

    (scheme vector u32) procedure (u32vector-reverse-copy (u32vec u32vector?) ) ⟹ u32vector?

    (scheme vector u32) procedure (u32vector-reverse-copy (u32vec u32vector?) (start integer?) ) ⟹ u32vector?

    (scheme vector u32) procedure (u32vector-reverse-copy (u32vec u32vector?) (start integer?) (end integer?) ) ⟹ u32vector?

    The same as u32vector-copy, but in reverse order.

    (scheme vector u32) procedure (u32vector-append (u32vec u32vector?) ... ) ⟹ u32vector?

    Returns a u32vector containing all the elements of the u32vecs in order.

    (scheme vector u32) procedure (u32vector-concatenate (list-of-u32vectors list?) ) ⟹ u32vector?

    list-of-u32vectors ⟹ (list u32vector?)

    The same as u32vector-append, but takes a list of u32vectors rather than multiple arguments.

    (scheme vector u32) procedure (u32vector-append-subvectors (u32vec1 u32vector?) (start1 integer?) (end1 integer?) ... ) ⟹ u32vector?

    Concatenates the result of applying u32vector-copy to each triplet of u32vec, start, end arguments, but may be implemented more efficiently.

    (scheme vector u32) procedure (u32vector-empty? (u32vec u32vector?) ) ⟹ boolean?

    Returns #t if u32vec has a length of zero, and #f otherwise.

    (scheme vector u32) procedure (u32vector= (u32vec u32vector?) ... ) ⟹ boolean?

    Compares the u32vecs for elementwise equality, using = to do the comparisons. Returns #f unless all u32vectors are the same length.

    (scheme vector u32) procedure (u32vector-take (u32vec u32vector?) (n integer?) ) ⟹ u32vector?

    (scheme vector u32) procedure (u32vector-take-right (u32vec u32vector?) (n integer?) ) ⟹ u32vector?

    Returns a u32vector containing the first/last n elements of u32vec.

    (scheme vector u32) procedure (u32vector-drop (u32vec u32vector?) (n integer?) ) ⟹ u32vector?

    (scheme vector u32) procedure (u32vector-drop-right (u32vec u32vector?) (n integer?) ) ⟹ u32vector?

    Returns a u32vector containing all except the first/last n elements of u32vec.

    (scheme vector u32) procedure (u32vector-segment (u32vec u32vector?) (n integer?) ) ⟹ list?

    Returns a list of u32vectors, each of which contains n consecutive elements of u32vec. The last u32vector may be shorter than n. It is an error if n is not an exact positive integer.

    (scheme vector u32) procedure (u32vector-fold (kons procedure?) knil (u32vec1 u32vector?) (u32vec2 u32vector?) ... ) ⟹ *

    (kons state (obj1 u32?) (obj2 u32?) ... ) ⟹ *

    (scheme vector u32) procedure (u32vector-fold-right (kons procedure?) knil (u32vec1 u32vector?) (u32vec2 u32vector?) ... ) ⟹ *

    (kons state (obj1 u32?) (obj2 u32?) ... ) ⟹ *

    When one u32vector argument u32vec is given, folds kons over the elements of u32vec in increasing/decreasing order using knil as the initial value. The kons procedure is called with the state first and the element second, as in SRFIs 43 and 133 (heterogeneous vectors). This is the opposite order to that used in SRFI 1 (lists) and the various string SRFIs.

    When multiple u32vector arguments are given, kons is called with the current state value and each value from all the vectors; u32vector-fold scans elements from left to right, while u32vector-fold-right does from right to left. If the lengths of vectors differ, only the portion of each vector up to the length of the shortest vector is scanned.

    (scheme vector u32) procedure (u32vector-map (proc procedure?) (u32vec1 u32vector?) (u32vec2 u32vector?) ... ) ⟹ vector?

    (proc (val1 u32?) ... ) ⟹ *

    (scheme vector u32) procedure (u32vector-map! (proc procedure?) (u32vec1 u32vector?) (u32vec2 u32vector?) ... ) ⟹ undefined

    (proc (val1 u32?) ... ) ⟹ *

    (scheme vector u32) procedure (u32vector-for-each (proc procedure?) (u32vec1 u32vector?) (u32vec2 u32vector?) ... ) ⟹ undefined

    (proc (val1 u32?) ... ) ⟹ undefined

    Iterate over the elements of u32vec and apply f to each, returning respectively a u32vector of the results, an undefined value with the results placed back in u32vec, and an undefined value with no change to u32vec.

    If more than one vector is passed, f gets one element from each vector as arguments. If the lengths of the vectors differ, iteration stops at the end of the shortest vector. For u32vector-map!, only u32vec is modified even when multiple vectors are passed.

    If u32vector-map or u32vector-map! returns more than once (i.e. because of a continuation captured by f), the values returned or stored by earlier returns may be mutated.

    (scheme vector u32) procedure (u32vector-count (pred? procedure?) (u32vec1 u32vector?) (u32vec2 u32vector?) ... ) ⟹ integer?

    (pred? (val1 u32?) (val2 u32?) ... ) ⟹ *

    Call pred? on each element of u32vec and return the number of calls that return true.

    When multiple vectors are given, pred? must take the same number of arguments as the number of vectors, and corresponding elements from each vector are given for each iteration, which stops at the end of the shortest vector.

    (scheme vector u32) procedure (u32vector-cumulate (f procedure?) knil (u32vec u32vector?) ) ⟹ u32vector?

    (f state (value u32?) ) ⟹ *

    Like u32vector-fold, but returns an u32vector of partial results rather than just the final result.

    (scheme vector u32) procedure (u32vector-take-while (pred? procedure?) (u32vec u32vector?) ) ⟹ u32vector?

    (pred? (value u32?) ) ⟹ boolean?

    (scheme vector u32) procedure (u32vector-take-while-right (pred? procedure?) (u32vec u32vector?) ) ⟹ u32vector?

    (pred? (value u32?) ) ⟹ boolean?

    Return the shortest prefix/suffix of u32vec all of whose elements satisfy pred?.

    (scheme vector u32) procedure (u32vector-drop-while (pred? procedure?) (u32vec u32vector?) ) ⟹ u32vector?

    (pred? (value u32?) ) ⟹ boolean?

    (scheme vector u32) procedure (u32vector-drop-while-right (pred? procedure?) (u32vec u32vector?) ) ⟹ u32vector?

    (pred? (value u32?) ) ⟹ boolean?

    Drops the longest initial prefix/suffix of u32vec such that all its elements satisfy pred.

    (scheme vector u32) procedure (u32vector-index (pred? procedure?) (u32vec1 u32vector?) (u32vec2 u32vector?) ... ) ⟹ integer? / #f /

    (pred? (value1 u32?) (value2 u32?) ... ) ⟹ *

    (scheme vector u32) procedure (u32vector-index-right (pred? procedure?) (u32vec1 u32vector?) (u32vec2 u32vector?) ... ) ⟹ integer? / #f /

    (pred? (value1 u32?) (value2 u32?) ... ) ⟹ *

    Return the index of the first/last element of u32vec that satisfies pred?.

    When multiple vectors are passed, pred? must take the same number of arguments as the number of vectors, and corresponding elements from each vector are passed for each iteration. If the lengths of vectors differ, u32vector-index stops iteration at the end of the shortest one. Lengths of vectors must be the same for u32vector-index-right.

    (scheme vector u32) procedure (u32vector-skip (pred? procedure?) (u32vec1 u32vector?) (u32vec2 u32vector?) ... ) ⟹ integer? / #f /

    (pred? (value1 u32?) (value2 u32?) ... ) ⟹ *

    (scheme vector u32) procedure (u32vector-skip-right (pred? procedure?) (u32vec1 u32vector?) (u32vec2 u32vector?) ... ) ⟹ integer? / #f /

    (pred? (value1 u32?) (value2 u32?) ... ) ⟹ *

    Returns the index of the first/last element of u32vec that does not satisfy pred?.

    When multiple vectors are passed, pred? must take the same number of arguments as the number of vectors, and corresponding elements from each vector are passed for each iteration. If the lengths of vectors differ, u32vector-skip stops iteration at the end of the shortest one. Lengths of vectors must be the same for u32vector-skip-right.

    (scheme vector u32) procedure (u32vector-any (pred? procedure?) (u32vec1 u32vector?) (u32vec2 u32vector?) ... ) ⟹ *

    (pred? (val1 u32?) (val2 u32?) ... ) ⟹ *

    Returns first non-false result of applying pred? on a element from the u32vec, or #f if there is no such element. If u32vec is empty, returns #t

    When multiple vectors are passed, pred? must take the same number of arguments as the number of vectors, and corresponding elements from each vector are passed for each iteration. If the lengths of vectors differ, it stops at the end of the shortest one.

    (scheme vector u32) procedure (u32vector-every (pred? procedure?) (u32vec1 u32vector?) (u32vec2 u32vector?) ... ) ⟹ *

    (pred? (val1 u32?) (val2 u32?) ... ) ⟹ *

    If all elements from u32vec satisfy pred?, return the last result of pred?. If not all do, return #f. If u32vec is empty, return #t

    When multiple vectors are passed, pred? must take the same number of arguments as the number of vectors, and corresponding elements from each vector is passed for each iteration. If the lengths of vectors differ, it stops at the end of the shortest one.

    (scheme vector u32) procedure (u32vector-partition (pred? procedure?) (u32vec u32vector?) ) ⟹ (values u32vector?integer?)

    (pred? (value u32?) ) ⟹ boolean?

    Returns an u32vector of the same type as u32vec, but with all elements satisfying pred? in the leftmost part of the vector and the other elements in the remaining part. The order of elements is otherwise preserved. Returns two values, the new u32vector and the number of elements satisfying pred?.

    (scheme vector u32) procedure (u32vector-filter (pred? procedure?) (u32vec1 u32vector?) ) ⟹ u32vector?

    (pred? (val u32?) ) ⟹ boolean?

    (scheme vector u32) procedure (u32vector-remove (pred? procedure?) (u32vec1 u32vector?) ) ⟹ u32vector?

    (pred? (val u32?) ) ⟹ boolean?

    Return an u32vector containing the elements of u32vec that satisfy / do not satisfy pred?.

    (scheme vector u32) procedure (u32vector-swap! (u32vec u32vector?) (i integer?) (j integer?) ) ⟹ undefined

    Interchanges the ith and jth elements of u32vec.

    (scheme vector u32) procedure (u32vector-fill! (u32vec u32vector?) (fill u32?) ) ⟹ undefined

    (scheme vector u32) procedure (u32vector-fill! (u32vec u32vector?) (fill u32?) (start integer?) ) ⟹ undefined

    (scheme vector u32) procedure (u32vector-fill! (u32vec u32vector?) (fill u32?) (start integer?) (end integer?) ) ⟹ undefined

    Fills the portion of u32vec from start to end with the value fill.

    (scheme vector u32) procedure (u32vector-reverse! (u32vec u32vector?) ) ⟹ undefined

    (scheme vector u32) procedure (u32vector-reverse! (u32vec u32vector?) (start integer?) ) ⟹ undefined

    (scheme vector u32) procedure (u32vector-reverse! (u32vec u32vector?) (start integer?) (end integer?) ) ⟹ undefined

    Reverses the portion of u32vec from start to end.

    (scheme vector u32) procedure (u32vector-copy! (u32to u32vector?) (at integer?) (u32from u32vector?) ) ⟹ undefined

    (scheme vector u32) procedure (u32vector-copy! (u32to u32vector?) (at integer?) (u32from u32vector?) (start integer?) ) ⟹ undefined

    (scheme vector u32) procedure (u32vector-copy! (u32to u32vector?) (at integer?) (u32from u32vector?) (start integer?) (end integer?) ) ⟹ undefined

    Copies the portion of u32from from start to end onto u32to, starting at index at.

    (scheme vector u32) procedure (u32vector-reverse-copy! (u32to u32vector?) (at integer?) (u32from u32vector?) ) ⟹ undefined

    (scheme vector u32) procedure (u32vector-reverse-copy! (u32to u32vector?) (at integer?) (u32from u32vector?) (start integer?) ) ⟹ undefined

    (scheme vector u32) procedure (u32vector-reverse-copy! (u32to u32vector?) (at integer?) (u32from u32vector?) (start integer?) (end integer?) ) ⟹ undefined

    The same as u32vector-copy!, but copies in reverse

    (scheme vector u32) procedure (u32vector-unfold! (f procedure?) (u32vec u32vector?) (start integer?) (end integer?) initial-seed ... ) ⟹ undefined

    (f (index integer?) seed ... ) ⟹ (values **...)

    Like u32vector-unfold, but the elements are copied into the vector u32vec starting at element start rather than into a newly allocated vector. Terminates when end - start elements have been generated.

    (scheme vector u32) procedure (u32vector-unfold-right! (f procedure?) (u32vec u32vector?) (start integer?) (end integer?) initial-seed ... ) ⟹ undefined

    (f (index integer?) seed ... ) ⟹ (values **...)

    The same as u32vector-unfold!, but initializes the u32vector from right to left.

    (scheme vector u32) procedure (reverse-u32vector->list (u32vec u32vector?) ) ⟹ list?

    (scheme vector u32) procedure (reverse-u32vector->list (u32vec u32vector?) (start integer?) ) ⟹ list?

    (scheme vector u32) procedure (reverse-u32vector->list (u32vec u32vector?) (start integer?) (end integer?) ) ⟹ list?

    Returns a list with same elements as u32vec in reverse order.

    (scheme vector u32) procedure (reverse-list->u32vector (proper-list list?) ) ⟹ u32vector?

    Returns u32vector with same elements as list in reverse order.

    (scheme vector u32) procedure (u32vector->vector (u32vec u32vector?) ) ⟹ vector?

    (scheme vector u32) procedure (u32vector->vector (u32vec u32vector?) (start integer?) ) ⟹ vector?

    (scheme vector u32) procedure (u32vector->vector (u32vec u32vector?) (start integer?) (end integer?) ) ⟹ vector?

    Returns vector with same elements as u32vec.

    (scheme vector u32) procedure (vector->u32vector (vec vector?) ) ⟹ u32vector?

    (scheme vector u32) procedure (vector->u32vector (vec vector?) (start integer?) ) ⟹ u32vector?

    (scheme vector u32) procedure (vector->u32vector (vec vector?) (start integer?) (end integer?) ) ⟹ u32vector?

    Returns u32vector with same elements as vec.

    (scheme vector u32) procedure (make-u32vector-generator (u32vector u32vector?) ) ⟹ procedure?

    (return ) ⟹ eof-object? / u32? /

    Returns a SRFI 121 generator that generates all the values of u32vector in order. Note that the generator is finite.

    u32vector-comparatorcomparator?

    Variable containing a SRFI 128 comparator whose components provide ordering and hashing of u32vector.

    (scheme vector u32) procedure (write-u32vector (u32vec u32vector) ) ⟹ undefined

    (scheme vector u32) procedure (write-u32vector (u32vec u32vector) (port output-port?) ) ⟹ undefined

    Prints to port (the current output port by default) a representation of u32vec in the lexical syntax explained below.

    library (scheme vector s32)

    (scheme vector s32) procedure (make-s32vector (size integer?) ) ⟹ s32vector?

    (scheme vector s32) procedure (make-s32vector (size integer?) (fill s32?) ) ⟹ s32vector?

    Returns a s32vector whose length is size. If fill is provided, all the elements of the s32vector are initialized to it.

    (scheme vector s32) procedure (s32vector (value s32?) ... ) ⟹ s32vector?

    Returns a s32vector initialized with values.

    (scheme vector s32) procedure (s32vector? obj ) ⟹ boolean?

    Returns #t if obj is a s32vector, and #f otherwise.

    (scheme vector s32) procedure (s32vector-length (s32vec s32vector?) ) ⟹ integer?

    Returns the length of s32vec

    (scheme vector s32) procedure (s32vector-ref (s32vec s32vector?) (i integer?) ) ⟹ s32?

    Returns the ith element of s32vec.

    (scheme vector s32) procedure (s32vector-set! (s32vec s32vector?) (i integer?) (value s32?) ) ⟹ undefined

    Sets the ith element of s32vec to value.

    (scheme vector s32) procedure (s32vector->list (s32vec s32vector?) ) ⟹ list?

    (scheme vector s32) procedure (s32vector->list (s32vec s32vector?) (start integer?) ) ⟹ list?

    (scheme vector s32) procedure (s32vector->list (s32vec s32vector?) (start integer?) (end integer?) ) ⟹ list?

    Returns a list with same elements as s32vec

    (scheme vector s32) procedure (list->s32vector (proper-list list?) ) ⟹ s32vector?

    proper-list ⟹ (list s32?)

    Returns s32vector with same elements as list.

    (scheme vector s32) procedure (s32? obj ) ⟹ boolean?

    Returns #t if obj is a valid element of an s32vector (ie., signed exact integer in the range -(2^31) to (2^31)-1), and #f otherwise.

    (scheme vector s32) procedure (s32vector-unfold (f procedure?) (length integer?) seed ) ⟹ s32vector?

    (scheme vector s32) procedure (s32vector-unfold (f procedure?) (length integer?) seed ) ⟹ s32vector?

    (f (index integer?) state ) ⟹ (values s32?*)

    Creates a vector whose length is length and iterates across each index k between 0 and length - 1, applying f at each iteration to the current index and current state, in that order, to receive two values: the element to put in the kth slot of the new vector and a new state for the next iteration. On the first call to f, the state's value is seed.

    (scheme vector s32) procedure (s32vector-copy (s32vec s32vector?) ) ⟹ s32vector?

    (scheme vector s32) procedure (s32vector-copy (s32vec s32vector?) (start integer?) ) ⟹ s32vector?

    (scheme vector s32) procedure (s32vector-copy (s32vec s32vector?) (start integer?) (end integer?) ) ⟹ s32vector?

    Makes a copy of the portion of s32vec from start to end and returns it.

    (scheme vector s32) procedure (s32vector-reverse-copy (s32vec s32vector?) ) ⟹ s32vector?

    (scheme vector s32) procedure (s32vector-reverse-copy (s32vec s32vector?) (start integer?) ) ⟹ s32vector?

    (scheme vector s32) procedure (s32vector-reverse-copy (s32vec s32vector?) (start integer?) (end integer?) ) ⟹ s32vector?

    The same as s32vector-copy, but in reverse order.

    (scheme vector s32) procedure (s32vector-append (s32vec s32vector?) ... ) ⟹ s32vector?

    Returns a s32vector containing all the elements of the s32vecs in order.

    (scheme vector s32) procedure (s32vector-concatenate (list-of-s32vectors list?) ) ⟹ s32vector?

    list-of-s32vectors ⟹ (list s32vector?)

    The same as s32vector-append, but takes a list of s32vectors rather than multiple arguments.

    (scheme vector s32) procedure (s32vector-append-subvectors (s32vec1 s32vector?) (start1 integer?) (end1 integer?) ... ) ⟹ s32vector?

    Concatenates the result of applying s32vector-copy to each triplet of s32vec, start, end arguments, but may be implemented more efficiently.

    (scheme vector s32) procedure (s32vector-empty? (s32vec s32vector?) ) ⟹ boolean?

    Returns #t if s32vec has a length of zero, and #f otherwise.

    (scheme vector s32) procedure (s32vector= (s32vec s32vector?) ... ) ⟹ boolean?

    Compares the s32vecs for elementwise equality, using = to do the comparisons. Returns #f unless all s32vectors are the same length.

    (scheme vector s32) procedure (s32vector-take (s32vec s32vector?) (n integer?) ) ⟹ s32vector?

    (scheme vector s32) procedure (s32vector-take-right (s32vec s32vector?) (n integer?) ) ⟹ s32vector?

    Returns a s32vector containing the first/last n elements of s32vec.

    (scheme vector s32) procedure (s32vector-drop (s32vec s32vector?) (n integer?) ) ⟹ s32vector?

    (scheme vector s32) procedure (s32vector-drop-right (s32vec s32vector?) (n integer?) ) ⟹ s32vector?

    Returns a s32vector containing all except the first/last n elements of s32vec.

    (scheme vector s32) procedure (s32vector-segment (s32vec s32vector?) (n integer?) ) ⟹ list?

    Returns a list of s32vectors, each of which contains n consecutive elements of s32vec. The last s32vector may be shorter than n. It is an error if n is not an exact positive integer.

    (scheme vector s32) procedure (s32vector-fold (kons procedure?) knil (s32vec1 s32vector?) (s32vec2 s32vector?) ... ) ⟹ *

    (kons state (obj1 s32?) (obj2 s32?) ... ) ⟹ *

    (scheme vector s32) procedure (s32vector-fold-right (kons procedure?) knil (s32vec1 s32vector?) (s32vec2 s32vector?) ... ) ⟹ *

    (kons state (obj1 s32?) (obj2 s32?) ... ) ⟹ *

    When one s32vector argument s32vec is given, folds kons over the elements of s32vec in increasing/decreasing order using knil as the initial value. The kons procedure is called with the state first and the element second, as in SRFIs 43 and 133 (heterogeneous vectors). This is the opposite order to that used in SRFI 1 (lists) and the various string SRFIs.

    When multiple s32vector arguments are given, kons is called with the current state value and each value from all the vectors; s32vector-fold scans elements from left to right, while s32vector-fold-right does from right to left. If the lengths of vectors differ, only the portion of each vector up to the length of the shortest vector is scanned.

    (scheme vector s32) procedure (s32vector-map (proc procedure?) (s32vec1 s32vector?) (s32vec2 s32vector?) ... ) ⟹ vector?

    (proc (val1 s32?) ... ) ⟹ *

    (scheme vector s32) procedure (s32vector-map! (proc procedure?) (s32vec1 s32vector?) (s32vec2 s32vector?) ... ) ⟹ undefined

    (proc (val1 s32?) ... ) ⟹ *

    (scheme vector s32) procedure (s32vector-for-each (proc procedure?) (s32vec1 s32vector?) (s32vec2 s32vector?) ... ) ⟹ undefined

    (proc (val1 s32?) ... ) ⟹ undefined

    Iterate over the elements of s32vec and apply f to each, returning respectively a s32vector of the results, an undefined value with the results placed back in s32vec, and an undefined value with no change to s32vec.

    If more than one vector is passed, f gets one element from each vector as arguments. If the lengths of the vectors differ, iteration stops at the end of the shortest vector. For s32vector-map!, only s32vec is modified even when multiple vectors are passed.

    If s32vector-map or s32vector-map! returns more than once (i.e. because of a continuation captured by f), the values returned or stored by earlier returns may be mutated.

    (scheme vector s32) procedure (s32vector-count (pred? procedure?) (s32vec1 s32vector?) (s32vec2 s32vector?) ... ) ⟹ integer?

    (pred? (val1 s32?) (val2 s32?) ... ) ⟹ *

    Call pred? on each element of s32vec and return the number of calls that return true.

    When multiple vectors are given, pred? must take the same number of arguments as the number of vectors, and corresponding elements from each vector are given for each iteration, which stops at the end of the shortest vector.

    (scheme vector s32) procedure (s32vector-cumulate (f procedure?) knil (s32vec s32vector?) ) ⟹ s32vector?

    (f state (value s32?) ) ⟹ *

    Like s32vector-fold, but returns an s32vector of partial results rather than just the final result.

    (scheme vector s32) procedure (s32vector-take-while (pred? procedure?) (s32vec s32vector?) ) ⟹ s32vector?

    (pred? (value s32?) ) ⟹ boolean?

    (scheme vector s32) procedure (s32vector-take-while-right (pred? procedure?) (s32vec s32vector?) ) ⟹ s32vector?

    (pred? (value s32?) ) ⟹ boolean?

    Return the shortest prefix/suffix of s32vec all of whose elements satisfy pred?.

    (scheme vector s32) procedure (s32vector-drop-while (pred? procedure?) (s32vec s32vector?) ) ⟹ s32vector?

    (pred? (value s32?) ) ⟹ boolean?

    (scheme vector s32) procedure (s32vector-drop-while-right (pred? procedure?) (s32vec s32vector?) ) ⟹ s32vector?

    (pred? (value s32?) ) ⟹ boolean?

    Drops the longest initial prefix/suffix of s32vec such that all its elements satisfy pred.

    (scheme vector s32) procedure (s32vector-index (pred? procedure?) (s32vec1 s32vector?) (s32vec2 s32vector?) ... ) ⟹ integer? / #f /

    (pred? (value1 s32?) (value2 s32?) ... ) ⟹ *

    (scheme vector s32) procedure (s32vector-index-right (pred? procedure?) (s32vec1 s32vector?) (s32vec2 s32vector?) ... ) ⟹ integer? / #f /

    (pred? (value1 s32?) (value2 s32?) ... ) ⟹ *

    Return the index of the first/last element of s32vec that satisfies pred?.

    When multiple vectors are passed, pred? must take the same number of arguments as the number of vectors, and corresponding elements from each vector are passed for each iteration. If the lengths of vectors differ, s32vector-index stops iteration at the end of the shortest one. Lengths of vectors must be the same for s32vector-index-right.

    (scheme vector s32) procedure (s32vector-skip (pred? procedure?) (s32vec1 s32vector?) (s32vec2 s32vector?) ... ) ⟹ integer? / #f /

    (pred? (value1 s32?) (value2 s32?) ... ) ⟹ *

    (scheme vector s32) procedure (s32vector-skip-right (pred? procedure?) (s32vec1 s32vector?) (s32vec2 s32vector?) ... ) ⟹ integer? / #f /

    (pred? (value1 s32?) (value2 s32?) ... ) ⟹ *

    Returns the index of the first/last element of s32vec that does not satisfy pred?.

    When multiple vectors are passed, pred? must take the same number of arguments as the number of vectors, and corresponding elements from each vector are passed for each iteration. If the lengths of vectors differ, s32vector-skip stops iteration at the end of the shortest one. Lengths of vectors must be the same for s32vector-skip-right.

    (scheme vector s32) procedure (s32vector-any (pred? procedure?) (s32vec1 s32vector?) (s32vec2 s32vector?) ... ) ⟹ *

    (pred? (val1 s32?) (val2 s32?) ... ) ⟹ *

    Returns first non-false result of applying pred? on a element from the s32vec, or #f if there is no such element. If s32vec is empty, returns #t

    When multiple vectors are passed, pred? must take the same number of arguments as the number of vectors, and corresponding elements from each vector are passed for each iteration. If the lengths of vectors differ, it stops at the end of the shortest one.

    (scheme vector s32) procedure (s32vector-every (pred? procedure?) (s32vec1 s32vector?) (s32vec2 s32vector?) ... ) ⟹ *

    (pred? (val1 s32?) (val2 s32?) ... ) ⟹ *

    If all elements from s32vec satisfy pred?, return the last result of pred?. If not all do, return #f. If s32vec is empty, return #t

    When multiple vectors are passed, pred? must take the same number of arguments as the number of vectors, and corresponding elements from each vector is passed for each iteration. If the lengths of vectors differ, it stops at the end of the shortest one.

    (scheme vector s32) procedure (s32vector-partition (pred? procedure?) (s32vec s32vector?) ) ⟹ (values s32vector?integer?)

    (pred? (value s32?) ) ⟹ boolean?

    Returns an s32vector of the same type as s32vec, but with all elements satisfying pred? in the leftmost part of the vector and the other elements in the remaining part. The order of elements is otherwise preserved. Returns two values, the new s32vector and the number of elements satisfying pred?.

    (scheme vector s32) procedure (s32vector-filter (pred? procedure?) (s32vec1 s32vector?) ) ⟹ s32vector?

    (pred? (val s32?) ) ⟹ boolean?

    (scheme vector s32) procedure (s32vector-remove (pred? procedure?) (s32vec1 s32vector?) ) ⟹ s32vector?

    (pred? (val s32?) ) ⟹ boolean?

    Return an s32vector containing the elements of s32vec that satisfy / do not satisfy pred?.

    (scheme vector s32) procedure (s32vector-swap! (s32vec s32vector?) (i integer?) (j integer?) ) ⟹ undefined

    Interchanges the ith and jth elements of s32vec.

    (scheme vector s32) procedure (s32vector-fill! (s32vec s32vector?) (fill s32?) ) ⟹ undefined

    (scheme vector s32) procedure (s32vector-fill! (s32vec s32vector?) (fill s32?) (start integer?) ) ⟹ undefined

    (scheme vector s32) procedure (s32vector-fill! (s32vec s32vector?) (fill s32?) (start integer?) (end integer?) ) ⟹ undefined

    Fills the portion of s32vec from start to end with the value fill.

    (scheme vector s32) procedure (s32vector-reverse! (s32vec s32vector?) ) ⟹ undefined

    (scheme vector s32) procedure (s32vector-reverse! (s32vec s32vector?) (start integer?) ) ⟹ undefined

    (scheme vector s32) procedure (s32vector-reverse! (s32vec s32vector?) (start integer?) (end integer?) ) ⟹ undefined

    Reverses the portion of s32vec from start to end.

    (scheme vector s32) procedure (s32vector-copy! (s32to s32vector?) (at integer?) (s32from s32vector?) ) ⟹ undefined

    (scheme vector s32) procedure (s32vector-copy! (s32to s32vector?) (at integer?) (s32from s32vector?) (start integer?) ) ⟹ undefined

    (scheme vector s32) procedure (s32vector-copy! (s32to s32vector?) (at integer?) (s32from s32vector?) (start integer?) (end integer?) ) ⟹ undefined

    Copies the portion of s32from from start to end onto s32to, starting at index at.

    (scheme vector s32) procedure (s32vector-reverse-copy! (s32to s32vector?) (at integer?) (s32from s32vector?) ) ⟹ undefined

    (scheme vector s32) procedure (s32vector-reverse-copy! (s32to s32vector?) (at integer?) (s32from s32vector?) (start integer?) ) ⟹ undefined

    (scheme vector s32) procedure (s32vector-reverse-copy! (s32to s32vector?) (at integer?) (s32from s32vector?) (start integer?) (end integer?) ) ⟹ undefined

    The same as s32vector-copy!, but copies in reverse

    (scheme vector s32) procedure (s32vector-unfold! (f procedure?) (s32vec s32vector?) (start integer?) (end integer?) initial-seed ... ) ⟹ undefined

    (f (index integer?) seed ... ) ⟹ (values **...)

    Like s32vector-unfold, but the elements are copied into the vector s32vec starting at element start rather than into a newly allocated vector. Terminates when end - start elements have been generated.

    (scheme vector s32) procedure (s32vector-unfold-right! (f procedure?) (s32vec s32vector?) (start integer?) (end integer?) initial-seed ... ) ⟹ undefined

    (f (index integer?) seed ... ) ⟹ (values **...)

    The same as s32vector-unfold!, but initializes the s32vector from right to left.

    (scheme vector s32) procedure (reverse-s32vector->list (s32vec s32vector?) ) ⟹ list?

    (scheme vector s32) procedure (reverse-s32vector->list (s32vec s32vector?) (start integer?) ) ⟹ list?

    (scheme vector s32) procedure (reverse-s32vector->list (s32vec s32vector?) (start integer?) (end integer?) ) ⟹ list?

    Returns a list with same elements as s32vec in reverse order.

    (scheme vector s32) procedure (reverse-list->s32vector (proper-list list?) ) ⟹ s32vector?

    Returns s32vector with same elements as list in reverse order.

    (scheme vector s32) procedure (s32vector->vector (s32vec s32vector?) ) ⟹ vector?

    (scheme vector s32) procedure (s32vector->vector (s32vec s32vector?) (start integer?) ) ⟹ vector?

    (scheme vector s32) procedure (s32vector->vector (s32vec s32vector?) (start integer?) (end integer?) ) ⟹ vector?

    Returns vector with same elements as s32vec.

    (scheme vector s32) procedure (vector->s32vector (vec vector?) ) ⟹ s32vector?

    (scheme vector s32) procedure (vector->s32vector (vec vector?) (start integer?) ) ⟹ s32vector?

    (scheme vector s32) procedure (vector->s32vector (vec vector?) (start integer?) (end integer?) ) ⟹ s32vector?

    Returns s32vector with same elements as vec.

    (scheme vector s32) procedure (make-s32vector-generator (s32vector s32vector?) ) ⟹ procedure?

    (return ) ⟹ eof-object? / s32? /

    Returns a SRFI 121 generator that generates all the values of s32vector in order. Note that the generator is finite.

    s32vector-comparatorcomparator?

    Variable containing a SRFI 128 comparator whose components provide ordering and hashing of s32vector.

    (scheme vector s32) procedure (write-s32vector (s32vec s32vector) ) ⟹ undefined

    (scheme vector s32) procedure (write-s32vector (s32vec s32vector) (port output-port?) ) ⟹ undefined

    Prints to port (the current output port by default) a representation of s32vec in the lexical syntax explained below.

    library (scheme vector u64)

    (scheme vector u64) procedure (make-u64vector (size integer?) ) ⟹ u64vector?

    (scheme vector u64) procedure (make-u64vector (size integer?) (fill u64?) ) ⟹ u64vector?

    Returns a u64vector whose length is size. If fill is provided, all the elements of the u64vector are initialized to it.

    (scheme vector u64) procedure (u64vector (value u64?) ... ) ⟹ u64vector?

    Returns a u64vector initialized with values.

    (scheme vector u64) procedure (u64vector? obj ) ⟹ boolean?

    Returns #t if obj is a u64vector, and #f otherwise.

    (scheme vector u64) procedure (u64vector-length (u64vec u64vector?) ) ⟹ integer?

    Returns the length of u64vec

    (scheme vector u64) procedure (u64vector-ref (u64vec u64vector?) (i integer?) ) ⟹ u64?

    Returns the ith element of u64vec.

    (scheme vector u64) procedure (u64vector-set! (u64vec u64vector?) (i integer?) (value u64?) ) ⟹ undefined

    Sets the ith element of u64vec to value.

    (scheme vector u64) procedure (u64vector->list (u64vec u64vector?) ) ⟹ list?

    (scheme vector u64) procedure (u64vector->list (u64vec u64vector?) (start integer?) ) ⟹ list?

    (scheme vector u64) procedure (u64vector->list (u64vec u64vector?) (start integer?) (end integer?) ) ⟹ list?

    Returns a list with same elements as u64vec

    (scheme vector u64) procedure (list->u64vector (proper-list list?) ) ⟹ u64vector?

    proper-list ⟹ (list u64?)

    Returns u64vector with same elements as list.

    (scheme vector u64) procedure (u64? obj ) ⟹ boolean?

    Returns #t if obj is a valid element of an u64vector (ie., unsigned exact integer in the range 0 to (2^64)-1), and #f otherwise.

    (scheme vector u64) procedure (u64vector-unfold (f procedure?) (length integer?) seed ) ⟹ u64vector?

    (scheme vector u64) procedure (u64vector-unfold (f procedure?) (length integer?) seed ) ⟹ u64vector?

    (f (index integer?) state ) ⟹ (values u64?*)

    Creates a vector whose length is length and iterates across each index k between 0 and length - 1, applying f at each iteration to the current index and current state, in that order, to receive two values: the element to put in the kth slot of the new vector and a new state for the next iteration. On the first call to f, the state's value is seed.

    (scheme vector u64) procedure (u64vector-copy (u64vec u64vector?) ) ⟹ u64vector?

    (scheme vector u64) procedure (u64vector-copy (u64vec u64vector?) (start integer?) ) ⟹ u64vector?

    (scheme vector u64) procedure (u64vector-copy (u64vec u64vector?) (start integer?) (end integer?) ) ⟹ u64vector?

    Makes a copy of the portion of u64vec from start to end and returns it.

    (scheme vector u64) procedure (u64vector-reverse-copy (u64vec u64vector?) ) ⟹ u64vector?

    (scheme vector u64) procedure (u64vector-reverse-copy (u64vec u64vector?) (start integer?) ) ⟹ u64vector?

    (scheme vector u64) procedure (u64vector-reverse-copy (u64vec u64vector?) (start integer?) (end integer?) ) ⟹ u64vector?

    The same as u64vector-copy, but in reverse order.

    (scheme vector u64) procedure (u64vector-append (u64vec u64vector?) ... ) ⟹ u64vector?

    Returns a u64vector containing all the elements of the u64vecs in order.

    (scheme vector u64) procedure (u64vector-concatenate (list-of-u64vectors list?) ) ⟹ u64vector?

    list-of-u64vectors ⟹ (list u64vector?)

    The same as u64vector-append, but takes a list of u64vectors rather than multiple arguments.

    (scheme vector u64) procedure (u64vector-append-subvectors (u64vec1 u64vector?) (start1 integer?) (end1 integer?) ... ) ⟹ u64vector?

    Concatenates the result of applying u64vector-copy to each triplet of u64vec, start, end arguments, but may be implemented more efficiently.

    (scheme vector u64) procedure (u64vector-empty? (u64vec u64vector?) ) ⟹ boolean?

    Returns #t if u64vec has a length of zero, and #f otherwise.

    (scheme vector u64) procedure (u64vector= (u64vec u64vector?) ... ) ⟹ boolean?

    Compares the u64vecs for elementwise equality, using = to do the comparisons. Returns #f unless all u64vectors are the same length.

    (scheme vector u64) procedure (u64vector-take (u64vec u64vector?) (n integer?) ) ⟹ u64vector?

    (scheme vector u64) procedure (u64vector-take-right (u64vec u64vector?) (n integer?) ) ⟹ u64vector?

    Returns a u64vector containing the first/last n elements of u64vec.

    (scheme vector u64) procedure (u64vector-drop (u64vec u64vector?) (n integer?) ) ⟹ u64vector?

    (scheme vector u64) procedure (u64vector-drop-right (u64vec u64vector?) (n integer?) ) ⟹ u64vector?

    Returns a u64vector containing all except the first/last n elements of u64vec.

    (scheme vector u64) procedure (u64vector-segment (u64vec u64vector?) (n integer?) ) ⟹ list?

    Returns a list of u64vectors, each of which contains n consecutive elements of u64vec. The last u64vector may be shorter than n. It is an error if n is not an exact positive integer.

    (scheme vector u64) procedure (u64vector-fold (kons procedure?) knil (u64vec1 u64vector?) (u64vec2 u64vector?) ... ) ⟹ *

    (kons state (obj1 u64?) (obj2 u64?) ... ) ⟹ *

    (scheme vector u64) procedure (u64vector-fold-right (kons procedure?) knil (u64vec1 u64vector?) (u64vec2 u64vector?) ... ) ⟹ *

    (kons state (obj1 u64?) (obj2 u64?) ... ) ⟹ *

    When one u64vector argument u64vec is given, folds kons over the elements of u64vec in increasing/decreasing order using knil as the initial value. The kons procedure is called with the state first and the element second, as in SRFIs 43 and 133 (heterogeneous vectors). This is the opposite order to that used in SRFI 1 (lists) and the various string SRFIs.

    When multiple u64vector arguments are given, kons is called with the current state value and each value from all the vectors; u64vector-fold scans elements from left to right, while u64vector-fold-right does from right to left. If the lengths of vectors differ, only the portion of each vector up to the length of the shortest vector is scanned.

    (scheme vector u64) procedure (u64vector-map (proc procedure?) (u64vec1 u64vector?) (u64vec2 u64vector?) ... ) ⟹ vector?

    (proc (val1 u64?) ... ) ⟹ *

    (scheme vector u64) procedure (u64vector-map! (proc procedure?) (u64vec1 u64vector?) (u64vec2 u64vector?) ... ) ⟹ undefined

    (proc (val1 u64?) ... ) ⟹ *

    (scheme vector u64) procedure (u64vector-for-each (proc procedure?) (u64vec1 u64vector?) (u64vec2 u64vector?) ... ) ⟹ undefined

    (proc (val1 u64?) ... ) ⟹ undefined

    Iterate over the elements of u64vec and apply f to each, returning respectively a u64vector of the results, an undefined value with the results placed back in u64vec, and an undefined value with no change to u64vec.

    If more than one vector is passed, f gets one element from each vector as arguments. If the lengths of the vectors differ, iteration stops at the end of the shortest vector. For u64vector-map!, only u64vec is modified even when multiple vectors are passed.

    If u64vector-map or u64vector-map! returns more than once (i.e. because of a continuation captured by f), the values returned or stored by earlier returns may be mutated.

    (scheme vector u64) procedure (u64vector-count (pred? procedure?) (u64vec1 u64vector?) (u64vec2 u64vector?) ... ) ⟹ integer?

    (pred? (val1 u64?) (val2 u64?) ... ) ⟹ *

    Call pred? on each element of u64vec and return the number of calls that return true.

    When multiple vectors are given, pred? must take the same number of arguments as the number of vectors, and corresponding elements from each vector are given for each iteration, which stops at the end of the shortest vector.

    (scheme vector u64) procedure (u64vector-cumulate (f procedure?) knil (u64vec u64vector?) ) ⟹ u64vector?

    (f state (value u64?) ) ⟹ *

    Like u64vector-fold, but returns an u64vector of partial results rather than just the final result.

    (scheme vector u64) procedure (u64vector-take-while (pred? procedure?) (u64vec u64vector?) ) ⟹ u64vector?

    (pred? (value u64?) ) ⟹ boolean?

    (scheme vector u64) procedure (u64vector-take-while-right (pred? procedure?) (u64vec u64vector?) ) ⟹ u64vector?

    (pred? (value u64?) ) ⟹ boolean?

    Return the shortest prefix/suffix of u64vec all of whose elements satisfy pred?.

    (scheme vector u64) procedure (u64vector-drop-while (pred? procedure?) (u64vec u64vector?) ) ⟹ u64vector?

    (pred? (value u64?) ) ⟹ boolean?

    (scheme vector u64) procedure (u64vector-drop-while-right (pred? procedure?) (u64vec u64vector?) ) ⟹ u64vector?

    (pred? (value u64?) ) ⟹ boolean?

    Drops the longest initial prefix/suffix of u64vec such that all its elements satisfy pred.

    (scheme vector u64) procedure (u64vector-index (pred? procedure?) (u64vec1 u64vector?) (u64vec2 u64vector?) ... ) ⟹ integer? / #f /

    (pred? (value1 u64?) (value2 u64?) ... ) ⟹ *

    (scheme vector u64) procedure (u64vector-index-right (pred? procedure?) (u64vec1 u64vector?) (u64vec2 u64vector?) ... ) ⟹ integer? / #f /

    (pred? (value1 u64?) (value2 u64?) ... ) ⟹ *

    Return the index of the first/last element of u64vec that satisfies pred?.

    When multiple vectors are passed, pred? must take the same number of arguments as the number of vectors, and corresponding elements from each vector are passed for each iteration. If the lengths of vectors differ, u64vector-index stops iteration at the end of the shortest one. Lengths of vectors must be the same for u64vector-index-right.

    (scheme vector u64) procedure (u64vector-skip (pred? procedure?) (u64vec1 u64vector?) (u64vec2 u64vector?) ... ) ⟹ integer? / #f /

    (pred? (value1 u64?) (value2 u64?) ... ) ⟹ *

    (scheme vector u64) procedure (u64vector-skip-right (pred? procedure?) (u64vec1 u64vector?) (u64vec2 u64vector?) ... ) ⟹ integer? / #f /

    (pred? (value1 u64?) (value2 u64?) ... ) ⟹ *

    Returns the index of the first/last element of u64vec that does not satisfy pred?.

    When multiple vectors are passed, pred? must take the same number of arguments as the number of vectors, and corresponding elements from each vector are passed for each iteration. If the lengths of vectors differ, u64vector-skip stops iteration at the end of the shortest one. Lengths of vectors must be the same for u64vector-skip-right.

    (scheme vector u64) procedure (u64vector-any (pred? procedure?) (u64vec1 u64vector?) (u64vec2 u64vector?) ... ) ⟹ *

    (pred? (val1 u64?) (val2 u64?) ... ) ⟹ *

    Returns first non-false result of applying pred? on a element from the u64vec, or #f if there is no such element. If u64vec is empty, returns #t

    When multiple vectors are passed, pred? must take the same number of arguments as the number of vectors, and corresponding elements from each vector are passed for each iteration. If the lengths of vectors differ, it stops at the end of the shortest one.

    (scheme vector u64) procedure (u64vector-every (pred? procedure?) (u64vec1 u64vector?) (u64vec2 u64vector?) ... ) ⟹ *

    (pred? (val1 u64?) (val2 u64?) ... ) ⟹ *

    If all elements from u64vec satisfy pred?, return the last result of pred?. If not all do, return #f. If u64vec is empty, return #t

    When multiple vectors are passed, pred? must take the same number of arguments as the number of vectors, and corresponding elements from each vector is passed for each iteration. If the lengths of vectors differ, it stops at the end of the shortest one.

    (scheme vector u64) procedure (u64vector-partition (pred? procedure?) (u64vec u64vector?) ) ⟹ (values u64vector?integer?)

    (pred? (value u64?) ) ⟹ boolean?

    Returns an u64vector of the same type as u64vec, but with all elements satisfying pred? in the leftmost part of the vector and the other elements in the remaining part. The order of elements is otherwise preserved. Returns two values, the new u64vector and the number of elements satisfying pred?.

    (scheme vector u64) procedure (u64vector-filter (pred? procedure?) (u64vec1 u64vector?) ) ⟹ u64vector?

    (pred? (val u64?) ) ⟹ boolean?

    (scheme vector u64) procedure (u64vector-remove (pred? procedure?) (u64vec1 u64vector?) ) ⟹ u64vector?

    (pred? (val u64?) ) ⟹ boolean?

    Return an u64vector containing the elements of u64vec that satisfy / do not satisfy pred?.

    (scheme vector u64) procedure (u64vector-swap! (u64vec u64vector?) (i integer?) (j integer?) ) ⟹ undefined

    Interchanges the ith and jth elements of u64vec.

    (scheme vector u64) procedure (u64vector-fill! (u64vec u64vector?) (fill u64?) ) ⟹ undefined

    (scheme vector u64) procedure (u64vector-fill! (u64vec u64vector?) (fill u64?) (start integer?) ) ⟹ undefined

    (scheme vector u64) procedure (u64vector-fill! (u64vec u64vector?) (fill u64?) (start integer?) (end integer?) ) ⟹ undefined

    Fills the portion of u64vec from start to end with the value fill.

    (scheme vector u64) procedure (u64vector-reverse! (u64vec u64vector?) ) ⟹ undefined

    (scheme vector u64) procedure (u64vector-reverse! (u64vec u64vector?) (start integer?) ) ⟹ undefined

    (scheme vector u64) procedure (u64vector-reverse! (u64vec u64vector?) (start integer?) (end integer?) ) ⟹ undefined

    Reverses the portion of u64vec from start to end.

    (scheme vector u64) procedure (u64vector-copy! (u64to u64vector?) (at integer?) (u64from u64vector?) ) ⟹ undefined

    (scheme vector u64) procedure (u64vector-copy! (u64to u64vector?) (at integer?) (u64from u64vector?) (start integer?) ) ⟹ undefined

    (scheme vector u64) procedure (u64vector-copy! (u64to u64vector?) (at integer?) (u64from u64vector?) (start integer?) (end integer?) ) ⟹ undefined

    Copies the portion of u64from from start to end onto u64to, starting at index at.

    (scheme vector u64) procedure (u64vector-reverse-copy! (u64to u64vector?) (at integer?) (u64from u64vector?) ) ⟹ undefined

    (scheme vector u64) procedure (u64vector-reverse-copy! (u64to u64vector?) (at integer?) (u64from u64vector?) (start integer?) ) ⟹ undefined

    (scheme vector u64) procedure (u64vector-reverse-copy! (u64to u64vector?) (at integer?) (u64from u64vector?) (start integer?) (end integer?) ) ⟹ undefined

    The same as u64vector-copy!, but copies in reverse

    (scheme vector u64) procedure (u64vector-unfold! (f procedure?) (u64vec u64vector?) (start integer?) (end integer?) initial-seed ... ) ⟹ undefined

    (f (index integer?) seed ... ) ⟹ (values **...)

    Like u64vector-unfold, but the elements are copied into the vector u64vec starting at element start rather than into a newly allocated vector. Terminates when end - start elements have been generated.

    (scheme vector u64) procedure (u64vector-unfold-right! (f procedure?) (u64vec u64vector?) (start integer?) (end integer?) initial-seed ... ) ⟹ undefined

    (f (index integer?) seed ... ) ⟹ (values **...)

    The same as u64vector-unfold!, but initializes the u64vector from right to left.

    (scheme vector u64) procedure (reverse-u64vector->list (u64vec u64vector?) ) ⟹ list?

    (scheme vector u64) procedure (reverse-u64vector->list (u64vec u64vector?) (start integer?) ) ⟹ list?

    (scheme vector u64) procedure (reverse-u64vector->list (u64vec u64vector?) (start integer?) (end integer?) ) ⟹ list?

    Returns a list with same elements as u64vec in reverse order.

    (scheme vector u64) procedure (reverse-list->u64vector (proper-list list?) ) ⟹ u64vector?

    Returns u64vector with same elements as list in reverse order.

    (scheme vector u64) procedure (u64vector->vector (u64vec u64vector?) ) ⟹ vector?

    (scheme vector u64) procedure (u64vector->vector (u64vec u64vector?) (start integer?) ) ⟹ vector?

    (scheme vector u64) procedure (u64vector->vector (u64vec u64vector?) (start integer?) (end integer?) ) ⟹ vector?

    Returns vector with same elements as u64vec.

    (scheme vector u64) procedure (vector->u64vector (vec vector?) ) ⟹ u64vector?

    (scheme vector u64) procedure (vector->u64vector (vec vector?) (start integer?) ) ⟹ u64vector?

    (scheme vector u64) procedure (vector->u64vector (vec vector?) (start integer?) (end integer?) ) ⟹ u64vector?

    Returns u64vector with same elements as vec.

    (scheme vector u64) procedure (make-u64vector-generator (u64vector u64vector?) ) ⟹ procedure?

    (return ) ⟹ eof-object? / u64? /

    Returns a SRFI 121 generator that generates all the values of u64vector in order. Note that the generator is finite.

    u64vector-comparatorcomparator?

    Variable containing a SRFI 128 comparator whose components provide ordering and hashing of u64vector.

    (scheme vector u64) procedure (write-u64vector (u64vec u64vector) ) ⟹ undefined

    (scheme vector u64) procedure (write-u64vector (u64vec u64vector) (port output-port?) ) ⟹ undefined

    Prints to port (the current output port by default) a representation of u64vec in the lexical syntax explained below.

    library (scheme vector s64)

    (scheme vector s64) procedure (make-s64vector (size integer?) ) ⟹ s64vector?

    (scheme vector s64) procedure (make-s64vector (size integer?) (fill s64?) ) ⟹ s64vector?

    Returns a s64vector whose length is size. If fill is provided, all the elements of the s64vector are initialized to it.

    (scheme vector s64) procedure (s64vector (value s64?) ... ) ⟹ s64vector?

    Returns a s64vector initialized with values.

    (scheme vector s64) procedure (s64vector? obj ) ⟹ boolean?

    Returns #t if obj is a s64vector, and #f otherwise.

    (scheme vector s64) procedure (s64vector-length (s64vec s64vector?) ) ⟹ integer?

    Returns the length of s64vec

    (scheme vector s64) procedure (s64vector-ref (s64vec s64vector?) (i integer?) ) ⟹ s64?

    Returns the ith element of s64vec.

    (scheme vector s64) procedure (s64vector-set! (s64vec s64vector?) (i integer?) (value s64?) ) ⟹ undefined

    Sets the ith element of s64vec to value.

    (scheme vector s64) procedure (s64vector->list (s64vec s64vector?) ) ⟹ list?

    (scheme vector s64) procedure (s64vector->list (s64vec s64vector?) (start integer?) ) ⟹ list?

    (scheme vector s64) procedure (s64vector->list (s64vec s64vector?) (start integer?) (end integer?) ) ⟹ list?

    Returns a list with same elements as s64vec

    (scheme vector s64) procedure (list->s64vector (proper-list list?) ) ⟹ s64vector?

    proper-list ⟹ (list s64?)

    Returns s64vector with same elements as list.

    (scheme vector s64) procedure (s64? obj ) ⟹ boolean?

    Returns #t if obj is a valid element of an s64vector (ie., signed exact integer in the range -(2^63) to (2^63)-1), and #f otherwise.

    (scheme vector s64) procedure (s64vector-unfold (f procedure?) (length integer?) seed ) ⟹ s64vector?

    (scheme vector s64) procedure (s64vector-unfold (f procedure?) (length integer?) seed ) ⟹ s64vector?

    (f (index integer?) state ) ⟹ (values s64?*)

    Creates a vector whose length is length and iterates across each index k between 0 and length - 1, applying f at each iteration to the current index and current state, in that order, to receive two values: the element to put in the kth slot of the new vector and a new state for the next iteration. On the first call to f, the state's value is seed.

    (scheme vector s64) procedure (s64vector-copy (s64vec s64vector?) ) ⟹ s64vector?

    (scheme vector s64) procedure (s64vector-copy (s64vec s64vector?) (start integer?) ) ⟹ s64vector?

    (scheme vector s64) procedure (s64vector-copy (s64vec s64vector?) (start integer?) (end integer?) ) ⟹ s64vector?

    Makes a copy of the portion of s64vec from start to end and returns it.

    (scheme vector s64) procedure (s64vector-reverse-copy (s64vec s64vector?) ) ⟹ s64vector?

    (scheme vector s64) procedure (s64vector-reverse-copy (s64vec s64vector?) (start integer?) ) ⟹ s64vector?

    (scheme vector s64) procedure (s64vector-reverse-copy (s64vec s64vector?) (start integer?) (end integer?) ) ⟹ s64vector?

    The same as s64vector-copy, but in reverse order.

    (scheme vector s64) procedure (s64vector-append (s64vec s64vector?) ... ) ⟹ s64vector?

    Returns a s64vector containing all the elements of the s64vecs in order.

    (scheme vector s64) procedure (s64vector-concatenate (list-of-s64vectors list?) ) ⟹ s64vector?

    list-of-s64vectors ⟹ (list s64vector?)

    The same as s64vector-append, but takes a list of s64vectors rather than multiple arguments.

    (scheme vector s64) procedure (s64vector-append-subvectors (s64vec1 s64vector?) (start1 integer?) (end1 integer?) ... ) ⟹ s64vector?

    Concatenates the result of applying s64vector-copy to each triplet of s64vec, start, end arguments, but may be implemented more efficiently.

    (scheme vector s64) procedure (s64vector-empty? (s64vec s64vector?) ) ⟹ boolean?

    Returns #t if s64vec has a length of zero, and #f otherwise.

    (scheme vector s64) procedure (s64vector= (s64vec s64vector?) ... ) ⟹ boolean?

    Compares the s64vecs for elementwise equality, using = to do the comparisons. Returns #f unless all s64vectors are the same length.

    (scheme vector s64) procedure (s64vector-take (s64vec s64vector?) (n integer?) ) ⟹ s64vector?

    (scheme vector s64) procedure (s64vector-take-right (s64vec s64vector?) (n integer?) ) ⟹ s64vector?

    Returns a s64vector containing the first/last n elements of s64vec.

    (scheme vector s64) procedure (s64vector-drop (s64vec s64vector?) (n integer?) ) ⟹ s64vector?

    (scheme vector s64) procedure (s64vector-drop-right (s64vec s64vector?) (n integer?) ) ⟹ s64vector?

    Returns a s64vector containing all except the first/last n elements of s64vec.

    (scheme vector s64) procedure (s64vector-segment (s64vec s64vector?) (n integer?) ) ⟹ list?

    Returns a list of s64vectors, each of which contains n consecutive elements of s64vec. The last s64vector may be shorter than n. It is an error if n is not an exact positive integer.

    (scheme vector s64) procedure (s64vector-fold (kons procedure?) knil (s64vec1 s64vector?) (s64vec2 s64vector?) ... ) ⟹ *

    (kons state (obj1 s64?) (obj2 s64?) ... ) ⟹ *

    (scheme vector s64) procedure (s64vector-fold-right (kons procedure?) knil (s64vec1 s64vector?) (s64vec2 s64vector?) ... ) ⟹ *

    (kons state (obj1 s64?) (obj2 s64?) ... ) ⟹ *

    When one s64vector argument s64vec is given, folds kons over the elements of s64vec in increasing/decreasing order using knil as the initial value. The kons procedure is called with the state first and the element second, as in SRFIs 43 and 133 (heterogeneous vectors). This is the opposite order to that used in SRFI 1 (lists) and the various string SRFIs.

    When multiple s64vector arguments are given, kons is called with the current state value and each value from all the vectors; s64vector-fold scans elements from left to right, while s64vector-fold-right does from right to left. If the lengths of vectors differ, only the portion of each vector up to the length of the shortest vector is scanned.

    (scheme vector s64) procedure (s64vector-map (proc procedure?) (s64vec1 s64vector?) (s64vec2 s64vector?) ... ) ⟹ vector?

    (proc (val1 s64?) ... ) ⟹ *

    (scheme vector s64) procedure (s64vector-map! (proc procedure?) (s64vec1 s64vector?) (s64vec2 s64vector?) ... ) ⟹ undefined

    (proc (val1 s64?) ... ) ⟹ *

    (scheme vector s64) procedure (s64vector-for-each (proc procedure?) (s64vec1 s64vector?) (s64vec2 s64vector?) ... ) ⟹ undefined

    (proc (val1 s64?) ... ) ⟹ undefined

    Iterate over the elements of s64vec and apply f to each, returning respectively a s64vector of the results, an undefined value with the results placed back in s64vec, and an undefined value with no change to s64vec.

    If more than one vector is passed, f gets one element from each vector as arguments. If the lengths of the vectors differ, iteration stops at the end of the shortest vector. For s64vector-map!, only s64vec is modified even when multiple vectors are passed.

    If s64vector-map or s64vector-map! returns more than once (i.e. because of a continuation captured by f), the values returned or stored by earlier returns may be mutated.

    (scheme vector s64) procedure (s64vector-count (pred? procedure?) (s64vec1 s64vector?) (s64vec2 s64vector?) ... ) ⟹ integer?

    (pred? (val1 s64?) (val2 s64?) ... ) ⟹ *

    Call pred? on each element of s64vec and return the number of calls that return true.

    When multiple vectors are given, pred? must take the same number of arguments as the number of vectors, and corresponding elements from each vector are given for each iteration, which stops at the end of the shortest vector.

    (scheme vector s64) procedure (s64vector-cumulate (f procedure?) knil (s64vec s64vector?) ) ⟹ s64vector?

    (f state (value s64?) ) ⟹ *

    Like s64vector-fold, but returns an s64vector of partial results rather than just the final result.

    (scheme vector s64) procedure (s64vector-take-while (pred? procedure?) (s64vec s64vector?) ) ⟹ s64vector?

    (pred? (value s64?) ) ⟹ boolean?

    (scheme vector s64) procedure (s64vector-take-while-right (pred? procedure?) (s64vec s64vector?) ) ⟹ s64vector?

    (pred? (value s64?) ) ⟹ boolean?

    Return the shortest prefix/suffix of s64vec all of whose elements satisfy pred?.

    (scheme vector s64) procedure (s64vector-drop-while (pred? procedure?) (s64vec s64vector?) ) ⟹ s64vector?

    (pred? (value s64?) ) ⟹ boolean?

    (scheme vector s64) procedure (s64vector-drop-while-right (pred? procedure?) (s64vec s64vector?) ) ⟹ s64vector?

    (pred? (value s64?) ) ⟹ boolean?

    Drops the longest initial prefix/suffix of s64vec such that all its elements satisfy pred.

    (scheme vector s64) procedure (s64vector-index (pred? procedure?) (s64vec1 s64vector?) (s64vec2 s64vector?) ... ) ⟹ integer? / #f /

    (pred? (value1 s64?) (value2 s64?) ... ) ⟹ *

    (scheme vector s64) procedure (s64vector-index-right (pred? procedure?) (s64vec1 s64vector?) (s64vec2 s64vector?) ... ) ⟹ integer? / #f /

    (pred? (value1 s64?) (value2 s64?) ... ) ⟹ *

    Return the index of the first/last element of s64vec that satisfies pred?.

    When multiple vectors are passed, pred? must take the same number of arguments as the number of vectors, and corresponding elements from each vector are passed for each iteration. If the lengths of vectors differ, s64vector-index stops iteration at the end of the shortest one. Lengths of vectors must be the same for s64vector-index-right.

    (scheme vector s64) procedure (s64vector-skip (pred? procedure?) (s64vec1 s64vector?) (s64vec2 s64vector?) ... ) ⟹ integer? / #f /

    (pred? (value1 s64?) (value2 s64?) ... ) ⟹ *

    (scheme vector s64) procedure (s64vector-skip-right (pred? procedure?) (s64vec1 s64vector?) (s64vec2 s64vector?) ... ) ⟹ integer? / #f /

    (pred? (value1 s64?) (value2 s64?) ... ) ⟹ *

    Returns the index of the first/last element of s64vec that does not satisfy pred?.

    When multiple vectors are passed, pred? must take the same number of arguments as the number of vectors, and corresponding elements from each vector are passed for each iteration. If the lengths of vectors differ, s64vector-skip stops iteration at the end of the shortest one. Lengths of vectors must be the same for s64vector-skip-right.

    (scheme vector s64) procedure (s64vector-any (pred? procedure?) (s64vec1 s64vector?) (s64vec2 s64vector?) ... ) ⟹ *

    (pred? (val1 s64?) (val2 s64?) ... ) ⟹ *

    Returns first non-false result of applying pred? on a element from the s64vec, or #f if there is no such element. If s64vec is empty, returns #t

    When multiple vectors are passed, pred? must take the same number of arguments as the number of vectors, and corresponding elements from each vector are passed for each iteration. If the lengths of vectors differ, it stops at the end of the shortest one.

    (scheme vector s64) procedure (s64vector-every (pred? procedure?) (s64vec1 s64vector?) (s64vec2 s64vector?) ... ) ⟹ *

    (pred? (val1 s64?) (val2 s64?) ... ) ⟹ *

    If all elements from s64vec satisfy pred?, return the last result of pred?. If not all do, return #f. If s64vec is empty, return #t

    When multiple vectors are passed, pred? must take the same number of arguments as the number of vectors, and corresponding elements from each vector is passed for each iteration. If the lengths of vectors differ, it stops at the end of the shortest one.

    (scheme vector s64) procedure (s64vector-partition (pred? procedure?) (s64vec s64vector?) ) ⟹ (values s64vector?integer?)

    (pred? (value s64?) ) ⟹ boolean?

    Returns an s64vector of the same type as s64vec, but with all elements satisfying pred? in the leftmost part of the vector and the other elements in the remaining part. The order of elements is otherwise preserved. Returns two values, the new s64vector and the number of elements satisfying pred?.

    (scheme vector s64) procedure (s64vector-filter (pred? procedure?) (s64vec1 s64vector?) ) ⟹ s64vector?

    (pred? (val s64?) ) ⟹ boolean?

    (scheme vector s64) procedure (s64vector-remove (pred? procedure?) (s64vec1 s64vector?) ) ⟹ s64vector?

    (pred? (val s64?) ) ⟹ boolean?

    Return an s64vector containing the elements of s64vec that satisfy / do not satisfy pred?.

    (scheme vector s64) procedure (s64vector-swap! (s64vec s64vector?) (i integer?) (j integer?) ) ⟹ undefined

    Interchanges the ith and jth elements of s64vec.

    (scheme vector s64) procedure (s64vector-fill! (s64vec s64vector?) (fill s64?) ) ⟹ undefined

    (scheme vector s64) procedure (s64vector-fill! (s64vec s64vector?) (fill s64?) (start integer?) ) ⟹ undefined

    (scheme vector s64) procedure (s64vector-fill! (s64vec s64vector?) (fill s64?) (start integer?) (end integer?) ) ⟹ undefined

    Fills the portion of s64vec from start to end with the value fill.

    (scheme vector s64) procedure (s64vector-reverse! (s64vec s64vector?) ) ⟹ undefined

    (scheme vector s64) procedure (s64vector-reverse! (s64vec s64vector?) (start integer?) ) ⟹ undefined

    (scheme vector s64) procedure (s64vector-reverse! (s64vec s64vector?) (start integer?) (end integer?) ) ⟹ undefined

    Reverses the portion of s64vec from start to end.

    (scheme vector s64) procedure (s64vector-copy! (s64to s64vector?) (at integer?) (s64from s64vector?) ) ⟹ undefined

    (scheme vector s64) procedure (s64vector-copy! (s64to s64vector?) (at integer?) (s64from s64vector?) (start integer?) ) ⟹ undefined

    (scheme vector s64) procedure (s64vector-copy! (s64to s64vector?) (at integer?) (s64from s64vector?) (start integer?) (end integer?) ) ⟹ undefined

    Copies the portion of s64from from start to end onto s64to, starting at index at.

    (scheme vector s64) procedure (s64vector-reverse-copy! (s64to s64vector?) (at integer?) (s64from s64vector?) ) ⟹ undefined

    (scheme vector s64) procedure (s64vector-reverse-copy! (s64to s64vector?) (at integer?) (s64from s64vector?) (start integer?) ) ⟹ undefined

    (scheme vector s64) procedure (s64vector-reverse-copy! (s64to s64vector?) (at integer?) (s64from s64vector?) (start integer?) (end integer?) ) ⟹ undefined

    The same as s64vector-copy!, but copies in reverse

    (scheme vector s64) procedure (s64vector-unfold! (f procedure?) (s64vec s64vector?) (start integer?) (end integer?) initial-seed ... ) ⟹ undefined

    (f (index integer?) seed ... ) ⟹ (values **...)

    Like s64vector-unfold, but the elements are copied into the vector s64vec starting at element start rather than into a newly allocated vector. Terminates when end - start elements have been generated.

    (scheme vector s64) procedure (s64vector-unfold-right! (f procedure?) (s64vec s64vector?) (start integer?) (end integer?) initial-seed ... ) ⟹ undefined

    (f (index integer?) seed ... ) ⟹ (values **...)

    The same as s64vector-unfold!, but initializes the s64vector from right to left.

    (scheme vector s64) procedure (reverse-s64vector->list (s64vec s64vector?) ) ⟹ list?

    (scheme vector s64) procedure (reverse-s64vector->list (s64vec s64vector?) (start integer?) ) ⟹ list?

    (scheme vector s64) procedure (reverse-s64vector->list (s64vec s64vector?) (start integer?) (end integer?) ) ⟹ list?

    Returns a list with same elements as s64vec in reverse order.

    (scheme vector s64) procedure (reverse-list->s64vector (proper-list list?) ) ⟹ s64vector?

    Returns s64vector with same elements as list in reverse order.

    (scheme vector s64) procedure (s64vector->vector (s64vec s64vector?) ) ⟹ vector?

    (scheme vector s64) procedure (s64vector->vector (s64vec s64vector?) (start integer?) ) ⟹ vector?

    (scheme vector s64) procedure (s64vector->vector (s64vec s64vector?) (start integer?) (end integer?) ) ⟹ vector?

    Returns vector with same elements as s64vec.

    (scheme vector s64) procedure (vector->s64vector (vec vector?) ) ⟹ s64vector?

    (scheme vector s64) procedure (vector->s64vector (vec vector?) (start integer?) ) ⟹ s64vector?

    (scheme vector s64) procedure (vector->s64vector (vec vector?) (start integer?) (end integer?) ) ⟹ s64vector?

    Returns s64vector with same elements as vec.

    (scheme vector s64) procedure (make-s64vector-generator (s64vector s64vector?) ) ⟹ procedure?

    (return ) ⟹ eof-object? / s64? /

    Returns a SRFI 121 generator that generates all the values of s64vector in order. Note that the generator is finite.

    s64vector-comparatorcomparator?

    Variable containing a SRFI 128 comparator whose components provide ordering and hashing of s64vector.

    (scheme vector s64) procedure (write-s64vector (s64vec s64vector) ) ⟹ undefined

    (scheme vector s64) procedure (write-s64vector (s64vec s64vector) (port output-port?) ) ⟹ undefined

    Prints to port (the current output port by default) a representation of s64vec in the lexical syntax explained below.

    library (scheme vector f32)

    (scheme vector f32) procedure (make-f32vector (size integer?) ) ⟹ f32vector?

    (scheme vector f32) procedure (make-f32vector (size integer?) (fill f32?) ) ⟹ f32vector?

    Returns a f32vector whose length is size. If fill is provided, all the elements of the f32vector are initialized to it.

    (scheme vector f32) procedure (f32vector (value f32?) ... ) ⟹ f32vector?

    Returns a f32vector initialized with values.

    (scheme vector f32) procedure (f32vector? obj ) ⟹ boolean?

    Returns #t if obj is a f32vector, and #f otherwise.

    (scheme vector f32) procedure (f32vector-length (f32vec f32vector?) ) ⟹ integer?

    Returns the length of f32vec

    (scheme vector f32) procedure (f32vector-ref (f32vec f32vector?) (i integer?) ) ⟹ f32?

    Returns the ith element of f32vec.

    (scheme vector f32) procedure (f32vector-set! (f32vec f32vector?) (i integer?) (value f32?) ) ⟹ undefined

    Sets the ith element of f32vec to value.

    (scheme vector f32) procedure (f32vector->list (f32vec f32vector?) ) ⟹ list?

    (scheme vector f32) procedure (f32vector->list (f32vec f32vector?) (start integer?) ) ⟹ list?

    (scheme vector f32) procedure (f32vector->list (f32vec f32vector?) (start integer?) (end integer?) ) ⟹ list?

    Returns a list with same elements as f32vec

    (scheme vector f32) procedure (list->f32vector (proper-list list?) ) ⟹ f32vector?

    proper-list ⟹ (list f32?)

    Returns f32vector with same elements as list.

    (scheme vector f32) procedure (f32? obj ) ⟹ boolean?

    Returns #t if obj is a valid element of an f32vector (ie., inexact real), and #f otherwise.

    (scheme vector f32) procedure (f32vector-unfold (f procedure?) (length integer?) seed ) ⟹ f32vector?

    (scheme vector f32) procedure (f32vector-unfold (f procedure?) (length integer?) seed ) ⟹ f32vector?

    (f (index integer?) state ) ⟹ (values f32?*)

    Creates a vector whose length is length and iterates across each index k between 0 and length - 1, applying f at each iteration to the current index and current state, in that order, to receive two values: the element to put in the kth slot of the new vector and a new state for the next iteration. On the first call to f, the state's value is seed.

    (scheme vector f32) procedure (f32vector-copy (f32vec f32vector?) ) ⟹ f32vector?

    (scheme vector f32) procedure (f32vector-copy (f32vec f32vector?) (start integer?) ) ⟹ f32vector?

    (scheme vector f32) procedure (f32vector-copy (f32vec f32vector?) (start integer?) (end integer?) ) ⟹ f32vector?

    Makes a copy of the portion of f32vec from start to end and returns it.

    (scheme vector f32) procedure (f32vector-reverse-copy (f32vec f32vector?) ) ⟹ f32vector?

    (scheme vector f32) procedure (f32vector-reverse-copy (f32vec f32vector?) (start integer?) ) ⟹ f32vector?

    (scheme vector f32) procedure (f32vector-reverse-copy (f32vec f32vector?) (start integer?) (end integer?) ) ⟹ f32vector?

    The same as f32vector-copy, but in reverse order.

    (scheme vector f32) procedure (f32vector-append (f32vec f32vector?) ... ) ⟹ f32vector?

    Returns a f32vector containing all the elements of the f32vecs in order.

    (scheme vector f32) procedure (f32vector-concatenate (list-of-f32vectors list?) ) ⟹ f32vector?

    list-of-f32vectors ⟹ (list f32vector?)

    The same as f32vector-append, but takes a list of f32vectors rather than multiple arguments.

    (scheme vector f32) procedure (f32vector-append-subvectors (f32vec1 f32vector?) (start1 integer?) (end1 integer?) ... ) ⟹ f32vector?

    Concatenates the result of applying f32vector-copy to each triplet of f32vec, start, end arguments, but may be implemented more efficiently.

    (scheme vector f32) procedure (f32vector-empty? (f32vec f32vector?) ) ⟹ boolean?

    Returns #t if f32vec has a length of zero, and #f otherwise.

    (scheme vector f32) procedure (f32vector= (f32vec f32vector?) ... ) ⟹ boolean?

    Compares the f32vecs for elementwise equality, using = to do the comparisons. Returns #f unless all f32vectors are the same length.

    (scheme vector f32) procedure (f32vector-take (f32vec f32vector?) (n integer?) ) ⟹ f32vector?

    (scheme vector f32) procedure (f32vector-take-right (f32vec f32vector?) (n integer?) ) ⟹ f32vector?

    Returns a f32vector containing the first/last n elements of f32vec.

    (scheme vector f32) procedure (f32vector-drop (f32vec f32vector?) (n integer?) ) ⟹ f32vector?

    (scheme vector f32) procedure (f32vector-drop-right (f32vec f32vector?) (n integer?) ) ⟹ f32vector?

    Returns a f32vector containing all except the first/last n elements of f32vec.

    (scheme vector f32) procedure (f32vector-segment (f32vec f32vector?) (n integer?) ) ⟹ list?

    Returns a list of f32vectors, each of which contains n consecutive elements of f32vec. The last f32vector may be shorter than n. It is an error if n is not an exact positive integer.

    (scheme vector f32) procedure (f32vector-fold (kons procedure?) knil (f32vec1 f32vector?) (f32vec2 f32vector?) ... ) ⟹ *

    (kons state (obj1 f32?) (obj2 f32?) ... ) ⟹ *

    (scheme vector f32) procedure (f32vector-fold-right (kons procedure?) knil (f32vec1 f32vector?) (f32vec2 f32vector?) ... ) ⟹ *

    (kons state (obj1 f32?) (obj2 f32?) ... ) ⟹ *

    When one f32vector argument f32vec is given, folds kons over the elements of f32vec in increasing/decreasing order using knil as the initial value. The kons procedure is called with the state first and the element second, as in SRFIs 43 and 133 (heterogeneous vectors). This is the opposite order to that used in SRFI 1 (lists) and the various string SRFIs.

    When multiple f32vector arguments are given, kons is called with the current state value and each value from all the vectors; f32vector-fold scans elements from left to right, while f32vector-fold-right does from right to left. If the lengths of vectors differ, only the portion of each vector up to the length of the shortest vector is scanned.

    (scheme vector f32) procedure (f32vector-map (proc procedure?) (f32vec1 f32vector?) (f32vec2 f32vector?) ... ) ⟹ vector?

    (proc (val1 f32?) ... ) ⟹ *

    (scheme vector f32) procedure (f32vector-map! (proc procedure?) (f32vec1 f32vector?) (f32vec2 f32vector?) ... ) ⟹ undefined

    (proc (val1 f32?) ... ) ⟹ *

    (scheme vector f32) procedure (f32vector-for-each (proc procedure?) (f32vec1 f32vector?) (f32vec2 f32vector?) ... ) ⟹ undefined

    (proc (val1 f32?) ... ) ⟹ undefined

    Iterate over the elements of f32vec and apply f to each, returning respectively a f32vector of the results, an undefined value with the results placed back in f32vec, and an undefined value with no change to f32vec.

    If more than one vector is passed, f gets one element from each vector as arguments. If the lengths of the vectors differ, iteration stops at the end of the shortest vector. For f32vector-map!, only f32vec is modified even when multiple vectors are passed.

    If f32vector-map or f32vector-map! returns more than once (i.e. because of a continuation captured by f), the values returned or stored by earlier returns may be mutated.

    (scheme vector f32) procedure (f32vector-count (pred? procedure?) (f32vec1 f32vector?) (f32vec2 f32vector?) ... ) ⟹ integer?

    (pred? (val1 f32?) (val2 f32?) ... ) ⟹ *

    Call pred? on each element of f32vec and return the number of calls that return true.

    When multiple vectors are given, pred? must take the same number of arguments as the number of vectors, and corresponding elements from each vector are given for each iteration, which stops at the end of the shortest vector.

    (scheme vector f32) procedure (f32vector-cumulate (f procedure?) knil (f32vec f32vector?) ) ⟹ f32vector?

    (f state (value f32?) ) ⟹ *

    Like f32vector-fold, but returns an f32vector of partial results rather than just the final result.

    (scheme vector f32) procedure (f32vector-take-while (pred? procedure?) (f32vec f32vector?) ) ⟹ f32vector?

    (pred? (value f32?) ) ⟹ boolean?

    (scheme vector f32) procedure (f32vector-take-while-right (pred? procedure?) (f32vec f32vector?) ) ⟹ f32vector?

    (pred? (value f32?) ) ⟹ boolean?

    Return the shortest prefix/suffix of f32vec all of whose elements satisfy pred?.

    (scheme vector f32) procedure (f32vector-drop-while (pred? procedure?) (f32vec f32vector?) ) ⟹ f32vector?

    (pred? (value f32?) ) ⟹ boolean?

    (scheme vector f32) procedure (f32vector-drop-while-right (pred? procedure?) (f32vec f32vector?) ) ⟹ f32vector?

    (pred? (value f32?) ) ⟹ boolean?

    Drops the longest initial prefix/suffix of f32vec such that all its elements satisfy pred.

    (scheme vector f32) procedure (f32vector-index (pred? procedure?) (f32vec1 f32vector?) (f32vec2 f32vector?) ... ) ⟹ integer? / #f /

    (pred? (value1 f32?) (value2 f32?) ... ) ⟹ *

    (scheme vector f32) procedure (f32vector-index-right (pred? procedure?) (f32vec1 f32vector?) (f32vec2 f32vector?) ... ) ⟹ integer? / #f /

    (pred? (value1 f32?) (value2 f32?) ... ) ⟹ *

    Return the index of the first/last element of f32vec that satisfies pred?.

    When multiple vectors are passed, pred? must take the same number of arguments as the number of vectors, and corresponding elements from each vector are passed for each iteration. If the lengths of vectors differ, f32vector-index stops iteration at the end of the shortest one. Lengths of vectors must be the same for f32vector-index-right.

    (scheme vector f32) procedure (f32vector-skip (pred? procedure?) (f32vec1 f32vector?) (f32vec2 f32vector?) ... ) ⟹ integer? / #f /

    (pred? (value1 f32?) (value2 f32?) ... ) ⟹ *

    (scheme vector f32) procedure (f32vector-skip-right (pred? procedure?) (f32vec1 f32vector?) (f32vec2 f32vector?) ... ) ⟹ integer? / #f /

    (pred? (value1 f32?) (value2 f32?) ... ) ⟹ *

    Returns the index of the first/last element of f32vec that does not satisfy pred?.

    When multiple vectors are passed, pred? must take the same number of arguments as the number of vectors, and corresponding elements from each vector are passed for each iteration. If the lengths of vectors differ, f32vector-skip stops iteration at the end of the shortest one. Lengths of vectors must be the same for f32vector-skip-right.

    (scheme vector f32) procedure (f32vector-any (pred? procedure?) (f32vec1 f32vector?) (f32vec2 f32vector?) ... ) ⟹ *

    (pred? (val1 f32?) (val2 f32?) ... ) ⟹ *

    Returns first non-false result of applying pred? on a element from the f32vec, or #f if there is no such element. If f32vec is empty, returns #t

    When multiple vectors are passed, pred? must take the same number of arguments as the number of vectors, and corresponding elements from each vector are passed for each iteration. If the lengths of vectors differ, it stops at the end of the shortest one.

    (scheme vector f32) procedure (f32vector-every (pred? procedure?) (f32vec1 f32vector?) (f32vec2 f32vector?) ... ) ⟹ *

    (pred? (val1 f32?) (val2 f32?) ... ) ⟹ *

    If all elements from f32vec satisfy pred?, return the last result of pred?. If not all do, return #f. If f32vec is empty, return #t

    When multiple vectors are passed, pred? must take the same number of arguments as the number of vectors, and corresponding elements from each vector is passed for each iteration. If the lengths of vectors differ, it stops at the end of the shortest one.

    (scheme vector f32) procedure (f32vector-partition (pred? procedure?) (f32vec f32vector?) ) ⟹ (values f32vector?integer?)

    (pred? (value f32?) ) ⟹ boolean?

    Returns an f32vector of the same type as f32vec, but with all elements satisfying pred? in the leftmost part of the vector and the other elements in the remaining part. The order of elements is otherwise preserved. Returns two values, the new f32vector and the number of elements satisfying pred?.

    (scheme vector f32) procedure (f32vector-filter (pred? procedure?) (f32vec1 f32vector?) ) ⟹ f32vector?

    (pred? (val f32?) ) ⟹ boolean?

    (scheme vector f32) procedure (f32vector-remove (pred? procedure?) (f32vec1 f32vector?) ) ⟹ f32vector?

    (pred? (val f32?) ) ⟹ boolean?

    Return an f32vector containing the elements of f32vec that satisfy / do not satisfy pred?.

    (scheme vector f32) procedure (f32vector-swap! (f32vec f32vector?) (i integer?) (j integer?) ) ⟹ undefined

    Interchanges the ith and jth elements of f32vec.

    (scheme vector f32) procedure (f32vector-fill! (f32vec f32vector?) (fill f32?) ) ⟹ undefined

    (scheme vector f32) procedure (f32vector-fill! (f32vec f32vector?) (fill f32?) (start integer?) ) ⟹ undefined

    (scheme vector f32) procedure (f32vector-fill! (f32vec f32vector?) (fill f32?) (start integer?) (end integer?) ) ⟹ undefined

    Fills the portion of f32vec from start to end with the value fill.

    (scheme vector f32) procedure (f32vector-reverse! (f32vec f32vector?) ) ⟹ undefined

    (scheme vector f32) procedure (f32vector-reverse! (f32vec f32vector?) (start integer?) ) ⟹ undefined

    (scheme vector f32) procedure (f32vector-reverse! (f32vec f32vector?) (start integer?) (end integer?) ) ⟹ undefined

    Reverses the portion of f32vec from start to end.

    (scheme vector f32) procedure (f32vector-copy! (f32to f32vector?) (at integer?) (f32from f32vector?) ) ⟹ undefined

    (scheme vector f32) procedure (f32vector-copy! (f32to f32vector?) (at integer?) (f32from f32vector?) (start integer?) ) ⟹ undefined

    (scheme vector f32) procedure (f32vector-copy! (f32to f32vector?) (at integer?) (f32from f32vector?) (start integer?) (end integer?) ) ⟹ undefined

    Copies the portion of f32from from start to end onto f32to, starting at index at.

    (scheme vector f32) procedure (f32vector-reverse-copy! (f32to f32vector?) (at integer?) (f32from f32vector?) ) ⟹ undefined

    (scheme vector f32) procedure (f32vector-reverse-copy! (f32to f32vector?) (at integer?) (f32from f32vector?) (start integer?) ) ⟹ undefined

    (scheme vector f32) procedure (f32vector-reverse-copy! (f32to f32vector?) (at integer?) (f32from f32vector?) (start integer?) (end integer?) ) ⟹ undefined

    The same as f32vector-copy!, but copies in reverse

    (scheme vector f32) procedure (f32vector-unfold! (f procedure?) (f32vec f32vector?) (start integer?) (end integer?) initial-seed ... ) ⟹ undefined

    (f (index integer?) seed ... ) ⟹ (values **...)

    Like f32vector-unfold, but the elements are copied into the vector f32vec starting at element start rather than into a newly allocated vector. Terminates when end - start elements have been generated.

    (scheme vector f32) procedure (f32vector-unfold-right! (f procedure?) (f32vec f32vector?) (start integer?) (end integer?) initial-seed ... ) ⟹ undefined

    (f (index integer?) seed ... ) ⟹ (values **...)

    The same as f32vector-unfold!, but initializes the f32vector from right to left.

    (scheme vector f32) procedure (reverse-f32vector->list (f32vec f32vector?) ) ⟹ list?

    (scheme vector f32) procedure (reverse-f32vector->list (f32vec f32vector?) (start integer?) ) ⟹ list?

    (scheme vector f32) procedure (reverse-f32vector->list (f32vec f32vector?) (start integer?) (end integer?) ) ⟹ list?

    Returns a list with same elements as f32vec in reverse order.

    (scheme vector f32) procedure (reverse-list->f32vector (proper-list list?) ) ⟹ f32vector?

    Returns f32vector with same elements as list in reverse order.

    (scheme vector f32) procedure (f32vector->vector (f32vec f32vector?) ) ⟹ vector?

    (scheme vector f32) procedure (f32vector->vector (f32vec f32vector?) (start integer?) ) ⟹ vector?

    (scheme vector f32) procedure (f32vector->vector (f32vec f32vector?) (start integer?) (end integer?) ) ⟹ vector?

    Returns vector with same elements as f32vec.

    (scheme vector f32) procedure (vector->f32vector (vec vector?) ) ⟹ f32vector?

    (scheme vector f32) procedure (vector->f32vector (vec vector?) (start integer?) ) ⟹ f32vector?

    (scheme vector f32) procedure (vector->f32vector (vec vector?) (start integer?) (end integer?) ) ⟹ f32vector?

    Returns f32vector with same elements as vec.

    (scheme vector f32) procedure (make-f32vector-generator (f32vector f32vector?) ) ⟹ procedure?

    (return ) ⟹ eof-object? / f32? /

    Returns a SRFI 121 generator that generates all the values of f32vector in order. Note that the generator is finite.

    f32vector-comparatorcomparator?

    Variable containing a SRFI 128 comparator whose components provide ordering and hashing of f32vector.

    (scheme vector f32) procedure (write-f32vector (f32vec f32vector) ) ⟹ undefined

    (scheme vector f32) procedure (write-f32vector (f32vec f32vector) (port output-port?) ) ⟹ undefined

    Prints to port (the current output port by default) a representation of f32vec in the lexical syntax explained below.

    library (scheme vector f64)

    (scheme vector f64) procedure (make-f64vector (size integer?) ) ⟹ f64vector?

    (scheme vector f64) procedure (make-f64vector (size integer?) (fill f64?) ) ⟹ f64vector?

    Returns a f64vector whose length is size. If fill is provided, all the elements of the f64vector are initialized to it.

    (scheme vector f64) procedure (f64vector (value f64?) ... ) ⟹ f64vector?

    Returns a f64vector initialized with values.

    (scheme vector f64) procedure (f64vector? obj ) ⟹ boolean?

    Returns #t if obj is a f64vector, and #f otherwise.

    (scheme vector f64) procedure (f64vector-length (f64vec f64vector?) ) ⟹ integer?

    Returns the length of f64vec

    (scheme vector f64) procedure (f64vector-ref (f64vec f64vector?) (i integer?) ) ⟹ f64?

    Returns the ith element of f64vec.

    (scheme vector f64) procedure (f64vector-set! (f64vec f64vector?) (i integer?) (value f64?) ) ⟹ undefined

    Sets the ith element of f64vec to value.

    (scheme vector f64) procedure (f64vector->list (f64vec f64vector?) ) ⟹ list?

    (scheme vector f64) procedure (f64vector->list (f64vec f64vector?) (start integer?) ) ⟹ list?

    (scheme vector f64) procedure (f64vector->list (f64vec f64vector?) (start integer?) (end integer?) ) ⟹ list?

    Returns a list with same elements as f64vec

    (scheme vector f64) procedure (list->f64vector (proper-list list?) ) ⟹ f64vector?

    proper-list ⟹ (list f64?)

    Returns f64vector with same elements as list.

    (scheme vector f64) procedure (f64? obj ) ⟹ boolean?

    Returns #t if obj is a valid element of an f64vector (ie., inexact real), and #f otherwise.

    (scheme vector f64) procedure (f64vector-unfold (f procedure?) (length integer?) seed ) ⟹ f64vector?

    (scheme vector f64) procedure (f64vector-unfold (f procedure?) (length integer?) seed ) ⟹ f64vector?

    (f (index integer?) state ) ⟹ (values f64?*)

    Creates a vector whose length is length and iterates across each index k between 0 and length - 1, applying f at each iteration to the current index and current state, in that order, to receive two values: the element to put in the kth slot of the new vector and a new state for the next iteration. On the first call to f, the state's value is seed.

    (scheme vector f64) procedure (f64vector-copy (f64vec f64vector?) ) ⟹ f64vector?

    (scheme vector f64) procedure (f64vector-copy (f64vec f64vector?) (start integer?) ) ⟹ f64vector?

    (scheme vector f64) procedure (f64vector-copy (f64vec f64vector?) (start integer?) (end integer?) ) ⟹ f64vector?

    Makes a copy of the portion of f64vec from start to end and returns it.

    (scheme vector f64) procedure (f64vector-reverse-copy (f64vec f64vector?) ) ⟹ f64vector?

    (scheme vector f64) procedure (f64vector-reverse-copy (f64vec f64vector?) (start integer?) ) ⟹ f64vector?

    (scheme vector f64) procedure (f64vector-reverse-copy (f64vec f64vector?) (start integer?) (end integer?) ) ⟹ f64vector?

    The same as f64vector-copy, but in reverse order.

    (scheme vector f64) procedure (f64vector-append (f64vec f64vector?) ... ) ⟹ f64vector?

    Returns a f64vector containing all the elements of the f64vecs in order.

    (scheme vector f64) procedure (f64vector-concatenate (list-of-f64vectors list?) ) ⟹ f64vector?

    list-of-f64vectors ⟹ (list f64vector?)

    The same as f64vector-append, but takes a list of f64vectors rather than multiple arguments.

    (scheme vector f64) procedure (f64vector-append-subvectors (f64vec1 f64vector?) (start1 integer?) (end1 integer?) ... ) ⟹ f64vector?

    Concatenates the result of applying f64vector-copy to each triplet of f64vec, start, end arguments, but may be implemented more efficiently.

    (scheme vector f64) procedure (f64vector-empty? (f64vec f64vector?) ) ⟹ boolean?

    Returns #t if f64vec has a length of zero, and #f otherwise.

    (scheme vector f64) procedure (f64vector= (f64vec f64vector?) ... ) ⟹ boolean?

    Compares the f64vecs for elementwise equality, using = to do the comparisons. Returns #f unless all f64vectors are the same length.

    (scheme vector f64) procedure (f64vector-take (f64vec f64vector?) (n integer?) ) ⟹ f64vector?

    (scheme vector f64) procedure (f64vector-take-right (f64vec f64vector?) (n integer?) ) ⟹ f64vector?

    Returns a f64vector containing the first/last n elements of f64vec.

    (scheme vector f64) procedure (f64vector-drop (f64vec f64vector?) (n integer?) ) ⟹ f64vector?

    (scheme vector f64) procedure (f64vector-drop-right (f64vec f64vector?) (n integer?) ) ⟹ f64vector?

    Returns a f64vector containing all except the first/last n elements of f64vec.

    (scheme vector f64) procedure (f64vector-segment (f64vec f64vector?) (n integer?) ) ⟹ list?

    Returns a list of f64vectors, each of which contains n consecutive elements of f64vec. The last f64vector may be shorter than n. It is an error if n is not an exact positive integer.

    (scheme vector f64) procedure (f64vector-fold (kons procedure?) knil (f64vec1 f64vector?) (f64vec2 f64vector?) ... ) ⟹ *

    (kons state (obj1 f64?) (obj2 f64?) ... ) ⟹ *

    (scheme vector f64) procedure (f64vector-fold-right (kons procedure?) knil (f64vec1 f64vector?) (f64vec2 f64vector?) ... ) ⟹ *

    (kons state (obj1 f64?) (obj2 f64?) ... ) ⟹ *

    When one f64vector argument f64vec is given, folds kons over the elements of f64vec in increasing/decreasing order using knil as the initial value. The kons procedure is called with the state first and the element second, as in SRFIs 43 and 133 (heterogeneous vectors). This is the opposite order to that used in SRFI 1 (lists) and the various string SRFIs.

    When multiple f64vector arguments are given, kons is called with the current state value and each value from all the vectors; f64vector-fold scans elements from left to right, while f64vector-fold-right does from right to left. If the lengths of vectors differ, only the portion of each vector up to the length of the shortest vector is scanned.

    (scheme vector f64) procedure (f64vector-map (proc procedure?) (f64vec1 f64vector?) (f64vec2 f64vector?) ... ) ⟹ vector?

    (proc (val1 f64?) ... ) ⟹ *

    (scheme vector f64) procedure (f64vector-map! (proc procedure?) (f64vec1 f64vector?) (f64vec2 f64vector?) ... ) ⟹ undefined

    (proc (val1 f64?) ... ) ⟹ *

    (scheme vector f64) procedure (f64vector-for-each (proc procedure?) (f64vec1 f64vector?) (f64vec2 f64vector?) ... ) ⟹ undefined

    (proc (val1 f64?) ... ) ⟹ undefined

    Iterate over the elements of f64vec and apply f to each, returning respectively a f64vector of the results, an undefined value with the results placed back in f64vec, and an undefined value with no change to f64vec.

    If more than one vector is passed, f gets one element from each vector as arguments. If the lengths of the vectors differ, iteration stops at the end of the shortest vector. For f64vector-map!, only f64vec is modified even when multiple vectors are passed.

    If f64vector-map or f64vector-map! returns more than once (i.e. because of a continuation captured by f), the values returned or stored by earlier returns may be mutated.

    (scheme vector f64) procedure (f64vector-count (pred? procedure?) (f64vec1 f64vector?) (f64vec2 f64vector?) ... ) ⟹ integer?

    (pred? (val1 f64?) (val2 f64?) ... ) ⟹ *

    Call pred? on each element of f64vec and return the number of calls that return true.

    When multiple vectors are given, pred? must take the same number of arguments as the number of vectors, and corresponding elements from each vector are given for each iteration, which stops at the end of the shortest vector.

    (scheme vector f64) procedure (f64vector-cumulate (f procedure?) knil (f64vec f64vector?) ) ⟹ f64vector?

    (f state (value f64?) ) ⟹ *

    Like f64vector-fold, but returns an f64vector of partial results rather than just the final result.

    (scheme vector f64) procedure (f64vector-take-while (pred? procedure?) (f64vec f64vector?) ) ⟹ f64vector?

    (pred? (value f64?) ) ⟹ boolean?

    (scheme vector f64) procedure (f64vector-take-while-right (pred? procedure?) (f64vec f64vector?) ) ⟹ f64vector?

    (pred? (value f64?) ) ⟹ boolean?

    Return the shortest prefix/suffix of f64vec all of whose elements satisfy pred?.

    (scheme vector f64) procedure (f64vector-drop-while (pred? procedure?) (f64vec f64vector?) ) ⟹ f64vector?

    (pred? (value f64?) ) ⟹ boolean?

    (scheme vector f64) procedure (f64vector-drop-while-right (pred? procedure?) (f64vec f64vector?) ) ⟹ f64vector?

    (pred? (value f64?) ) ⟹ boolean?

    Drops the longest initial prefix/suffix of f64vec such that all its elements satisfy pred.

    (scheme vector f64) procedure (f64vector-index (pred? procedure?) (f64vec1 f64vector?) (f64vec2 f64vector?) ... ) ⟹ integer? / #f /

    (pred? (value1 f64?) (value2 f64?) ... ) ⟹ *

    (scheme vector f64) procedure (f64vector-index-right (pred? procedure?) (f64vec1 f64vector?) (f64vec2 f64vector?) ... ) ⟹ integer? / #f /

    (pred? (value1 f64?) (value2 f64?) ... ) ⟹ *

    Return the index of the first/last element of f64vec that satisfies pred?.

    When multiple vectors are passed, pred? must take the same number of arguments as the number of vectors, and corresponding elements from each vector are passed for each iteration. If the lengths of vectors differ, f64vector-index stops iteration at the end of the shortest one. Lengths of vectors must be the same for f64vector-index-right.

    (scheme vector f64) procedure (f64vector-skip (pred? procedure?) (f64vec1 f64vector?) (f64vec2 f64vector?) ... ) ⟹ integer? / #f /

    (pred? (value1 f64?) (value2 f64?) ... ) ⟹ *

    (scheme vector f64) procedure (f64vector-skip-right (pred? procedure?) (f64vec1 f64vector?) (f64vec2 f64vector?) ... ) ⟹ integer? / #f /

    (pred? (value1 f64?) (value2 f64?) ... ) ⟹ *

    Returns the index of the first/last element of f64vec that does not satisfy pred?.

    When multiple vectors are passed, pred? must take the same number of arguments as the number of vectors, and corresponding elements from each vector are passed for each iteration. If the lengths of vectors differ, f64vector-skip stops iteration at the end of the shortest one. Lengths of vectors must be the same for f64vector-skip-right.

    (scheme vector f64) procedure (f64vector-any (pred? procedure?) (f64vec1 f64vector?) (f64vec2 f64vector?) ... ) ⟹ *

    (pred? (val1 f64?) (val2 f64?) ... ) ⟹ *

    Returns first non-false result of applying pred? on a element from the f64vec, or #f if there is no such element. If f64vec is empty, returns #t

    When multiple vectors are passed, pred? must take the same number of arguments as the number of vectors, and corresponding elements from each vector are passed for each iteration. If the lengths of vectors differ, it stops at the end of the shortest one.

    (scheme vector f64) procedure (f64vector-every (pred? procedure?) (f64vec1 f64vector?) (f64vec2 f64vector?) ... ) ⟹ *

    (pred? (val1 f64?) (val2 f64?) ... ) ⟹ *

    If all elements from f64vec satisfy pred?, return the last result of pred?. If not all do, return #f. If f64vec is empty, return #t

    When multiple vectors are passed, pred? must take the same number of arguments as the number of vectors, and corresponding elements from each vector is passed for each iteration. If the lengths of vectors differ, it stops at the end of the shortest one.

    (scheme vector f64) procedure (f64vector-partition (pred? procedure?) (f64vec f64vector?) ) ⟹ (values f64vector?integer?)

    (pred? (value f64?) ) ⟹ boolean?

    Returns an f64vector of the same type as f64vec, but with all elements satisfying pred? in the leftmost part of the vector and the other elements in the remaining part. The order of elements is otherwise preserved. Returns two values, the new f64vector and the number of elements satisfying pred?.

    (scheme vector f64) procedure (f64vector-filter (pred? procedure?) (f64vec1 f64vector?) ) ⟹ f64vector?

    (pred? (val f64?) ) ⟹ boolean?

    (scheme vector f64) procedure (f64vector-remove (pred? procedure?) (f64vec1 f64vector?) ) ⟹ f64vector?

    (pred? (val f64?) ) ⟹ boolean?

    Return an f64vector containing the elements of f64vec that satisfy / do not satisfy pred?.

    (scheme vector f64) procedure (f64vector-swap! (f64vec f64vector?) (i integer?) (j integer?) ) ⟹ undefined

    Interchanges the ith and jth elements of f64vec.

    (scheme vector f64) procedure (f64vector-fill! (f64vec f64vector?) (fill f64?) ) ⟹ undefined

    (scheme vector f64) procedure (f64vector-fill! (f64vec f64vector?) (fill f64?) (start integer?) ) ⟹ undefined

    (scheme vector f64) procedure (f64vector-fill! (f64vec f64vector?) (fill f64?) (start integer?) (end integer?) ) ⟹ undefined

    Fills the portion of f64vec from start to end with the value fill.

    (scheme vector f64) procedure (f64vector-reverse! (f64vec f64vector?) ) ⟹ undefined

    (scheme vector f64) procedure (f64vector-reverse! (f64vec f64vector?) (start integer?) ) ⟹ undefined

    (scheme vector f64) procedure (f64vector-reverse! (f64vec f64vector?) (start integer?) (end integer?) ) ⟹ undefined

    Reverses the portion of f64vec from start to end.

    (scheme vector f64) procedure (f64vector-copy! (f64to f64vector?) (at integer?) (f64from f64vector?) ) ⟹ undefined

    (scheme vector f64) procedure (f64vector-copy! (f64to f64vector?) (at integer?) (f64from f64vector?) (start integer?) ) ⟹ undefined

    (scheme vector f64) procedure (f64vector-copy! (f64to f64vector?) (at integer?) (f64from f64vector?) (start integer?) (end integer?) ) ⟹ undefined

    Copies the portion of f64from from start to end onto f64to, starting at index at.

    (scheme vector f64) procedure (f64vector-reverse-copy! (f64to f64vector?) (at integer?) (f64from f64vector?) ) ⟹ undefined

    (scheme vector f64) procedure (f64vector-reverse-copy! (f64to f64vector?) (at integer?) (f64from f64vector?) (start integer?) ) ⟹ undefined

    (scheme vector f64) procedure (f64vector-reverse-copy! (f64to f64vector?) (at integer?) (f64from f64vector?) (start integer?) (end integer?) ) ⟹ undefined

    The same as f64vector-copy!, but copies in reverse

    (scheme vector f64) procedure (f64vector-unfold! (f procedure?) (f64vec f64vector?) (start integer?) (end integer?) initial-seed ... ) ⟹ undefined

    (f (index integer?) seed ... ) ⟹ (values **...)

    Like f64vector-unfold, but the elements are copied into the vector f64vec starting at element start rather than into a newly allocated vector. Terminates when end - start elements have been generated.

    (scheme vector f64) procedure (f64vector-unfold-right! (f procedure?) (f64vec f64vector?) (start integer?) (end integer?) initial-seed ... ) ⟹ undefined

    (f (index integer?) seed ... ) ⟹ (values **...)

    The same as f64vector-unfold!, but initializes the f64vector from right to left.

    (scheme vector f64) procedure (reverse-f64vector->list (f64vec f64vector?) ) ⟹ list?

    (scheme vector f64) procedure (reverse-f64vector->list (f64vec f64vector?) (start integer?) ) ⟹ list?

    (scheme vector f64) procedure (reverse-f64vector->list (f64vec f64vector?) (start integer?) (end integer?) ) ⟹ list?

    Returns a list with same elements as f64vec in reverse order.

    (scheme vector f64) procedure (reverse-list->f64vector (proper-list list?) ) ⟹ f64vector?

    Returns f64vector with same elements as list in reverse order.

    (scheme vector f64) procedure (f64vector->vector (f64vec f64vector?) ) ⟹ vector?

    (scheme vector f64) procedure (f64vector->vector (f64vec f64vector?) (start integer?) ) ⟹ vector?

    (scheme vector f64) procedure (f64vector->vector (f64vec f64vector?) (start integer?) (end integer?) ) ⟹ vector?

    Returns vector with same elements as f64vec.

    (scheme vector f64) procedure (vector->f64vector (vec vector?) ) ⟹ f64vector?

    (scheme vector f64) procedure (vector->f64vector (vec vector?) (start integer?) ) ⟹ f64vector?

    (scheme vector f64) procedure (vector->f64vector (vec vector?) (start integer?) (end integer?) ) ⟹ f64vector?

    Returns f64vector with same elements as vec.

    (scheme vector f64) procedure (make-f64vector-generator (f64vector f64vector?) ) ⟹ procedure?

    (return ) ⟹ eof-object? / f64? /

    Returns a SRFI 121 generator that generates all the values of f64vector in order. Note that the generator is finite.

    f64vector-comparatorcomparator?

    Variable containing a SRFI 128 comparator whose components provide ordering and hashing of f64vector.

    (scheme vector f64) procedure (write-f64vector (f64vec f64vector) ) ⟹ undefined

    (scheme vector f64) procedure (write-f64vector (f64vec f64vector) (port output-port?) ) ⟹ undefined

    Prints to port (the current output port by default) a representation of f64vec in the lexical syntax explained below.

    library (scheme vector c64)

    (scheme vector c64) procedure (make-c64vector (size integer?) ) ⟹ c64vector?

    (scheme vector c64) procedure (make-c64vector (size integer?) (fill c64?) ) ⟹ c64vector?

    Returns a c64vector whose length is size. If fill is provided, all the elements of the c64vector are initialized to it.

    (scheme vector c64) procedure (c64vector (value c64?) ... ) ⟹ c64vector?

    Returns a c64vector initialized with values.

    (scheme vector c64) procedure (c64vector? obj ) ⟹ boolean?

    Returns #t if obj is a c64vector, and #f otherwise.

    (scheme vector c64) procedure (c64vector-length (c64vec c64vector?) ) ⟹ integer?

    Returns the length of c64vec

    (scheme vector c64) procedure (c64vector-ref (c64vec c64vector?) (i integer?) ) ⟹ c64?

    Returns the ith element of c64vec.

    (scheme vector c64) procedure (c64vector-set! (c64vec c64vector?) (i integer?) (value c64?) ) ⟹ undefined

    Sets the ith element of c64vec to value.

    (scheme vector c64) procedure (c64vector->list (c64vec c64vector?) ) ⟹ list?

    (scheme vector c64) procedure (c64vector->list (c64vec c64vector?) (start integer?) ) ⟹ list?

    (scheme vector c64) procedure (c64vector->list (c64vec c64vector?) (start integer?) (end integer?) ) ⟹ list?

    Returns a list with same elements as c64vec

    (scheme vector c64) procedure (list->c64vector (proper-list list?) ) ⟹ c64vector?

    proper-list ⟹ (list c64?)

    Returns c64vector with same elements as list.

    (scheme vector c64) procedure (c64? obj ) ⟹ boolean?

    Returns #t if obj is a valid element of an c64vector (ie., inexact complex), and #f otherwise.

    (scheme vector c64) procedure (c64vector-unfold (f procedure?) (length integer?) seed ) ⟹ c64vector?

    (scheme vector c64) procedure (c64vector-unfold (f procedure?) (length integer?) seed ) ⟹ c64vector?

    (f (index integer?) state ) ⟹ (values c64?*)

    Creates a vector whose length is length and iterates across each index k between 0 and length - 1, applying f at each iteration to the current index and current state, in that order, to receive two values: the element to put in the kth slot of the new vector and a new state for the next iteration. On the first call to f, the state's value is seed.

    (scheme vector c64) procedure (c64vector-copy (c64vec c64vector?) ) ⟹ c64vector?

    (scheme vector c64) procedure (c64vector-copy (c64vec c64vector?) (start integer?) ) ⟹ c64vector?

    (scheme vector c64) procedure (c64vector-copy (c64vec c64vector?) (start integer?) (end integer?) ) ⟹ c64vector?

    Makes a copy of the portion of c64vec from start to end and returns it.

    (scheme vector c64) procedure (c64vector-reverse-copy (c64vec c64vector?) ) ⟹ c64vector?

    (scheme vector c64) procedure (c64vector-reverse-copy (c64vec c64vector?) (start integer?) ) ⟹ c64vector?

    (scheme vector c64) procedure (c64vector-reverse-copy (c64vec c64vector?) (start integer?) (end integer?) ) ⟹ c64vector?

    The same as c64vector-copy, but in reverse order.

    (scheme vector c64) procedure (c64vector-append (c64vec c64vector?) ... ) ⟹ c64vector?

    Returns a c64vector containing all the elements of the c64vecs in order.

    (scheme vector c64) procedure (c64vector-concatenate (list-of-c64vectors list?) ) ⟹ c64vector?

    list-of-c64vectors ⟹ (list c64vector?)

    The same as c64vector-append, but takes a list of c64vectors rather than multiple arguments.

    (scheme vector c64) procedure (c64vector-append-subvectors (c64vec1 c64vector?) (start1 integer?) (end1 integer?) ... ) ⟹ c64vector?

    Concatenates the result of applying c64vector-copy to each triplet of c64vec, start, end arguments, but may be implemented more efficiently.

    (scheme vector c64) procedure (c64vector-empty? (c64vec c64vector?) ) ⟹ boolean?

    Returns #t if c64vec has a length of zero, and #f otherwise.

    (scheme vector c64) procedure (c64vector= (c64vec c64vector?) ... ) ⟹ boolean?

    Compares the c64vecs for elementwise equality, using = to do the comparisons. Returns #f unless all c64vectors are the same length.

    (scheme vector c64) procedure (c64vector-take (c64vec c64vector?) (n integer?) ) ⟹ c64vector?

    (scheme vector c64) procedure (c64vector-take-right (c64vec c64vector?) (n integer?) ) ⟹ c64vector?

    Returns a c64vector containing the first/last n elements of c64vec.

    (scheme vector c64) procedure (c64vector-drop (c64vec c64vector?) (n integer?) ) ⟹ c64vector?

    (scheme vector c64) procedure (c64vector-drop-right (c64vec c64vector?) (n integer?) ) ⟹ c64vector?

    Returns a c64vector containing all except the first/last n elements of c64vec.

    (scheme vector c64) procedure (c64vector-segment (c64vec c64vector?) (n integer?) ) ⟹ list?

    Returns a list of c64vectors, each of which contains n consecutive elements of c64vec. The last c64vector may be shorter than n. It is an error if n is not an exact positive integer.

    (scheme vector c64) procedure (c64vector-fold (kons procedure?) knil (c64vec1 c64vector?) (c64vec2 c64vector?) ... ) ⟹ *

    (kons state (obj1 c64?) (obj2 c64?) ... ) ⟹ *

    (scheme vector c64) procedure (c64vector-fold-right (kons procedure?) knil (c64vec1 c64vector?) (c64vec2 c64vector?) ... ) ⟹ *

    (kons state (obj1 c64?) (obj2 c64?) ... ) ⟹ *

    When one c64vector argument c64vec is given, folds kons over the elements of c64vec in increasing/decreasing order using knil as the initial value. The kons procedure is called with the state first and the element second, as in SRFIs 43 and 133 (heterogeneous vectors). This is the opposite order to that used in SRFI 1 (lists) and the various string SRFIs.

    When multiple c64vector arguments are given, kons is called with the current state value and each value from all the vectors; c64vector-fold scans elements from left to right, while c64vector-fold-right does from right to left. If the lengths of vectors differ, only the portion of each vector up to the length of the shortest vector is scanned.

    (scheme vector c64) procedure (c64vector-map (proc procedure?) (c64vec1 c64vector?) (c64vec2 c64vector?) ... ) ⟹ vector?

    (proc (val1 c64?) ... ) ⟹ *

    (scheme vector c64) procedure (c64vector-map! (proc procedure?) (c64vec1 c64vector?) (c64vec2 c64vector?) ... ) ⟹ undefined

    (proc (val1 c64?) ... ) ⟹ *

    (scheme vector c64) procedure (c64vector-for-each (proc procedure?) (c64vec1 c64vector?) (c64vec2 c64vector?) ... ) ⟹ undefined

    (proc (val1 c64?) ... ) ⟹ undefined

    Iterate over the elements of c64vec and apply f to each, returning respectively a c64vector of the results, an undefined value with the results placed back in c64vec, and an undefined value with no change to c64vec.

    If more than one vector is passed, f gets one element from each vector as arguments. If the lengths of the vectors differ, iteration stops at the end of the shortest vector. For c64vector-map!, only c64vec is modified even when multiple vectors are passed.

    If c64vector-map or c64vector-map! returns more than once (i.e. because of a continuation captured by f), the values returned or stored by earlier returns may be mutated.

    (scheme vector c64) procedure (c64vector-count (pred? procedure?) (c64vec1 c64vector?) (c64vec2 c64vector?) ... ) ⟹ integer?

    (pred? (val1 c64?) (val2 c64?) ... ) ⟹ *

    Call pred? on each element of c64vec and return the number of calls that return true.

    When multiple vectors are given, pred? must take the same number of arguments as the number of vectors, and corresponding elements from each vector are given for each iteration, which stops at the end of the shortest vector.

    (scheme vector c64) procedure (c64vector-cumulate (f procedure?) knil (c64vec c64vector?) ) ⟹ c64vector?

    (f state (value c64?) ) ⟹ *

    Like c64vector-fold, but returns an c64vector of partial results rather than just the final result.

    (scheme vector c64) procedure (c64vector-take-while (pred? procedure?) (c64vec c64vector?) ) ⟹ c64vector?

    (pred? (value c64?) ) ⟹ boolean?

    (scheme vector c64) procedure (c64vector-take-while-right (pred? procedure?) (c64vec c64vector?) ) ⟹ c64vector?

    (pred? (value c64?) ) ⟹ boolean?

    Return the shortest prefix/suffix of c64vec all of whose elements satisfy pred?.

    (scheme vector c64) procedure (c64vector-drop-while (pred? procedure?) (c64vec c64vector?) ) ⟹ c64vector?

    (pred? (value c64?) ) ⟹ boolean?

    (scheme vector c64) procedure (c64vector-drop-while-right (pred? procedure?) (c64vec c64vector?) ) ⟹ c64vector?

    (pred? (value c64?) ) ⟹ boolean?

    Drops the longest initial prefix/suffix of c64vec such that all its elements satisfy pred.

    (scheme vector c64) procedure (c64vector-index (pred? procedure?) (c64vec1 c64vector?) (c64vec2 c64vector?) ... ) ⟹ integer? / #f /

    (pred? (value1 c64?) (value2 c64?) ... ) ⟹ *

    (scheme vector c64) procedure (c64vector-index-right (pred? procedure?) (c64vec1 c64vector?) (c64vec2 c64vector?) ... ) ⟹ integer? / #f /

    (pred? (value1 c64?) (value2 c64?) ... ) ⟹ *

    Return the index of the first/last element of c64vec that satisfies pred?.

    When multiple vectors are passed, pred? must take the same number of arguments as the number of vectors, and corresponding elements from each vector are passed for each iteration. If the lengths of vectors differ, c64vector-index stops iteration at the end of the shortest one. Lengths of vectors must be the same for c64vector-index-right.

    (scheme vector c64) procedure (c64vector-skip (pred? procedure?) (c64vec1 c64vector?) (c64vec2 c64vector?) ... ) ⟹ integer? / #f /

    (pred? (value1 c64?) (value2 c64?) ... ) ⟹ *

    (scheme vector c64) procedure (c64vector-skip-right (pred? procedure?) (c64vec1 c64vector?) (c64vec2 c64vector?) ... ) ⟹ integer? / #f /

    (pred? (value1 c64?) (value2 c64?) ... ) ⟹ *

    Returns the index of the first/last element of c64vec that does not satisfy pred?.

    When multiple vectors are passed, pred? must take the same number of arguments as the number of vectors, and corresponding elements from each vector are passed for each iteration. If the lengths of vectors differ, c64vector-skip stops iteration at the end of the shortest one. Lengths of vectors must be the same for c64vector-skip-right.

    (scheme vector c64) procedure (c64vector-any (pred? procedure?) (c64vec1 c64vector?) (c64vec2 c64vector?) ... ) ⟹ *

    (pred? (val1 c64?) (val2 c64?) ... ) ⟹ *

    Returns first non-false result of applying pred? on a element from the c64vec, or #f if there is no such element. If c64vec is empty, returns #t

    When multiple vectors are passed, pred? must take the same number of arguments as the number of vectors, and corresponding elements from each vector are passed for each iteration. If the lengths of vectors differ, it stops at the end of the shortest one.

    (scheme vector c64) procedure (c64vector-every (pred? procedure?) (c64vec1 c64vector?) (c64vec2 c64vector?) ... ) ⟹ *

    (pred? (val1 c64?) (val2 c64?) ... ) ⟹ *

    If all elements from c64vec satisfy pred?, return the last result of pred?. If not all do, return #f. If c64vec is empty, return #t

    When multiple vectors are passed, pred? must take the same number of arguments as the number of vectors, and corresponding elements from each vector is passed for each iteration. If the lengths of vectors differ, it stops at the end of the shortest one.

    (scheme vector c64) procedure (c64vector-partition (pred? procedure?) (c64vec c64vector?) ) ⟹ (values c64vector?integer?)

    (pred? (value c64?) ) ⟹ boolean?

    Returns an c64vector of the same type as c64vec, but with all elements satisfying pred? in the leftmost part of the vector and the other elements in the remaining part. The order of elements is otherwise preserved. Returns two values, the new c64vector and the number of elements satisfying pred?.

    (scheme vector c64) procedure (c64vector-filter (pred? procedure?) (c64vec1 c64vector?) ) ⟹ c64vector?

    (pred? (val c64?) ) ⟹ boolean?

    (scheme vector c64) procedure (c64vector-remove (pred? procedure?) (c64vec1 c64vector?) ) ⟹ c64vector?

    (pred? (val c64?) ) ⟹ boolean?

    Return an c64vector containing the elements of c64vec that satisfy / do not satisfy pred?.

    (scheme vector c64) procedure (c64vector-swap! (c64vec c64vector?) (i integer?) (j integer?) ) ⟹ undefined

    Interchanges the ith and jth elements of c64vec.

    (scheme vector c64) procedure (c64vector-fill! (c64vec c64vector?) (fill c64?) ) ⟹ undefined

    (scheme vector c64) procedure (c64vector-fill! (c64vec c64vector?) (fill c64?) (start integer?) ) ⟹ undefined

    (scheme vector c64) procedure (c64vector-fill! (c64vec c64vector?) (fill c64?) (start integer?) (end integer?) ) ⟹ undefined

    Fills the portion of c64vec from start to end with the value fill.

    (scheme vector c64) procedure (c64vector-reverse! (c64vec c64vector?) ) ⟹ undefined

    (scheme vector c64) procedure (c64vector-reverse! (c64vec c64vector?) (start integer?) ) ⟹ undefined

    (scheme vector c64) procedure (c64vector-reverse! (c64vec c64vector?) (start integer?) (end integer?) ) ⟹ undefined

    Reverses the portion of c64vec from start to end.

    (scheme vector c64) procedure (c64vector-copy! (c64to c64vector?) (at integer?) (c64from c64vector?) ) ⟹ undefined

    (scheme vector c64) procedure (c64vector-copy! (c64to c64vector?) (at integer?) (c64from c64vector?) (start integer?) ) ⟹ undefined

    (scheme vector c64) procedure (c64vector-copy! (c64to c64vector?) (at integer?) (c64from c64vector?) (start integer?) (end integer?) ) ⟹ undefined

    Copies the portion of c64from from start to end onto c64to, starting at index at.

    (scheme vector c64) procedure (c64vector-reverse-copy! (c64to c64vector?) (at integer?) (c64from c64vector?) ) ⟹ undefined

    (scheme vector c64) procedure (c64vector-reverse-copy! (c64to c64vector?) (at integer?) (c64from c64vector?) (start integer?) ) ⟹ undefined

    (scheme vector c64) procedure (c64vector-reverse-copy! (c64to c64vector?) (at integer?) (c64from c64vector?) (start integer?) (end integer?) ) ⟹ undefined

    The same as c64vector-copy!, but copies in reverse

    (scheme vector c64) procedure (c64vector-unfold! (f procedure?) (c64vec c64vector?) (start integer?) (end integer?) initial-seed ... ) ⟹ undefined

    (f (index integer?) seed ... ) ⟹ (values **...)

    Like c64vector-unfold, but the elements are copied into the vector c64vec starting at element start rather than into a newly allocated vector. Terminates when end - start elements have been generated.

    (scheme vector c64) procedure (c64vector-unfold-right! (f procedure?) (c64vec c64vector?) (start integer?) (end integer?) initial-seed ... ) ⟹ undefined

    (f (index integer?) seed ... ) ⟹ (values **...)

    The same as c64vector-unfold!, but initializes the c64vector from right to left.

    (scheme vector c64) procedure (reverse-c64vector->list (c64vec c64vector?) ) ⟹ list?

    (scheme vector c64) procedure (reverse-c64vector->list (c64vec c64vector?) (start integer?) ) ⟹ list?

    (scheme vector c64) procedure (reverse-c64vector->list (c64vec c64vector?) (start integer?) (end integer?) ) ⟹ list?

    Returns a list with same elements as c64vec in reverse order.

    (scheme vector c64) procedure (reverse-list->c64vector (proper-list list?) ) ⟹ c64vector?

    Returns c64vector with same elements as list in reverse order.

    (scheme vector c64) procedure (c64vector->vector (c64vec c64vector?) ) ⟹ vector?

    (scheme vector c64) procedure (c64vector->vector (c64vec c64vector?) (start integer?) ) ⟹ vector?

    (scheme vector c64) procedure (c64vector->vector (c64vec c64vector?) (start integer?) (end integer?) ) ⟹ vector?

    Returns vector with same elements as c64vec.

    (scheme vector c64) procedure (vector->c64vector (vec vector?) ) ⟹ c64vector?

    (scheme vector c64) procedure (vector->c64vector (vec vector?) (start integer?) ) ⟹ c64vector?

    (scheme vector c64) procedure (vector->c64vector (vec vector?) (start integer?) (end integer?) ) ⟹ c64vector?

    Returns c64vector with same elements as vec.

    (scheme vector c64) procedure (make-c64vector-generator (c64vector c64vector?) ) ⟹ procedure?

    (return ) ⟹ eof-object? / c64? /

    Returns a SRFI 121 generator that generates all the values of c64vector in order. Note that the generator is finite.

    c64vector-comparatorcomparator?

    Variable containing a SRFI 128 comparator whose components provide ordering and hashing of c64vector.

    (scheme vector c64) procedure (write-c64vector (c64vec c64vector) ) ⟹ undefined

    (scheme vector c64) procedure (write-c64vector (c64vec c64vector) (port output-port?) ) ⟹ undefined

    Prints to port (the current output port by default) a representation of c64vec in the lexical syntax explained below.

    library (scheme vector c128)

    (scheme vector c128) procedure (make-c128vector (size integer?) ) ⟹ c128vector?

    (scheme vector c128) procedure (make-c128vector (size integer?) (fill c128?) ) ⟹ c128vector?

    Returns a c128vector whose length is size. If fill is provided, all the elements of the c128vector are initialized to it.

    (scheme vector c128) procedure (c128vector (value c128?) ... ) ⟹ c128vector?

    Returns a c128vector initialized with values.

    (scheme vector c128) procedure (c128vector? obj ) ⟹ boolean?

    Returns #t if obj is a c128vector, and #f otherwise.

    (scheme vector c128) procedure (c128vector-length (c128vec c128vector?) ) ⟹ integer?

    Returns the length of c128vec

    (scheme vector c128) procedure (c128vector-ref (c128vec c128vector?) (i integer?) ) ⟹ c128?

    Returns the ith element of c128vec.

    (scheme vector c128) procedure (c128vector-set! (c128vec c128vector?) (i integer?) (value c128?) ) ⟹ undefined

    Sets the ith element of c128vec to value.

    (scheme vector c128) procedure (c128vector->list (c128vec c128vector?) ) ⟹ list?

    (scheme vector c128) procedure (c128vector->list (c128vec c128vector?) (start integer?) ) ⟹ list?

    (scheme vector c128) procedure (c128vector->list (c128vec c128vector?) (start integer?) (end integer?) ) ⟹ list?

    Returns a list with same elements as c128vec

    (scheme vector c128) procedure (list->c128vector (proper-list list?) ) ⟹ c128vector?

    proper-list ⟹ (list c128?)

    Returns c128vector with same elements as list.

    (scheme vector c128) procedure (c128? obj ) ⟹ boolean?

    Returns #t if obj is a valid element of an c128vector (ie., inexact complex), and #f otherwise.

    (scheme vector c128) procedure (c128vector-unfold (f procedure?) (length integer?) seed ) ⟹ c128vector?

    (scheme vector c128) procedure (c128vector-unfold (f procedure?) (length integer?) seed ) ⟹ c128vector?

    (f (index integer?) state ) ⟹ (values c128?*)

    Creates a vector whose length is length and iterates across each index k between 0 and length - 1, applying f at each iteration to the current index and current state, in that order, to receive two values: the element to put in the kth slot of the new vector and a new state for the next iteration. On the first call to f, the state's value is seed.

    (scheme vector c128) procedure (c128vector-copy (c128vec c128vector?) ) ⟹ c128vector?

    (scheme vector c128) procedure (c128vector-copy (c128vec c128vector?) (start integer?) ) ⟹ c128vector?

    (scheme vector c128) procedure (c128vector-copy (c128vec c128vector?) (start integer?) (end integer?) ) ⟹ c128vector?

    Makes a copy of the portion of c128vec from start to end and returns it.

    (scheme vector c128) procedure (c128vector-reverse-copy (c128vec c128vector?) ) ⟹ c128vector?

    (scheme vector c128) procedure (c128vector-reverse-copy (c128vec c128vector?) (start integer?) ) ⟹ c128vector?

    (scheme vector c128) procedure (c128vector-reverse-copy (c128vec c128vector?) (start integer?) (end integer?) ) ⟹ c128vector?

    The same as c128vector-copy, but in reverse order.

    (scheme vector c128) procedure (c128vector-append (c128vec c128vector?) ... ) ⟹ c128vector?

    Returns a c128vector containing all the elements of the c128vecs in order.

    (scheme vector c128) procedure (c128vector-concatenate (list-of-c128vectors list?) ) ⟹ c128vector?

    list-of-c128vectors ⟹ (list c128vector?)

    The same as c128vector-append, but takes a list of c128vectors rather than multiple arguments.

    (scheme vector c128) procedure (c128vector-append-subvectors (c128vec1 c128vector?) (start1 integer?) (end1 integer?) ... ) ⟹ c128vector?

    Concatenates the result of applying c128vector-copy to each triplet of c128vec, start, end arguments, but may be implemented more efficiently.

    (scheme vector c128) procedure (c128vector-empty? (c128vec c128vector?) ) ⟹ boolean?

    Returns #t if c128vec has a length of zero, and #f otherwise.

    (scheme vector c128) procedure (c128vector= (c128vec c128vector?) ... ) ⟹ boolean?

    Compares the c128vecs for elementwise equality, using = to do the comparisons. Returns #f unless all c128vectors are the same length.

    (scheme vector c128) procedure (c128vector-take (c128vec c128vector?) (n integer?) ) ⟹ c128vector?

    (scheme vector c128) procedure (c128vector-take-right (c128vec c128vector?) (n integer?) ) ⟹ c128vector?

    Returns a c128vector containing the first/last n elements of c128vec.

    (scheme vector c128) procedure (c128vector-drop (c128vec c128vector?) (n integer?) ) ⟹ c128vector?

    (scheme vector c128) procedure (c128vector-drop-right (c128vec c128vector?) (n integer?) ) ⟹ c128vector?

    Returns a c128vector containing all except the first/last n elements of c128vec.

    (scheme vector c128) procedure (c128vector-segment (c128vec c128vector?) (n integer?) ) ⟹ list?

    Returns a list of c128vectors, each of which contains n consecutive elements of c128vec. The last c128vector may be shorter than n. It is an error if n is not an exact positive integer.

    (scheme vector c128) procedure (c128vector-fold (kons procedure?) knil (c128vec1 c128vector?) (c128vec2 c128vector?) ... ) ⟹ *

    (kons state (obj1 c128?) (obj2 c128?) ... ) ⟹ *

    (scheme vector c128) procedure (c128vector-fold-right (kons procedure?) knil (c128vec1 c128vector?) (c128vec2 c128vector?) ... ) ⟹ *

    (kons state (obj1 c128?) (obj2 c128?) ... ) ⟹ *

    When one c128vector argument c128vec is given, folds kons over the elements of c128vec in increasing/decreasing order using knil as the initial value. The kons procedure is called with the state first and the element second, as in SRFIs 43 and 133 (heterogeneous vectors). This is the opposite order to that used in SRFI 1 (lists) and the various string SRFIs.

    When multiple c128vector arguments are given, kons is called with the current state value and each value from all the vectors; c128vector-fold scans elements from left to right, while c128vector-fold-right does from right to left. If the lengths of vectors differ, only the portion of each vector up to the length of the shortest vector is scanned.

    (scheme vector c128) procedure (c128vector-map (proc procedure?) (c128vec1 c128vector?) (c128vec2 c128vector?) ... ) ⟹ vector?

    (proc (val1 c128?) ... ) ⟹ *

    (scheme vector c128) procedure (c128vector-map! (proc procedure?) (c128vec1 c128vector?) (c128vec2 c128vector?) ... ) ⟹ undefined

    (proc (val1 c128?) ... ) ⟹ *

    (scheme vector c128) procedure (c128vector-for-each (proc procedure?) (c128vec1 c128vector?) (c128vec2 c128vector?) ... ) ⟹ undefined

    (proc (val1 c128?) ... ) ⟹ undefined

    Iterate over the elements of c128vec and apply f to each, returning respectively a c128vector of the results, an undefined value with the results placed back in c128vec, and an undefined value with no change to c128vec.

    If more than one vector is passed, f gets one element from each vector as arguments. If the lengths of the vectors differ, iteration stops at the end of the shortest vector. For c128vector-map!, only c128vec is modified even when multiple vectors are passed.

    If c128vector-map or c128vector-map! returns more than once (i.e. because of a continuation captured by f), the values returned or stored by earlier returns may be mutated.

    (scheme vector c128) procedure (c128vector-count (pred? procedure?) (c128vec1 c128vector?) (c128vec2 c128vector?) ... ) ⟹ integer?

    (pred? (val1 c128?) (val2 c128?) ... ) ⟹ *

    Call pred? on each element of c128vec and return the number of calls that return true.

    When multiple vectors are given, pred? must take the same number of arguments as the number of vectors, and corresponding elements from each vector are given for each iteration, which stops at the end of the shortest vector.

    (scheme vector c128) procedure (c128vector-cumulate (f procedure?) knil (c128vec c128vector?) ) ⟹ c128vector?

    (f state (value c128?) ) ⟹ *

    Like c128vector-fold, but returns an c128vector of partial results rather than just the final result.

    (scheme vector c128) procedure (c128vector-take-while (pred? procedure?) (c128vec c128vector?) ) ⟹ c128vector?

    (pred? (value c128?) ) ⟹ boolean?

    (scheme vector c128) procedure (c128vector-take-while-right (pred? procedure?) (c128vec c128vector?) ) ⟹ c128vector?

    (pred? (value c128?) ) ⟹ boolean?

    Return the shortest prefix/suffix of c128vec all of whose elements satisfy pred?.

    (scheme vector c128) procedure (c128vector-drop-while (pred? procedure?) (c128vec c128vector?) ) ⟹ c128vector?

    (pred? (value c128?) ) ⟹ boolean?

    (scheme vector c128) procedure (c128vector-drop-while-right (pred? procedure?) (c128vec c128vector?) ) ⟹ c128vector?

    (pred? (value c128?) ) ⟹ boolean?

    Drops the longest initial prefix/suffix of c128vec such that all its elements satisfy pred.

    (scheme vector c128) procedure (c128vector-index (pred? procedure?) (c128vec1 c128vector?) (c128vec2 c128vector?) ... ) ⟹ integer? / #f /

    (pred? (value1 c128?) (value2 c128?) ... ) ⟹ *

    (scheme vector c128) procedure (c128vector-index-right (pred? procedure?) (c128vec1 c128vector?) (c128vec2 c128vector?) ... ) ⟹ integer? / #f /

    (pred? (value1 c128?) (value2 c128?) ... ) ⟹ *

    Return the index of the first/last element of c128vec that satisfies pred?.

    When multiple vectors are passed, pred? must take the same number of arguments as the number of vectors, and corresponding elements from each vector are passed for each iteration. If the lengths of vectors differ, c128vector-index stops iteration at the end of the shortest one. Lengths of vectors must be the same for c128vector-index-right.

    (scheme vector c128) procedure (c128vector-skip (pred? procedure?) (c128vec1 c128vector?) (c128vec2 c128vector?) ... ) ⟹ integer? / #f /

    (pred? (value1 c128?) (value2 c128?) ... ) ⟹ *

    (scheme vector c128) procedure (c128vector-skip-right (pred? procedure?) (c128vec1 c128vector?) (c128vec2 c128vector?) ... ) ⟹ integer? / #f /

    (pred? (value1 c128?) (value2 c128?) ... ) ⟹ *

    Returns the index of the first/last element of c128vec that does not satisfy pred?.

    When multiple vectors are passed, pred? must take the same number of arguments as the number of vectors, and corresponding elements from each vector are passed for each iteration. If the lengths of vectors differ, c128vector-skip stops iteration at the end of the shortest one. Lengths of vectors must be the same for c128vector-skip-right.

    (scheme vector c128) procedure (c128vector-any (pred? procedure?) (c128vec1 c128vector?) (c128vec2 c128vector?) ... ) ⟹ *

    (pred? (val1 c128?) (val2 c128?) ... ) ⟹ *

    Returns first non-false result of applying pred? on a element from the c128vec, or #f if there is no such element. If c128vec is empty, returns #t

    When multiple vectors are passed, pred? must take the same number of arguments as the number of vectors, and corresponding elements from each vector are passed for each iteration. If the lengths of vectors differ, it stops at the end of the shortest one.

    (scheme vector c128) procedure (c128vector-every (pred? procedure?) (c128vec1 c128vector?) (c128vec2 c128vector?) ... ) ⟹ *

    (pred? (val1 c128?) (val2 c128?) ... ) ⟹ *

    If all elements from c128vec satisfy pred?, return the last result of pred?. If not all do, return #f. If c128vec is empty, return #t

    When multiple vectors are passed, pred? must take the same number of arguments as the number of vectors, and corresponding elements from each vector is passed for each iteration. If the lengths of vectors differ, it stops at the end of the shortest one.

    (scheme vector c128) procedure (c128vector-partition (pred? procedure?) (c128vec c128vector?) ) ⟹ (values c128vector?integer?)

    (pred? (value c128?) ) ⟹ boolean?

    Returns an c128vector of the same type as c128vec, but with all elements satisfying pred? in the leftmost part of the vector and the other elements in the remaining part. The order of elements is otherwise preserved. Returns two values, the new c128vector and the number of elements satisfying pred?.

    (scheme vector c128) procedure (c128vector-filter (pred? procedure?) (c128vec1 c128vector?) ) ⟹ c128vector?

    (pred? (val c128?) ) ⟹ boolean?

    (scheme vector c128) procedure (c128vector-remove (pred? procedure?) (c128vec1 c128vector?) ) ⟹ c128vector?

    (pred? (val c128?) ) ⟹ boolean?

    Return an c128vector containing the elements of c128vec that satisfy / do not satisfy pred?.

    (scheme vector c128) procedure (c128vector-swap! (c128vec c128vector?) (i integer?) (j integer?) ) ⟹ undefined

    Interchanges the ith and jth elements of c128vec.

    (scheme vector c128) procedure (c128vector-fill! (c128vec c128vector?) (fill c128?) ) ⟹ undefined

    (scheme vector c128) procedure (c128vector-fill! (c128vec c128vector?) (fill c128?) (start integer?) ) ⟹ undefined

    (scheme vector c128) procedure (c128vector-fill! (c128vec c128vector?) (fill c128?) (start integer?) (end integer?) ) ⟹ undefined

    Fills the portion of c128vec from start to end with the value fill.

    (scheme vector c128) procedure (c128vector-reverse! (c128vec c128vector?) ) ⟹ undefined

    (scheme vector c128) procedure (c128vector-reverse! (c128vec c128vector?) (start integer?) ) ⟹ undefined

    (scheme vector c128) procedure (c128vector-reverse! (c128vec c128vector?) (start integer?) (end integer?) ) ⟹ undefined

    Reverses the portion of c128vec from start to end.

    (scheme vector c128) procedure (c128vector-copy! (c128to c128vector?) (at integer?) (c128from c128vector?) ) ⟹ undefined

    (scheme vector c128) procedure (c128vector-copy! (c128to c128vector?) (at integer?) (c128from c128vector?) (start integer?) ) ⟹ undefined

    (scheme vector c128) procedure (c128vector-copy! (c128to c128vector?) (at integer?) (c128from c128vector?) (start integer?) (end integer?) ) ⟹ undefined

    Copies the portion of c128from from start to end onto c128to, starting at index at.

    (scheme vector c128) procedure (c128vector-reverse-copy! (c128to c128vector?) (at integer?) (c128from c128vector?) ) ⟹ undefined

    (scheme vector c128) procedure (c128vector-reverse-copy! (c128to c128vector?) (at integer?) (c128from c128vector?) (start integer?) ) ⟹ undefined

    (scheme vector c128) procedure (c128vector-reverse-copy! (c128to c128vector?) (at integer?) (c128from c128vector?) (start integer?) (end integer?) ) ⟹ undefined

    The same as c128vector-copy!, but copies in reverse

    (scheme vector c128) procedure (c128vector-unfold! (f procedure?) (c128vec c128vector?) (start integer?) (end integer?) initial-seed ... ) ⟹ undefined

    (f (index integer?) seed ... ) ⟹ (values **...)

    Like c128vector-unfold, but the elements are copied into the vector c128vec starting at element start rather than into a newly allocated vector. Terminates when end - start elements have been generated.

    (scheme vector c128) procedure (c128vector-unfold-right! (f procedure?) (c128vec c128vector?) (start integer?) (end integer?) initial-seed ... ) ⟹ undefined

    (f (index integer?) seed ... ) ⟹ (values **...)

    The same as c128vector-unfold!, but initializes the c128vector from right to left.

    (scheme vector c128) procedure (reverse-c128vector->list (c128vec c128vector?) ) ⟹ list?

    (scheme vector c128) procedure (reverse-c128vector->list (c128vec c128vector?) (start integer?) ) ⟹ list?

    (scheme vector c128) procedure (reverse-c128vector->list (c128vec c128vector?) (start integer?) (end integer?) ) ⟹ list?

    Returns a list with same elements as c128vec in reverse order.

    (scheme vector c128) procedure (reverse-list->c128vector (proper-list list?) ) ⟹ c128vector?

    Returns c128vector with same elements as list in reverse order.

    (scheme vector c128) procedure (c128vector->vector (c128vec c128vector?) ) ⟹ vector?

    (scheme vector c128) procedure (c128vector->vector (c128vec c128vector?) (start integer?) ) ⟹ vector?

    (scheme vector c128) procedure (c128vector->vector (c128vec c128vector?) (start integer?) (end integer?) ) ⟹ vector?

    Returns vector with same elements as c128vec.

    (scheme vector c128) procedure (vector->c128vector (vec vector?) ) ⟹ c128vector?

    (scheme vector c128) procedure (vector->c128vector (vec vector?) (start integer?) ) ⟹ c128vector?

    (scheme vector c128) procedure (vector->c128vector (vec vector?) (start integer?) (end integer?) ) ⟹ c128vector?

    Returns c128vector with same elements as vec.

    (scheme vector c128) procedure (make-c128vector-generator (c128vector c128vector?) ) ⟹ procedure?

    (return ) ⟹ eof-object? / c128? /

    Returns a SRFI 121 generator that generates all the values of c128vector in order. Note that the generator is finite.

    c128vector-comparatorcomparator?

    Variable containing a SRFI 128 comparator whose components provide ordering and hashing of c128vector.

    (scheme vector c128) procedure (write-c128vector (c128vec c128vector) ) ⟹ undefined

    (scheme vector c128) procedure (write-c128vector (c128vec c128vector) (port output-port?) ) ⟹ undefined

    Prints to port (the current output port by default) a representation of c128vec in the lexical syntax explained below.