Manual alphabetic index |
This is a reference manual of Mosh , an R6RS Scheme implementation.
This manual is for version 0.0.6.
1 Base library. | |||
R6RS chapter 11. | |||
eqv? | |||
Form | (eqv? obj1 obj2) | ||
Description | 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 and #f otherwise. The eqv? procedure returns #t if one of the following holds: Obj1 and obj2 are both booleans and are the same according to the boolean=? procedure. Obj1 and obj2 are both symbols and are the same according to the symbol=? procedure. Obj1 and obj2 are both exactnumber objects and are numerically equal. Obj1 and obj2 are both inexactnumber objects, are numerically equal, and 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. Obj1 and obj2 are both characters and are the same character according to the char=? procedure . Both obj1 and obj2 are the empty list. Obj1 and obj2 are objects such as pairs, vectors, bytevectors , strings, hashtables, records, ports, or hashtables that refer to the same locations in the store. Obj1 and obj2 are record-type descriptors that are specified to be eqv? in library. The eqv? procedure returns #f if one of the following holds: Obj1 and obj2 are of different types. Obj1 and obj2 are booleans for which the boolean=? procedure returns #f. Obj1 and obj2 are symbols for which the symbol=? procedure returns #f. One of obj1 and obj2 is an exact number object but the other is an inexact number object. Obj1 and obj2 are rational number objects for which the = procedure returns #f. Obj1 and obj2 yield different 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. 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 objects such as pairs, vectors, bytevectors (library chapter on "Bytevectors"), strings, records (library chapter on "Records"), ports, or hashtables that refer to distinct locations. Obj1 and obj2 are pairs, vectors, strings, or records, or hashtables, where the applying the same accessor (i.e. car, cdr, vector-ref, string-ref, or record accessors) to both yields results for which eqv? returns #f. Obj1 and obj2 are procedures that would behave differently (return different values or have different side effects) for some arguments. (lambda () 2)) => #f | ||
Returns | #t if equal | ||
Examples | (eqv? 'a 'a) => #t | ||
(eqv? 'a 'b) => #f | |||
(eqv? 2 2) => #t | |||
(eqv? '() '()) => #t | |||
(eqv? 100000000 100000000) => #t | |||
(eqv? (cons 1 2) (cons 1 2)) => #f | |||
(eqv? (lambda () 1) | |||
(eqv? #f 'nil) => #f | |||
integer? | |||
Form | (integer? obj) | ||
Description | Returns#t if obj is integer, otherwise #f. | ||
Returns | #t if obj is integer, otherwise #f. | ||
char>=? | |||
Form | (char>=? char1 char2 char3 ...) | ||
Description | Impose a total ordering on the set of characters according to their Unicode scalar values. | ||
char>? | |||
Form | (char>? char1 char2 char3 ...) | ||
Description | Impose a total ordering on the set of characters according to their Unicode scalar values. | ||
char<=? | |||
Form | (char<=? char1 char2 char3 ...) | ||
Description | Impose a total ordering on the set of characters according to their Unicode scalar values. | ||
char | |||
Form | (char char1 char2 char3 ...) | ||
Description | Impose a total ordering on the set of characters according to their Unicode scalar values. | ||
procedure? | |||
Form | (procedure? obj) | ||
Description | Returns #t if obj is a procedure, otherwise returns #f. | ||
Returns | #t if obj is a procedure, otherwise returns #f. | ||
Examples | (procedure? car) => #t | ||
(procedure? 'car) => #f | |||
(procedure? (lambda (x) (* x x))) => #t | |||
(procedure? '(lambda (x) (* x x))) => #f | |||
lambda | |||
Form | (lambda [formals] [body]) | ||
Description | A lambda expression evaluates to a procedure. The environment in effect when the lambda expression is evaluated is remembered as part of the procedure. When the procedure is later called with some arguments, the environment in which the lambda expression was evaluated is extended by binding the variables in the parameter list to fresh locations, and the resulting argument values are stored in those locations. Then, the expressions in the body of the lambda expression are evaluated sequentially in the extended environment. The results of the last expression in the body are returned as the results of the procedure call. | ||
Returns | A procedure | ||
quasiquote | |||
Form | (quasiquote [qq template]) | ||
Description | Quasiquote | ||
See also | Quasiquote | quasiquote | |
quote | |||
Form | (quote [datum]) | ||
Description | Evaluates to the datum value represented by [datum]. | ||
Returns | quoted object | ||
if | |||
Form | (if [test] [consequent] [alternate]) (if [test] [consequent]) | ||
Description | An if expression is evaluated as follows: first, [test] is evaluated. If it yields a true value, then [consequent] is evaluated and its values are returned.Otherwise If | ||
string-ref | |||
Form | (string-ref string k) | ||
Description | Returns character k of string using zero-origin indexing. | ||
Precondition | k of string using zero-origin indexing. | ||
Returns | character k of string using zero-origin indexing. | ||
list? | |||
Form | (list? obj) | ||
Description | 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. | ||
Returns | #t if obj is a list, #f otherwise. | ||
Examples | (list? '(a b c)) => #t | ||
(list? '()) => #t | |||
(list? '(a . b)) => #f | |||
let | |||
Form | (let [bindings] [body]) | ||
Description | (let [bindings] [body]) Syntax: [Bindings] must have the form (([variable1] [init1]) ...), where each [init] is an expression. Any variable must not appear more than once in the [variable]s. | ||
Examples | (let ((x 2) (y 3)) (* x y)) => 6 | ||
(let ((x 2) (y 3)) (let ((x 7) (z (+ x y))) (* z x))) => 35 | |||
let* | |||
Form | (let* [bindings] [body]) | ||
Description | (let* [bindings] [body]) Syntax: [Bindings] must have the form (([variable1] [init1]) ...), Semantics: The let* form is similar to let, but the [init]s are evaluated and bindings created sequentially from left to right, with the regionof each binding including the bindings to its right as well as [body]. Thus the second [init] is evaluated in an environment in which the first binding is visible and initialized, and so on. | ||
Examples | (let ((x 2) (y 3)) (let* ((x 7) (z (+ x y))) (* z x))) =>70 | ||
letrec | |||
Form | (letrec [bindings] [body]) | ||
Description | (letrec [bindings] [body]) Syntax: [Bindings] must have the form (([variable1] [init1]) ...), Any variable must not appear more than once in the [variable]s. Semantics: The [variable]s are bound to fresh locations, 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 values of the last expression in are returned.Each binding of a [variable] has the entire letrec expression as its region, making it possible to define mutually recursive procedures. | ||
not | |||
Form | (not obj) | ||
Description | Returns #t if obj is #f, and returns #f otherwise. | ||
Returns | #t if obj is #f, and returns #f otherwise. | ||
Examples | (not #t) => #f | ||
(not 3) => #f | |||
(not (list 3)) => #f | |||
(not #f) => #t | |||
(not '()) => #f | |||
(not (list)) => #f | |||
(not 'nil) => #f | |||
or | |||
Form | (or [test1] ...) | ||
Description | If there are no [test]s, #f is returned. Otherwise, the [test] expressions are evaluated from left to right until a [test] returns a true value val or the last [test] is reached. In the former case, the or expression returns val without evaluating the remaining expressions. In the latter case, the last expression is evaluated and its values are returned. | ||
Examples | (or (= 2 2) (> 2 1)) => #t | ||
(or (= 2 2) (< 2 1)) => #t | |||
(or #f #f #f) => #f | |||
(or '(b c) (/ 3 0)) => (b c) | |||
set! | |||
Form | (set! [variable] [expression]) | ||
Description | [Expression] is evaluated, and the resulting value is stored in the location to which [variable] is bound. [Variable] must be bound either in some regionenclosing the set! expression or at the top level. | ||
Returns | unspecified | ||
symbol? | |||
Form | (symbol? obj) | ||
Description | Returns #t if obj is a symbol, otherwise returns #f. | ||
Returns | #t if obj is a symbol, otherwise returns #f. | ||
vector-length | |||
Form | (vector-length vector) | ||
Description | Returns the number of elements in vector as an exact integer object. | ||
Returns | The number of elements in vector as an exact integer object. | ||
vector-ref | |||
Form | (vector-ref vector k) | ||
Description | Returns the contents of elementk of vector. | ||
Precondition | K must be a valid index of vector. | ||
Returns | The contents of elementk of vector. | ||
Examples | (vector-ref '#(1 1 2 3 5 8 13 21) 5) => 8 | ||
vector-set! | |||
Form | (vector-set! vector k obj) | ||
Description | Stores obj in element k of vector, and returns unspecified values. | ||
Precondition | K must be a valid index of vector. | ||
Returns | unspecified | ||
Examples | (let ((vec (vector 0 '(2 2 2 2) "Anna"))) (vector-set! vec 1 '("Sue" "Sue")) vec) => #(0 ("Sue" "Sue") "Anna") | ||
and | |||
Form | (and [test1] ...) | ||
Description | If there are no [test]s, #t is returned. Otherwise, the [test] expressions are evaluated from left to right until a [test] returns #f or the last [test] is reached. In the former case, the and expression returns #f without evaluating the remaining expressions. In the latter case, the last expression is evaluated and its values are returned. | ||
apply | |||
Form | (apply proc arg1 ... rest-args) | ||
Description | The apply procedure calls proc with the elements of the list (append (list arg1 ...) rest-args) as the actual arguments. | ||
Precondition | Rest-args must be a list. Proc should accept n arguments, where n is number of args plus the length of rest-args. | ||
Returns | The apply procedure calls proc with the elements of the list (append (list arg1 ...) rest-args) as the actual arguments. | ||
begin | |||
Form | (begin [form] ...) (begin [expression] [expression] ...) | ||
Description | The [begin] keyword has two different roles, depending on its context: It may appear as a form in a [body] , [library body] , or [top-level body], or directly nested in a begin form that appears in a body. In this case, the begin form must have the shape specified in the first header line. This use of begin acts as a splicing form the forms inside the [body] are spliced into the surrounding body, as if the begin wrapper were not actually present. A begin form in a [body] or [library body] must be non-empty if it appears after the first [expression] within the body. It may appear as an ordinary expression and must have the shape specified in the second header line. In this case, the [expression]s 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. | ||
call-with-current-continuation | |||
Form | (call-with-current-continuation proc) | ||
Description | The procedure call-with-current-continuation (which is the same as the procedure call/cc) packages the current continuation 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 reinstate the continuation that was in effect when the escape procedure was created. | ||
case | |||
Form | (case [key] [case clause1] [case clause2] ...) | ||
Description | case expression is evaluated as follows. [Key] is evaluated and its result is compared using eqv? against the data represented by the [datum]s of each [case clause] in turn, proceeding in order from left to right through the set of clauses. If the result of evaluating [key] is equivalent to a datum of a [case clause], the corresponding [expression]s are evaluated from left to right and the results of the last expression in the [case clause] are returned as the results of the case expression. Otherwise, the comparison process continues. If the result of evaluating [key] is different from every datum in each set, 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 case expression returns unspecified values. | ||
Examples | (case (* 2 3) ((2 3 5 7) 'prime) ((1 4 6 8 9) 'composite)) => composite | ||
cond | |||
Form | (cond [cond clause1] [cond clause2] ...) | ||
Description | A cond expression is evaluated by evaluating the [test] expressions of successive [cond clause]s in order until one of them evaluates to a true value. When a [test] evaluates to a true value, then the remaining [expression]s in its [cond clause] are evaluated in order, and the results of the last [expression] in the [cond clause] are returned as the results of the entire cond expression. If the selected [cond clause] contains only the [test] and no [expression]s, then the value of the [test] is returned as the result. If the selected [cond clause] uses the => alternate form, then the [expression] is evaluated. Its value must be a procedure. This procedure should accept one argument; it is called on the value of the [test] and the values returned by this procedure are returned by the cond expression. If all [test]s evaluate to #f, and there is no else clause, then the conditional expression returns unspecified values; if there is an else clause, then its [expression]s are evaluated, and the values of the last one are returned. | ||
Examples | (cond ((> 3 2) 'greater) ((< 3 2) 'less)) => greater | ||
(cond ((> 3 3) 'greater) ((< 3 3) 'less) (else 'equal)) => equal | |||
(cond ('(1 2 3) => cadr) (else #f)) => 2 | |||
define | |||
Form | (define [variable] [expression]) (define [variable]) (define ([variable] [formals]) [body]) (define ([variable] . [formal]) [body]) | ||
Description | The define form is used to create variable bindings and may appear anywhere other definitions may appear. | ||
define-macro | |||
Form | (define-macro (name . args) body) | ||
Description | The define-macro form is used to create traditional macro. | ||
* | |||
Form | (* z1 ...) | ||
Description | Returns the product of their arguments. | ||
Returns | The product of their arguments. | ||
+ | |||
Form | (+ z1 ...) | ||
Description | Returns the sum of their arguments. | ||
Returns | The sum of their arguments. | ||
/ | |||
Form | (/ z1 ...) | ||
Description | Returns the division of their arguments. | ||
Returns | The division of their arguments. | ||
mode | |||
Form | (mod z1 z2) | ||
Description | Returns the modulo of their arguments. | ||
Returns | The modulo of their arguments. | ||
- | |||
Form | (- z1 z2 ...) (- z) | ||
Description | With two or more arguments, this procedures returns the difference of its arguments, associating to the left. With one argument, however, it returns the additive inverse of its argument. | ||
Returns | With two or more arguments, this procedures returns the difference of its arguments, associating to the left. With one argument, however, it returns the additive inverse of its argument. | ||
< | |||
Form | (< x1 x2 x3 ...) | ||
Description | Returns #t if its arguments are monotonically increasing and #f otherwise. | ||
Returns | #t if its arguments are monotonically increasing and #f otherwise. | ||
<= | |||
Form | (<= x1 x2 x3 ...) | ||
Description | Returns #t if its arguments are monotonically nondecreasing and #f otherwise. | ||
Returns | #t if its arguments are monotonically nondecreasing and #f otherwise. | ||
= | |||
Form | (= x1 x2 x3 ...) | ||
Description | Returns #t if its arguments are equal and #f otherwise. | ||
Returns | #t if its arguments are equal and #f otherwise. | ||
> | |||
Form | (> x1 x2 x3 ...) | ||
Description | Returns #t if its arguments are monotonically decreasing and #f otherwise. | ||
Returns | #t if its arguments are monotonically decreasing and #f otherwise. | ||
>= | |||
Form | (> x1 x2 x3 ...) | ||
Description | Returns #t if its arguments are monotonically increasing and #f otherwise. | ||
Returns | #t if its arguments are monotonically increasing and #f otherwise. | ||
vector | |||
Form | (vector obj ...) | ||
Description | Returns a newly allocated vector whose elements contain the given arguments. Analogous to list. | ||
Returns | A newly allocated vector whose elements contain the given arguments. Analogous to list. | ||
pair? | |||
Form | (pair? obj) | ||
Description | Returns #t if obj is a pair, and otherwise returns #f. | ||
Returns | #t if obj is a pair, and otherwise returns #f. | ||
values | |||
Form | (values obj ...) | ||
Description | Delivers all of its arguments to its continuation. | ||
Returns | Delivers all of its arguments to its continuation. | ||
See also | Base Library | call-with-values | |
error | |||
Form | (error message) | ||
Description | This error procedure will be replaced with R6RS (error) | ||
Returns | This error procedure will be replaced with R6RS (error) | ||
symbol->string | |||
Form | (symbol->string symbol) | ||
Description | Returns the name of symbol as an immutable string. | ||
Returns | Returns the name of symbol as an immutable string. | ||
boolean? | |||
Form | (boolean? obj) | ||
Description | Returns #t if obj is either #t or #f and returns #f otherwise. | ||
Returns | #t if obj is either #t or #f and returns #f otherwise. | ||
eq? | |||
Form | (eq?) | ||
Description | The eq? predicate is similar to eqv? except that in some cases it is capable of discerning distinctions finer than those detectable by eqv?. The eq? and eqv? predicates are guaranteed to have the same behavior on symbols, booleans, the empty list, pairs, procedures, non-empty strings, bytevectors, and vectors, and records. | ||
Returns | #t if eq? | ||
Examples | (eq? 'a 'a) => #t | ||
(eq? '(a) '(a)) => #f (unspecified on R6RS) | |||
(eq? (list 'a) (list 'a)) => #f | |||
(eq? "a" "a") => #f (unspecified on R6RS) | |||
(eq? "" "") => #f (unspecified on R6RS) | |||
(eq? '() '()) => #t | |||
(eq? 2 2) => #t (unspecified on R6RS) | |||
(eq? #\A #\A) => #t (unspecified on R6RS) | |||
(eq? car car) => #t | |||
(let ((n (+ 2 3))) (eq? n n)) => #t (unspecified on R6RS) | |||
(let ((x '(a))) (eq? x x)) => #t (unspecified on R6RS) | |||
(let ((x '#())) (eq? x x)) => #t (unspecified on R6RS) | |||
(let ((p (lambda (x) x))) (eq? p p)) => #t (unspecified on R6RS) | |||
vector? | |||
Form | (vector? obj) | ||
Description | Returns #t if obj is a vector. Otherwise the procedure returns #f. | ||
Returns | #t if obj is a vector. Otherwise the procedure returns #f. | ||
equal? | |||
Form | (equal? obj1 obj2) | ||
Description | The equal? predicate returns #t if and only if the unfoldings of its arguments into regular trees are equal as ordered trees. | ||
Returns | #t if and only if the unfoldings of its arguments into regular trees are equal as ordered trees. | ||
Examples | (equal? 'a 'a) => #t | ||
(equal? '(a) '(a)) => #t | |||
(equal? '(a (b) c) '(a (b) c)) => #t | |||
(equal? "abc" "abc") => #t | |||
(equal? 2 2) => #t | |||
(equal? (make-vector 5 'a) (make-vector 5 'a)) => #t | |||
char? | |||
Form | (char? obj) | ||
Description | Returns #t if obj is a character, otherwise returns #f. | ||
Returns | #t if obj is a character, otherwise returns #f. | ||
char=? | |||
Form | (char=? char1 char2 char3 ...) | ||
Description | Returns #t if all given charctors are same charctor. | ||
Returns | #t if all given charctors are same charctor. | ||
char->integer | |||
Form | (char->integer char) | ||
Description | Given a character, char->integer returns its Unicode scalar value as an exact integer object. | ||
Returns | Given a character, char->integer returns its Unicode scalar value as an exact integer object. | ||
integer->char | |||
Form | (integer->char sv) | ||
Description | For a Unicode scalar value sv, integer->char returns its associated character. | ||
Returns | For a Unicode scalar value sv, integer->char returns its associated character. | ||
list? | |||
Form | (list? obj) | ||
Description | (not implemented yet) 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. | ||
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. | ||
cons | |||
Form | (cons obj1 obj2) | ||
Description | 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. | ||
Returns | A newly allocated pair whose car is obj1 and whose cdr is obj2. | ||
Examples | (cons 'a '()) => (a) | ||
(cons '(a) '(b c d)) => ((a) b c d) | |||
(cons "a" '(b c)) => ("a" b c) | |||
(cons 'a 3) => (a . 3) | |||
(cons '(a b) 'c) => ((a b) . c) | |||
car | |||
Form | (car pair) | ||
Description | Returns the contents of the car field of pair. | ||
Returns | The contents of the car field of pair. | ||
Examples | (car '(a b c)) => a | ||
(car '((a) b c d)) => (a) | |||
(car '(1 . 2)) => 1 | |||
(car '()) &assertion exception (not implemented yet) | |||
cdr | |||
Form | (cdr pair) | ||
Description | Returns the contents of the cdr field of pair. | ||
Returns | The contents of the cdr field of pair. | ||
Examples | (cdr '((a) b c d)) => (b c d) | ||
(cdr '(1 . 2)) => 2 | |||
(cdr '()) &assertion exception (not implemented yet) | |||
null? | |||
Form | (null? obj) | ||
Description | Returns #t if obj is the empty list, #f otherwise. | ||
Returns | #t if obj is the empty list, #fotherwise. | ||
string=? | |||
Form | (string=? string1 string2 string3 ...) | ||
Description | Returns #t if the strings are the same length and contain the same characters in the same positions. Otherwise, the string=? procedure returns #f.Returns #t if obj is a string, otherwise returns #f. | ||
Returns | Returns #t if the strings are the same length and contain the same characters in the same positions. | ||
make-string | |||
Form | (make-string k &optional char) | ||
Description | 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. | ||
Returns | allocated string of length k. | ||
string | |||
Form | (string char ...) | ||
Description | Returns a newly allocated string composed of the arguments. | ||
Returns | Returns a newly allocated string composed of the arguments. | ||
string? | |||
Form | (string? obj) | ||
Description | Returns #t if obj is a string, otherwise returns #f. | ||
Returns | #t if obj is a string, otherwise returns #f. | ||
string-length | |||
Form | (string-length string) | ||
Description | Returns the number of characters in the given string as an exact integer object. | ||
Returns | the number of characters in the given string as an exact integer object. | ||
string-ref | |||
Form | (string-ref string k) | ||
Description | Character at index k in string | ||
Precondition | K must be a valid index of string. | ||
Returns | character at index k in string | ||
string-set! | |||
Form | (string-set! string k char) | ||
Description | Stores char in element k of string. | ||
Returns | unspecified | ||
string->symbol | |||
Form | (string->symbol string) | ||
Description | Returns the symbol whose name is string. | ||
Examples | (eq? 'JollyWog (string->symbol (symbol->string 'JollyWog))) => #t | ||
string->number | |||
Form | (string->number string) | ||
Description | Returns a number by the given string. | ||
Returns | number | ||
string-append | |||
Form | (string-append string ...) | ||
Description | Returns a newly allocated string whose characters form the concatenation of the given strings. | ||
Returns | A newly allocated string whose characters form the concatenation of the given strings. | ||
string-split | |||
Form | (string-split string splitter) | ||
Description | Splits string by splitter and returns a list of strings. splitter can be a character. | ||
Returns | a list of splitted strings. | ||
number->string | |||
Form | (number->string z) | ||
Description | Takes a number object and returns as a string an external representation of the given number object. | ||
Returns | Takes a number object and returns as a string an external representation of the given number object. | ||
number->string | |||
Form | (number->string z radix) | ||
Description | Takes a number object and a radix and returns as a string an external representation of the given number object in the given radix. | ||
Parameters | radix | must be 16. (2, 8, 10 is not implemented yet) | |
Returns | Takes a number object and a radix and returns as a string an external representation of the given number object in the given radix. | ||
number? | |||
Form | (number? obj) | ||
Description | Return #t if obj is number object and #f otherwise. | ||
Returns | #t if obj is number object and #f otherwise | ||
caar | |||
Form | (caar p) | ||
Description | Returns (car (car p)) | ||
Precondition | p is pair | ||
Returns | (car (car p)) | ||
cdar | |||
Form | (cdar p) | ||
Description | Returns (cdr (car p)) | ||
Precondition | p is pair | ||
Returns | (cdr (car p)) | ||
cadr | |||
Form | (cadr p) | ||
Description | Returns (car (cdr p)) | ||
Precondition | p is pair | ||
Returns | (car (cdr p)) | ||
cddr | |||
Form | (cddr p) | ||
Description | Returns (cdr (cdr p)) | ||
Precondition | p is pair | ||
Returns | (cdr (cdr p)) | ||
caaar | |||
Form | (caaar p) | ||
Description | Returns (car (car (car p))) | ||
Precondition | p is pair | ||
Returns | (car (car (car p))) | ||
cdaar | |||
Form | (cdaar p) | ||
Description | Returns (cdr (car (car p))) | ||
Precondition | p is pair | ||
Returns | (cdr (car (car p))) | ||
cadar | |||
Form | (cadar p) | ||
Description | Returns (car (cdr (car p))) | ||
Precondition | p is pair | ||
Returns | (car (cdr (car p))) | ||
cddar | |||
Form | (cddar p) | ||
Description | Returns (cdr (cdr (car p))) | ||
Precondition | p is pair | ||
Returns | (cdr (cdr (car p))) | ||
caadr | |||
Form | (caadr p) | ||
Description | Returns (car (car (cdr p))) | ||
Precondition | p is pair | ||
Returns | (car (car (cdr p))) | ||
cdadr | |||
Form | (cdadr p) | ||
Description | Returns (cdr (car (cdr p))) | ||
Precondition | p is pair | ||
Returns | (cdr (car (cdr p))) | ||
caddr | |||
Form | (caddr p) | ||
Description | Returns (car (cdr (cdr p))) | ||
Precondition | p is pair | ||
Returns | (car (cdr (cdr p))) | ||
cdddr | |||
Form | (cdddr p) | ||
Description | Returns (cdr (cdr (cdr p))) | ||
Precondition | p is pair | ||
Returns | (cdr (cdr (cdr p))) | ||
caaaar | |||
Form | (caaaar p) | ||
Description | Returns (car (car (car (car p)))) | ||
Precondition | p is pair | ||
Returns | (car (car (car (car p)))) | ||
cdaaar | |||
Form | (cdaaar p) | ||
Description | Returns (cdr (car (car (car p)))) | ||
Precondition | p is pair | ||
Returns | (cdr (car (car (car p)))) | ||
cadaar | |||
Form | (cadaar p) | ||
Description | Returns (car (cdr (car (car p)))) | ||
Precondition | p is pair | ||
Returns | (car (cdr (car (car p)))) | ||
cddaar | |||
Form | (cddaar p) | ||
Description | Returns (cdr (cdr (car (car p)))) | ||
Precondition | p is pair | ||
Returns | (cdr (cdr (car (car p)))) | ||
caadar | |||
Form | (caadar p) | ||
Description | Returns (car (car (cdr (car p)))) | ||
Precondition | p is pair | ||
Returns | (car (car (cdr (car p)))) | ||
cdadar | |||
Form | (cdadar p) | ||
Description | Returns (cdr (car (cdr (car p)))) | ||
Precondition | p is pair | ||
Returns | (cdr (car (cdr (car p)))) | ||
caddar | |||
Form | (caddar p) | ||
Description | Returns (car (cdr (cdr (car p)))) | ||
Precondition | p is pair | ||
Returns | (car (cdr (cdr (car p)))) | ||
cdddar | |||
Form | (cdddar p) | ||
Description | Returns (cdr (cdr (cdr (car p)))) | ||
Precondition | p is pair | ||
Returns | (cdr (cdr (cdr (car p)))) | ||
caaadr | |||
Form | (caaadr p) | ||
Description | Returns (car (car (car (cdr p)))) | ||
Precondition | p is pair | ||
Returns | (car (car (car (cdr p)))) | ||
cdaadr | |||
Form | (cdaadr p) | ||
Description | Returns (cdr (car (car (cdr p)))) | ||
Precondition | p is pair | ||
Returns | (cdr (car (car (cdr p)))) | ||
cadadr | |||
Form | (cadadr p) | ||
Description | Returns (car (cdr (car (cdr p)))) | ||
Precondition | p is pair | ||
Returns | (car (cdr (car (cdr p)))) | ||
cddadr | |||
Form | (cddadr p) | ||
Description | Returns (cdr (cdr (car (cdr p)))) | ||
Precondition | p is pair | ||
Returns | (cdr (cdr (car (cdr p)))) | ||
caaddr | |||
Form | (caaddr p) | ||
Description | Returns (car (car (cdr (cdr p)))) | ||
Precondition | p is pair | ||
Returns | (car (car (cdr (cdr p)))) | ||
cdaddr | |||
Form | (cdaddr p) | ||
Description | Returns (cdr (car (cdr (cdr p)))) | ||
Precondition | p is pair | ||
Returns | (cdr (car (cdr (cdr p)))) | ||
cadddr | |||
Form | (cadddr p) | ||
Description | Returns (car (cdr (cdr (cdr p)))) | ||
Precondition | p is pair | ||
Returns | (car (cdr (cdr (cdr p)))) | ||
cddddr | |||
Form | (cddddr p) | ||
Description | Returns (cdr (cdr (cdr (cdr p)))) | ||
Precondition | p is pair | ||
Returns | (cdr (cdr (cdr (cdr p)))) | ||
caaaaar | |||
Form | (caaaaar p) | ||
Description | Returns (car (car (car (car (car p))))) | ||
Precondition | p is pair | ||
Returns | (car (car (car (car (car p))))) | ||
cdaaaar | |||
Form | (cdaaaar p) | ||
Description | Returns (cdr (car (car (car (car p))))) | ||
Precondition | p is pair | ||
Returns | (cdr (car (car (car (car p))))) | ||
cadaaar | |||
Form | (cadaaar p) | ||
Description | Returns (car (cdr (car (car (car p))))) | ||
Precondition | p is pair | ||
Returns | (car (cdr (car (car (car p))))) | ||
cddaaar | |||
Form | (cddaaar p) | ||
Description | Returns (cdr (cdr (car (car (car p))))) | ||
Precondition | p is pair | ||
Returns | (cdr (cdr (car (car (car p))))) | ||
caadaar | |||
Form | (caadaar p) | ||
Description | Returns (car (car (cdr (car (car p))))) | ||
Precondition | p is pair | ||
Returns | (car (car (cdr (car (car p))))) | ||
cdadaar | |||
Form | (cdadaar p) | ||
Description | Returns (cdr (car (cdr (car (car p))))) | ||
Precondition | p is pair | ||
Returns | (cdr (car (cdr (car (car p))))) | ||
caddaar | |||
Form | (caddaar p) | ||
Description | Returns (car (cdr (cdr (car (car p))))) | ||
Precondition | p is pair | ||
Returns | (car (cdr (cdr (car (car p))))) | ||
cdddaar | |||
Form | (cdddaar p) | ||
Description | Returns (cdr (cdr (cdr (car (car p))))) | ||
Precondition | p is pair | ||
Returns | (cdr (cdr (cdr (car (car p))))) | ||
caaadar | |||
Form | (caaadar p) | ||
Description | Returns (car (car (car (cdr (car p))))) | ||
Precondition | p is pair | ||
Returns | (car (car (car (cdr (car p))))) | ||
cdaadar | |||
Form | (cdaadar p) | ||
Description | Returns (cdr (car (car (cdr (car p))))) | ||
Precondition | p is pair | ||
Returns | (cdr (car (car (cdr (car p))))) | ||
cadadar | |||
Form | (cadadar p) | ||
Description | Returns (car (cdr (car (cdr (car p))))) | ||
Precondition | p is pair | ||
Returns | (car (cdr (car (cdr (car p))))) | ||
cddadar | |||
Form | (cddadar p) | ||
Description | Returns (cdr (cdr (car (cdr (car p))))) | ||
Precondition | p is pair | ||
Returns | (cdr (cdr (car (cdr (car p))))) | ||
caaddar | |||
Form | (caaddar p) | ||
Description | Returns (car (car (cdr (cdr (car p))))) | ||
Precondition | p is pair | ||
Returns | (car (car (cdr (cdr (car p))))) | ||
cdaddar | |||
Form | (cdaddar p) | ||
Description | Returns (cdr (car (cdr (cdr (car p))))) | ||
Precondition | p is pair | ||
Returns | (cdr (car (cdr (cdr (car p))))) | ||
cadddar | |||
Form | (cadddar p) | ||
Description | Returns (car (cdr (cdr (cdr (car p))))) | ||
Precondition | p is pair | ||
Returns | (car (cdr (cdr (cdr (car p))))) | ||
cddddar | |||
Form | (cddddar p) | ||
Description | Returns (cdr (cdr (cdr (cdr (car p))))) | ||
Precondition | p is pair | ||
Returns | (cdr (cdr (cdr (cdr (car p))))) | ||
caaaadr | |||
Form | (caaaadr p) | ||
Description | Returns (car (car (car (car (cdr p))))) | ||
Precondition | p is pair | ||
Returns | (car (car (car (car (cdr p))))) | ||
cdaaadr | |||
Form | (cdaaadr p) | ||
Description | Returns (cdr (car (car (car (cdr p))))) | ||
Precondition | p is pair | ||
Returns | (cdr (car (car (car (cdr p))))) | ||
cadaadr | |||
Form | (cadaadr p) | ||
Description | Returns (car (cdr (car (car (cdr p))))) | ||
Precondition | p is pair | ||
Returns | (car (cdr (car (car (cdr p))))) | ||
cddaadr | |||
Form | (cddaadr p) | ||
Description | Returns (cdr (cdr (car (car (cdr p))))) | ||
Precondition | p is pair | ||
Returns | (cdr (cdr (car (car (cdr p))))) | ||
caadadr | |||
Form | (caadadr p) | ||
Description | Returns (car (car (cdr (car (cdr p))))) | ||
Precondition | p is pair | ||
Returns | (car (car (cdr (car (cdr p))))) | ||
cdadadr | |||
Form | (cdadadr p) | ||
Description | Returns (cdr (car (cdr (car (cdr p))))) | ||
Precondition | p is pair | ||
Returns | (cdr (car (cdr (car (cdr p))))) | ||
caddadr | |||
Form | (caddadr p) | ||
Description | Returns (car (cdr (cdr (car (cdr p))))) | ||
Precondition | p is pair | ||
Returns | (car (cdr (cdr (car (cdr p))))) | ||
cdddadr | |||
Form | (cdddadr p) | ||
Description | Returns (cdr (cdr (cdr (car (cdr p))))) | ||
Precondition | p is pair | ||
Returns | (cdr (cdr (cdr (car (cdr p))))) | ||
caaaddr | |||
Form | (caaaddr p) | ||
Description | Returns (car (car (car (cdr (cdr p))))) | ||
Precondition | p is pair | ||
Returns | (car (car (car (cdr (cdr p))))) | ||
cdaaddr | |||
Form | (cdaaddr p) | ||
Description | Returns (cdr (car (car (cdr (cdr p))))) | ||
Precondition | p is pair | ||
Returns | (cdr (car (car (cdr (cdr p))))) | ||
cadaddr | |||
Form | (cadaddr p) | ||
Description | Returns (car (cdr (car (cdr (cdr p))))) | ||
Precondition | p is pair | ||
Returns | (car (cdr (car (cdr (cdr p))))) | ||
cddaddr | |||
Form | (cddaddr p) | ||
Description | Returns (cdr (cdr (car (cdr (cdr p))))) | ||
Precondition | p is pair | ||
Returns | (cdr (cdr (car (cdr (cdr p))))) | ||
caadddr | |||
Form | (caadddr p) | ||
Description | Returns (car (car (cdr (cdr (cdr p))))) | ||
Precondition | p is pair | ||
Returns | (car (car (cdr (cdr (cdr p))))) | ||
cdadddr | |||
Form | (cdadddr p) | ||
Description | Returns (cdr (car (cdr (cdr (cdr p))))) | ||
Precondition | p is pair | ||
Returns | (cdr (car (cdr (cdr (cdr p))))) | ||
caddddr | |||
Form | (caddddr p) | ||
Description | Returns (car (cdr (cdr (cdr (cdr p))))) | ||
Precondition | p is pair | ||
Returns | (car (cdr (cdr (cdr (cdr p))))) | ||
cdddddr | |||
Form | (cdddddr p) | ||
Description | Returns (cdr (cdr (cdr (cdr (cdr p))))) | ||
Precondition | p is pair | ||
Returns | (cdr (cdr (cdr (cdr (cdr p))))) | ||
even? | |||
Form | (even? x) | ||
Description | Returns whether x is even. | ||
Returns | whether x is even | ||
call-with-values | |||
Form | (call-with-values producer consumer) | ||
Description | Calls producer 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. (define (call-with-values producer consumer) (apply consumer (producer))) | ||
Parameters | producer | must be a procedure and should accept zero arguments | |
consumer | must be a procedure and should accept as many values as producer returns | ||
Returns | result of consumer | ||
See also | SRFI-8 Binding to multiple values. | receive | |
list-tail | |||
Form | (list-tail l k) | ||
Description | Returns the subchain of pairs of list obtained by omitting the first k elements | ||
Precondition | l should be a list of size at least k. | ||
Returns | the subchain of pairs of list obtained by omitting the first k elements | ||
Examples | (list-tail '(a b c d) 2) => (c d) | ||
list-ref | |||
Form | (list-ref l k) | ||
Description | Returns the kth element of list. | ||
Precondition | l must be a list whose length is at least k + 1. | ||
Returns | returns the kth element of list. | ||
Examples | (list-ref '(a b c d) 2) => c | ||
vector->list | |||
Form | (vector->list v) | ||
Description | Returns a newly allocated list of the objects contained in the elements of vector | ||
Returns | returns a newly allocated list of the objects contained in the elements of vector | ||
Examples | (vector->list '#(dah dah didah)) => (dah dah didah) | ||
zero? | |||
Form | (zero? n) | ||
Description | Tests if the number object is = to zero | ||
Returns | #t is (= n 0) | ||
list | |||
Form | (list obj ...) | ||
Description | Returns a newly allocated list of its arguments. | ||
Returns | a newly allocated list of its arguments. | ||
Examples | (list 'a (+ 3 4) 'c) => (a 7 c) | ||
(list) => () | |||
abs | |||
Form | (abs n) | ||
Description | Returns the absolute value of its argument. | ||
Returns | Returns the absolute value of its argument. | ||
Examples | (abs -7) => 7 | ||
map | |||
Form | (map proc list1 list2 ...) | ||
Description | The map procedure applies proc element-wise to the elements of the lists and returns a list of the results, in order. | ||
Parameters | ll | should all have the same length. | |
proc | should accept as many arguments as there are lists and return a single value. should not mutate any of the lists. | ||
Returns | a list of the results | ||
Examples | (map cadr '((a b) (d e) (g h))) => (b e h) | ||
(map (lambda (n) (expt n n)) '(1 2 3 4 5)) => (1 4 27 256 3125) | |||
(map + '(1 2 3) '(4 5 6)) => (5 7 9) | |||
length | |||
Form | (length l) | ||
Description | Returns the length of list. (length '(a b c)) => 3 (length '(a (b) (c d e))) => 3 (length '()) => 0 | ||
Returns | the length of list. | ||
reverse | |||
Form | (reverse l) | ||
Description | Returns a newly allocated list consisting of the elements of list in reverse order. | ||
Returns | a newly allocated list consisting of the elements of list in reverse order. | ||
Examples | (reverse '(a b c)) => (c b a) | ||
(reverse '(a (b c) d (e (f)))) => ((e (f)) d (b c) a) | |||
list->string | |||
Form | (list->string l) | ||
Description | The list->string procedure returns a newly allocated string formed from the characters in list. | ||
Returns | The list->string procedure returns a newly allocated string formed from the characters in list. | ||
for-each | |||
Form | (for-each proc list1 list2 ...) | ||
Description | The for-each procedure applies proc element-wise to the elements of the lists for its side effects, in order from the first elements to the last. | ||
Precondition | The lists should all have the same length. Proc should accept as many arguments as there are lists. Proc should not mutate any of the lists. | ||
Returns | The return values of for-each are unspecified. | ||
Examples | (let ((v (make-vector 5))) (for-each (lambda (i) (vector-set! v i (* i i))) '(0 1 2 3 4)) v) => #(0 1 4 9 16) | ||
(for-each (lambda (x) x) '(1 2 3 4)) => unspecified | |||
(for-each even? ’()) => unspecified | |||
list->vector | |||
Form | (list->vector l) | ||
Description | The list->vector procedure returns a newly created vector initialized to the elements of the list list. | ||
Returns | The list->vector procedure returns a newly created vector initialized to the elements of the list list. | ||
Examples | (list->vector '(dididit dah)) => #(dididit dah) | ||
append | |||
Form | (append list ... obj) | ||
Description | Returns a possibly improper list 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. | ||
Returns | Returns a possibly improper list 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. | ||
Postcondition | If append constructs a nonempty chain of pairs, it is always newly allocated. If no pairs are allocated, obj is returned. | ||
Examples | (append '(x) '(y)) => (x y) | ||
(append '(a) '(b c d)) => (a b c d) | |||
(append '(a (b)) '((c))) => (a (b) (c)) | |||
(append '(a b) '(c . d)) => (a b c . d) | |||
(append '() 'a) => a | |||
vector-for-each | |||
Form | (vector-for-each proc vector1 vector2 ...) | ||
Description | Applies proc element-wise to the elements of the vectors for its side effects, in order from the first elements to the last. Proc is always called in the same dynamic environment as vector-for-each itself.(todo vector2 ...) | ||
Precondition | The vectors must all have the same length. Proc should accept as many arguments as there are vectors. | ||
Returns | unspecified. | ||
vector-map | |||
Form | (vector-map proc vector1 vector2 ...) | ||
Description | Applies proc element-wise to the elements of the vectors and returns a vector of the results, in order. | ||
Precondition | The vectors must all have the same length. Proc should accept as many arguments as there are vectors and return a single value. | ||
Returns | a vectors | ||
2 Bytevectors. | |||
R6RS library Chapter 2. | |||
bytevector-u8-set! | |||
Form | (bytevector-u8-set! bytevector k octet) | ||
Description | Stores octet in element k of bytevector. | ||
Precondition | K must be a valid index of bytevector. | ||
Returns | unspecified | ||
bytevector-length | |||
Form | (bytevector-length bytevector) | ||
Description | Returns, as an exact integer object, the number of bytes in bytevector. | ||
Returns | As an exact integer object, the number of bytes in bytevector. | ||
bytevector-u8-ref | |||
Form | (bytevector-u8-ref bytevector k) | ||
Description | Returns the byte at index k of bytevector, as an octet. | ||
Precondition | K must be a valid index of bytevector. | ||
Returns | the byte at index k of bytevector, as an octet. | ||
utf8->string | |||
Form | (utf8->string bytevector) | ||
Description | Returns a newly allocated (unless empty) string whose character sequence is encoded by the given bytevector. | ||
Returns | A newly allocated (unless empty) string whose character sequence is encoded by the given bytevector. | ||
3 List utilities. | |||
R6RS library Chapter 3. | |||
memq | |||
Form | (memq obj list) | ||
Description | Return the first sublist of list whose car satisfies a given condition with eq?, where the sublists of lists are the lists returned by (list-tail list k) for k less than the length of list. | ||
Precondition | Proc should accept one argument and return a single value. Proc should not mutate list. | ||
Returns | The first sublist of list whose car satisfies a given condition, where the sublists of lists are the lists returned by (list-tail list k) for k less than the length of list. | ||
fold-left | |||
Form | (fold-left combine nil list1 list2 ...listn) | ||
Description | The fold-left procedure iterates the combine procedure over an accumulator value and the elements of the lists from left to right, starting with an accumulator value of nil. More specifically, fold-left returns nil if the lists are empty. If they are not empty, combine is first applied to nil and the respective first elements of the lists in order. The result becomes the new accumulator value, and combine is applied to the new accumulator value and the respective next elements of the list. This step is repeated until the end of the list is reached; then the accumulator value is returned. Combine is always called in the same dynamic environment as fold-left itself. from Iron Scheme | ||
Precondition | The lists should all have the same length. Combine must be a procedure. It should accept one more argument than there are lists and return a single value. It should not mutate the list arguments. | ||
Returns | accumlated pair | ||
Examples | (fold-left + 0 '(1 2 3 4 5)) => 15 | ||
(fold-left (lambda (a e) (cons e a)) '() '(1 2 3 4 5)) => (5 4 3 2 1) | |||
(fold-left (lambda (count x) (if (odd? x) (+ count 1) count)) 0 '(3 1 4 1 5 9 2 6 5 3)) => 7 | |||
(fold-left (lambda (max-len s) (max max-len (string-length s))) 0 '("longest" "long" "longer")) => 7 | |||
(fold-left + 0 '(1 2 3) '(4 5 6)) => 21 | |||
(fold-left cons '(q) '(a b c)) => ((((q) . a) . b) . c) | |||
remp | |||
Form | (remp proc l) | ||
Description | The remp procedure applies proc to each element of list and returns a list of the elements of list for which proc returned #f. (define (remp pred l) (filter (lambda (a) (not (pred a))) l)) | ||
Precondition | Proc should accept one argument and return a single value. Proc should not mutate list. | ||
Returns | The remp procedure applies proc to each element of list and returns a list of the elements of list for which proc returned #f. | ||
Examples | (remp even? '(3 1 4 1 5 9 2 6 5)) => (3 1 1 5 9 5) | ||
filter | |||
Form | (filter proc list) | ||
Description | The filter procedure applies proc to each element of list and returns a list of the elements of list for which proc returned a true value. The elements of the result list(s) are in the same order as they appear in the input list. | ||
Parameters | proc | Proc should accept one argument and return a single value. Proc should not mutate list. | |
Returns | returns a list of the elements of list for which proc returned a true value. | ||
Examples | (filter even? '(3 1 4 1 5 9 2 6)) => (4 2 6) | ||
find | |||
Form | (find pred lst) | ||
Description | The find procedure applies proc to the elements of list in order. If proc returns a true value for an element, find immediately returns that element. If proc returns #f for all elements of the list, find returns #f. | ||
Precondition | Proc should accept one argument and return a single value. Proc should not mutate list. | ||
Returns | The find procedure applies proc to the elements of list in order. If proc returns a true value for an element, find immediately returns that element. If proc returns #f for all elements of the list, find returns #f. | ||
Examples | (find even? '(3 1 4 1 5 9)) => 4 | ||
(find even? '(3 1 5 1 5 9)) => #f | |||
assv | |||
Form | (assv obj alist) | ||
Description | Find the first pair in alist whose car field satisfies a given condition, and returns that pair without traversing alist further. If no pair in alist satisfies the condition, then #f is returned. The assoc procedure uses equal? to compare obj with the car fields of the pairs in alist, while assv uses eqv? and assq uses eq?. | ||
Precondition | Alist (for "association list") should be a list of pairs. Proc should accept one argument and return a single value. Proc should not mutate alist. | ||
Examples | (assv 5 '((2 3) (5 7) (11 13))) => (5 7) | ||
assoc | |||
Form | (assoc obj alist) | ||
Description | Find the first pair in alist whose car field satisfies a given condition, and returns that pair without traversing alist further. If no pair in alist satisfies the condition, then #f is returned. The assoc procedure uses equal? to compare obj with the car fields of the pairs in alist, while assv uses eqv? and assq uses eq?. | ||
Precondition | Alist (for "association list") should be a list of pairs. Proc should accept one argument and return a single value. Proc should not mutate alist. | ||
Examples | (assoc (list 'a) '(((a)) ((b)) ((c)))) => ((a)) | ||
4 Control structures. | |||
R6RS library Chapter 5. | |||
do | |||
Form | (do (([variable1] [init1] [step1]) ...) ([test] [expression] ...) [command] ...) | ||
Description | 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 #f, then the [command]s are evaluated in order for effect, the [step] expressions are evaluated in some unspecified order, the [variable]s are bound to fresh locations holding the results, and the next iteration begins. If [test] evaluates to a true value, the [expression]s are evaluated from left to right and the values of the last [expression] are returned. If no [expression]s are present, then the do expression returns unspecified values. The regionof the binding of a [variable] consists of the entire do expression except for the [init]s. 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]). | ||
Examples | (do ((vec (make-vector 5)) (i 0 (+ i 1))) ((= i 5) vec) (vector-set! vec i i)) => #(0 1 2 3 4) | ||
(let ((x '(1 3 5 7 9))) (do ((x x (cdr x)) (sum 0 (+ sum (car x)))) ((null? x) sum))) | |||
unless | |||
Form | (unless test body ...) | ||
Description | Evaluates test. If it yields false value, body … are evaluated sequentially, and the result(s) of the last evaluation is(are) returned. Otherwise, unspecified value is returned. | ||
when | |||
Form | (when test body ...) | ||
Description | Evaluates test. If it yields true value, body … are evaluated sequentially, and the result(s) of the last evaluation is(are) returned. Otherwise, unspecified value is returned. | ||
5 Exceptions and conditionsI/O. | |||
R6RS library Chapter 7. | |||
with-input-from-file | |||
Form | (with-input-from-file filename thunk) | ||
Description | |||
Precondition | Thunk must be a procedure and must accept zero arguments. The file is opened for input or output using empty file options, and thunk is called with no arguments. | ||
raise | |||
Form | (raise obj) | ||
Description | Raises a non-continuable exception by invoking the current exception handler on obj. | ||
with-exception-handler | |||
Form | (with-exception-handler handler thunk) | ||
Description | Returns the results of invoking thunk. Handler is installed as the current exception handler for the dynamic extent (as determined by dynamic-wind) of the invocation of thunk. | ||
Precondition | Handler must be a procedure and should accept one argument. Thunk must be a procedure that accepts zero arguments. | ||
Returns | the results of invoking thunk. | ||
guard | |||
Form | (guard ([variable] [cond clause1] [cond clause2] ...) | ||
Description | (guard ([variable] syntax [cond clause1] [cond clause2] ...) [body]) => auxiliary syntax else auxiliary syntax Semantics: Evaluating a guard form evaluates [body] with an exception handler that binds the raised object 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 is re-invoked on the raised object within the dynamic environment of the original call to raise except that the current exception handler is that of the guard expression. | ||
raise-continuable | |||
Form | (raise-continuable obj) | ||
Description | Raises a continuable exception by invoking the current exception handler on obj. The handler is called with a continuation that is equivalent to the continuation of the call to raise-continuable, with these two exceptions: (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. | ||
6 I/O. | |||
R6RS library Chapter 8. | |||
read | |||
Form | (read) (read textual-input-port) | ||
Description | Reads an external representation from textual-input-port and returns the datum it represents. | ||
Returns | datum | ||
open-file-output-port | |||
Form | (open-file-output-port filename) | ||
Description | Returns an output port for the named file. | ||
Returns | An output port for the named file. | ||
open-file-input-port | |||
Form | (open-file-input-port filename) | ||
Description | Returns an input port for the named file. | ||
Returns | An input port for the named file. | ||
close-input-port | |||
Form | (close-input-port input-port) | ||
Description | Closes input-port or output-port, respectively. | ||
Returns | unspecified | ||
standard-input-port | |||
Form | (standard-input-port) | ||
Description | Returns a fresh binary input port connected to standard input. Whether the port supports the port-position and set-port-position! operations is implementation-dependent. | ||
Returns | A fresh binary input port connected to standard input. Whether the port supports the port-position and set-port-position! operations is implementation-dependent. | ||
get-bytevector-n | |||
Form | (get-bytevector-n binary-input-port count) | ||
Description | Reads from binary-input-port, blocking as necessary, until count bytes are available from binary-input-port or until an end of file is reached. If count bytes are available before an end of file, get-bytevector-n returns a bytevector of size count. If fewer bytes are available before an end of file, get-bytevector-n returns a bytevector containing those bytes. In either case, the input port is updated to point just past the bytes read. If an end of file is reached before any bytes are available, get-bytevector-n returns the end-of-file object. | ||
Precondition | Count must be an exact, non-negative integer object representing the number of bytes to be read. | ||
Returns | bytevector | ||
eof-object | |||
Form | (eof-object) | ||
Description | Returns the end-of-file object. | ||
Returns | the end-of-file object. | ||
transcoded-port | |||
Form | (transcoded-port binary-port transcoder) | ||
Description | Returns a new textual port with the specified transcoder. Otherwise the new textual port's state is largely the same as that of binary-port. If binary-port is an input port, the new textual port will be an input port and will transcode the bytes that have not yet been read from binary-port. If binary-port is an output port, the new textual port will be an output port and will transcode output characters into bytes that are written to the byte sink represented by binary-port. | ||
Returns | A new textual port with the specified transcoder. | ||
utf-8-codec | |||
Form | (utf-8-codec) | ||
Description | Predefined codecs for the UTF-8 encoding schemes. | ||
Returns | Predefined codecs for the UTF-8 encoding schemes. | ||
make-transcoder | |||
Form | (make-transcoder codec) | ||
Description | Returns transcoder with the behavior specified by its arguments. | ||
Returns | transcoder with the behavior specified by its arguments. | ||
get-u8 | |||
Form | (get-u8 binary-input-port) | ||
Description | Reads from binary-input-port, blocking as necessary, until a byte is available from binary-input-port or until an end of file is reached. If a byte becomes available, get-u8 returns the byte as an octet and updates binary-input-port to point just past that byte. If no input byte is seen before an end of file is reached, the end-of-file object is returned. | ||
Returns | a byte | ||
make-custom-binary-input-port | |||
Form | (make-custom-binary-input-port id read! procedure get-position set-position! close) | ||
Description | Note. This procedure is not implementednot all specification. Returns a newly created binary input port whose byte source is an arbitrary algorithm represented by the read! procedure. Id must be a string naming the new port, provided for informational purposes only. Read! must be a procedure and should behave as specified below; it will be called by operations that perform binary input. Each of the remaining arguments may be #f; if any of those arguments is not #f, it must be a procedure and should behave as specified below. (read! bytevector start count) Start will be a non-negative exact integer object, count will be a positive exact integer object, and bytevector will be a bytevector whose length is at least start + count. The read! procedure should obtain up to count bytes from the byte source, and should write those bytes into bytevector starting at index start. The read! procedure should return an exact integer object. This integer object should represent the number of bytes that it has read. To indicate an end of file, the read! procedure should write no bytes and return 0. (get-position) The get-position procedure (if supplied) should return an exact integer object representing the current position of the input port. If not supplied, the custom port will not support the port-position operation. (set-position! pos) Pos will be a non-negative exact integer object. The set-position! procedure (if supplied) should set the position of the input port to pos. If not supplied, the custom port will not support the set-port-position! operation. (close) The close procedure (if supplied) should perform any actions that are necessary when the input port is closed. | ||
Returns | A newly created binary input port whose byte source is an arbitrary algorithm represented by the read! procedure. | ||
current-error-port | |||
Form | (current-error-port) | ||
Description | Returns default textual ports for regular error output. Normally, this port is associated with standard error. | ||
Returns | Default textual ports for regular error output. Normally, this port is associated with standard error. | ||
write | |||
Form | (write obj &optional textual-output-port) | ||
Description | Writes the external representation of obj to textual-output-port. The write procedure operates in the same way as put-datum. If textual-output-port is omitted, it defaults to the value returned by current-output-port. | ||
Returns | unspecified | ||
eof-object? | |||
Form | (eof-object? obj) | ||
Description | Returns #t if obj is the end-of-file object, #f otherwise. | ||
Returns | #t if obj is the end-of-file object, #f otherwise. | ||
read-char | |||
Form | (read-char &optional textual-input-port) | ||
Description | Reads from textual-input-port, blocking as necessary until a character is available from textual-input-port, or the data that are available cannot be the prefix of any valid encoding, or an end of file is reached. If a complete character is available before the next end of file, read-char returns that character, and updates the input port to point past that character. If an end of file is reached before any data are read, read-char returns the end-of-file object. If textual-input-port is omitted, it defaults to the value returned by current-input-port. | ||
Returns | character | ||
open-string-input-port | |||
Form | (open-string-input-port string) | ||
Description | Returns a textual input port whose characters are drawn from string. | ||
Returns | A textual input port whose characters are drawn from string. | ||
set-current-input-port! | |||
Form | (set-current-input-port!) | ||
Description | Used internal | ||
set-current-output-port! | |||
Form | (set-current-output-port!) | ||
Description | Used internal | ||
open-output-file | |||
Form | (open-output-file filename) | ||
Description | Opens filename for output, with empty file options, and returns the obtained port. | ||
Returns | Opens filename for output, with empty file options, and returns the obtained port. | ||
current-input-port | |||
Form | (current-input-port) | ||
Description | Returns a default textual port for input. Normally, this default port is associated with standard input, but can be dynamically re-assigned using the with-input-from-file procedure | ||
Returns | A default textual port for input. Normally, this default port is associated with standard input, but can be dynamically re-assigned using the with-input-from-file procedure | ||
current-output-port | |||
Form | (current-output-port) | ||
Description | Returns a default textual port for output. Normally, this default port is associated with standard output, but can be dynamically re-assigned using the with-output-from-file procedure | ||
Returns | A default textual port for output. Normally, this default port is associated with standard output, but can be dynamically re-assigned using the with-output-from-file procedure | ||
close-output-port | |||
Form | (close-output-port output-port) | ||
Description | Closes output-port. | ||
Returns | unspecified | ||
call-with-output-file | |||
Form | (call-with-output-file filename proc) | ||
Description | Open the file named by filename for output, with no specified file options, and call proc with the obtained port as an argument. If proc returns, the port is closed automatically and the values returned by proc are returned. If proc does not return, the port is not closed automatically, unless it is possible to prove that the port will never again be used for an I/O operation. | ||
Precondition | Proc should accept one argument. | ||
Returns | the values returned by proc. | ||
call-with-input-file | |||
Form | (call-with-input-file filename proc) | ||
Description | Open the file named by filename for input, with no specified file options, and call proc with the obtained port as an argument. If proc returns, the port is closed automatically and the values returned by proc are returned. If proc does not return, the port is not closed automatically, unless it is possible to prove that the port will never again be used for an I/O operation. | ||
Precondition | Proc should accept one argument. | ||
Returns | the values returned by proc. | ||
open-string-output-port | |||
Form | (open-string-output-port) | ||
Description | Returns two values: a textual output port and an extraction procedure. The output port accumulates the characters written to it for later extraction by the procedure. The extraction procedure takes no arguments. When called, it returns a string consisting of all of the port's accumulated characters (regardless of the current position),removes the accumulated characters from the port, and resetsthe port's position | ||
Returns | string-output-port, extraction procedure | ||
call-with-string-output-port | |||
Form | (call-with-string-output-port proc) | ||
Description | Creates a textual output port that accumulates the characters written to it and calls proc with that output port as an argument. Whenever proc returns, a string consisting of all of the port's accumulated characters (regardless of the port's current position) is returned and the port is closed. | ||
Parameters | proc | proc must accept one argument | |
Returns | accumulated characters as string | ||
call-with-bytevector-output-port | |||
Form | (call-with-bytevector-output-port proc transcoder) | ||
Description | Creates an output port that accumulates the bytes written to it and calls proc with that output port as an argument. Whenever proc returns, a bytevector consisting of all of the port's accumulated bytes (regardless of the port’s currentposition) is returned and the port is closed. | ||
Parameters | proc | proc must accept one argument | |
Returns | accumulated bytes as bytevector | ||
open-bytevector-output-port | |||
Form | (open-bytevector-output-port transcoder) | ||
Description | Returns two values: an output port and an extraction procedure. The output port accumulates the bytes written to it for later extraction by the procedure. If transcoder is a transcoder, it becomes the transcoder associated with the port. If maybe-transcoder is #f or absent, the port will be a binary port and will support the port-position and set-port-position! operations. The extraction procedure takes no arguments. When called, it returns a bytevector consisting of all the port's accumulated bytes (regardless of the port’s current position), removes the accumulated bytes from the port, and resets the port's position. | ||
Parameters | transcoder | transcoder | |
Returns | bytevector-output-port and extraction procedure | ||
bytevector-for-each | |||
Form | (bytevector-for-each bv proc) | ||
Description | Applies proc element-wise to the elements of the bytevector for its side effects, in order from the first elements to the last. | ||
Parameters | bv | bytevector | |
proc | proc must accept one argument | ||
Returns | unspecified | ||
display | |||
Form | (display obj) or (display obj textual-output-port) | ||
Description | Writes a representation of obj to the given textual-output-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. The textual-output-port argument may be omitted, in which case it defaults to the value returned by current-output-port. | ||
Parameters | obj | object to write. | |
textual-output-port | writes obj to textual-output-port | ||
Returns | unspecified | ||
newline | |||
Form | (newline . p) | ||
Description | This is equivalent to using write-char to write #\linefeed to textual-output-port. If textual-output-port is omitted, it defaults to the value returned by current-output-port. | ||
Parameters | textual-output-port | port to write | |
Returns | unspecified | ||
7 File system. | |||
R6RS library Chapter 9. | |||
file-exists? | |||
Form | (file-exists? filename) | ||
Description | Returns #t if the named file exists at the time the procedure is called, #f otherwise. | ||
Returns | Returns #t if the named file exists at the time the procedure is called, #f otherwise. | ||
8 Hashtables. | |||
R6RS library Chapter 13. | |||
make-eq-hashtable | |||
Form | (make-eq-hashtable) (make-eq-hashtable k) | ||
Description | Returns a newly allocated mutable hashtable that accepts arbitrary objects as keys, and compares those keys with eq?. If an argument is given, the initial capacity of the hashtable is set to approximately k elements. | ||
Returns | A newly allocated mutable hashtable that accepts arbitrary objects as keys, and compares those keys with eq?. If an argument is given, the initial capacity of the hashtable is set to approximately k elements. | ||
hashtable-set! | |||
Form | (hashtable-set! hashtable key obj) | ||
Description | Changes hashtable to associate key with obj, adding a new association or replacing any existing association for key. | ||
Returns | unspecified | ||
hashtable-ref | |||
Form | (hashtable-ref hashtable key default) | ||
Description | Returns the value in hashtable associated with key. If hashtable does not contain an association for key, default is returned. | ||
Returns | the value in hashtable associated with key. If hashtable does not contain an association for key, default is returned. | ||
hashtable-keys | |||
Form | (hashtable-keys hashtable) | ||
Description | (not implmented) Returns a vector of all keys in hashtable. The order of the vector is unspecified. | ||
Returns | A vector of all keys in hashtable. The order of the vector is unspecified. | ||
9 Eval. | |||
R6RS library Chapter 16. | |||
eval | |||
Form | (eval expression environment) | ||
Description | Evaluates expression in the specified environment and returns its value. Note that currently the environment argument is ignored. | ||
Returns | result | ||
10 Mutable pairs. | |||
R6RS library Chapter 17. | |||
set-car! | |||
Form | (set-car! pair obj) | ||
Description | Stores obj in the car field of pair. | ||
Returns | unspecified | ||
set-cdr! | |||
Form | (set-cdr! pair obj) | ||
Description | Stores obj in the cdr field of pair. | ||
Returns | unspecified | ||
11 Regular expression. | |||
Regular expression is implmented with Oniguruma library. | |||
rxmatch | |||
Form | (rxmatch regexp string) | ||
Description | Regexp is a regular expression object. A string string is matched by regexp. If it matches, the function returns a [regmatch] object. Otherwise it returns #f. You can use (#/regexp/ string) style instead of (rxmatch #/regexp/ string). | ||
Parameters | regexp | A regular expression object. | |
string | String matched by regexp. | ||
Returns | If it matches, the function returns a [regmatch] object. Otherwise it returns #f. | ||
Examples | (rxmatch #/123/ "12") => #f | ||
(rxmatch #/\d+/ "a345a") => [regmatch] | |||
See also | Regular expression. | regexp | |
regexp | |||
Form | (regexp string) | ||
Description | Regexp is a regular expression object. A string string is matched by regexp. If it matches, the function returns a [regmatch] object. Otherwise it returns #f. | ||
Parameters | regexp | A regular expression object. | |
string | String matched by regexp. | ||
Returns | If it matches, the function returns a [regmatch] object. Otherwise it returns #f. | ||
Examples | (#/123/ "12") => #f | ||
(#/\d+/ "a345a") => [regmatch] | |||
See also | Regular expression. | rxmatch | |
regexp? | |||
Form | (regexp? obj) | ||
Description | Returns #t if obj is a regexp object. | ||
Returns | #t if obj is a regexp object. | ||
Examples | (regexp? #/abc/) => #t | ||
(regexp? "abc") => #f | |||
regexp->string | |||
Form | (regexp->string regexp) | ||
Description | Returns a source string describing the regexp regexp. The returned string is immutable. | ||
Returns | S source string describing the regexp regexp. The returned string is immutable. | ||
Examples | (regexp->string #/abc/) => "abc" | ||
rxmatch-start | |||
Form | (rxmatch-start match &optional (i 0)) | ||
Description | If i equals to zero, the functions return start of entire match. With positive integer I, it returns those of I-th submatches. It is an error to pass other values to I. It is allowed to pass #f to match for convenience. The functions return #f in such case. | ||
Parameters | match | [regmatch] object returned by rxmatch | |
i | index | ||
Returns | I-th submatches. | ||
Examples | (rxmatch-start (#/\d+/ "aaaa")) => #f | ||
(rxmatch-start (rxmatch #/(\d+)(a)/ "a345a") 2) => 4 | |||
rxmatch-end | |||
Form | (rxmatch-end match &optional (i 0)) | ||
Description | If i equals to zero, the functions return end of entire match. With positive integer I, it returns those of I-th submatches. It is an error to pass other values to I. It is allowed to pass #f to match for convenience. The functions return #f in such case. | ||
Parameters | match | [regmatch] object returned by rxmatch | |
i | index | ||
Returns | I-th submatches. | ||
Examples | (rxmatch #/\d+/ "a345a") => 4 | ||
rxmatch-substring | |||
Form | (rxmatch-substring match &optional (i 0)) | ||
Description | If i equals to zero, the functions return substring of entire match. With positive integer I, it returns those of I-th submatches. It is an error to pass other values to I. It is allowed to pass #f to match for convenience. The functions return #f in such case. | ||
Parameters | match | [regmatch] object returned by rxmatch | |
i | index | ||
Returns | I-th submatches. | ||
Examples | (rxmatch-substring (#/\d+/ "a345a")) => "345" | ||
rxmatch-after | |||
Form | (rxmatch-after match &optional (i 0)) | ||
Description | Returns substring of the input string after match. If optional argument is given, the i-th submatch is used (0-th submatch is the entire match). | ||
Returns | Substring of the input string after match. | ||
Examples | (rxmatch-after (#/abc/ "123abcdef")) => "def" | ||
rxmatch-before | |||
Form | (rxmatch-before match &optional (i 0)) | ||
Description | Returns substring of the input string before match. If optional argument is given, the i-th submatch is used (0-th submatch is the entire match). | ||
Returns | Substring of the input string before match. | ||
Examples | (rxmatch-before (#/abc/ "123abcdef")) => "123" | ||
regmatch | |||
Form | (regmatch &optional index) | ||
Description | Works same as (rxmatch-substring regmatch index), | ||
Examples | ((#/abc/ "123abcdef") 0) => "abc" | ||
See also | Regular expression. | rxmatch-substring | |
regmatch | |||
Form | (regmatch 'before &optional index) | ||
Description | Works same as (rxmatch-before regmatch) | ||
Examples | ((#/abc/ "123abcdef") 'before) => "123" | ||
See also | Regular expression. | rxmatch-before | |
regmatch | |||
Form | (regmatch 'after &optional index) | ||
Description | Works same as (rxmatch-after regmatch) | ||
Examples | ((#/abc/ "123abcdef") 'after) => "def" | ||
See also | Regular expression. | rxmatch-after | |
regexp-replace | |||
Form | (regexp-replace regexp string substitution) | ||
Description | Replaces the part of string that matched to regexp for substitution. Just replaces the first match of regexp. | ||
Returns | replaced string | ||
Examples | (regexp-replace #/abc/ "123abc456" "ABC") => "123ABC456" | ||
regexp-replace-all | |||
Form | (regexp-replace-all regexp string substitution) | ||
Description | Replaces the part of string that matched to regexp for substitution. Repeats the replacing throughout entire string. | ||
Returns | replaced string | ||
string->regexp | |||
Form | (string->regexp string) | ||
Description | Takes string as a regexp specification, and constructs [regexp] object. | ||
Returns | [regexp] object | ||
Examples | (string->regexp "abc") #/abc | ||
12 System interfaces. | |||
get-environment-variable | |||
Form | (get-environment-variable name) | ||
Description | Returns the value of the environment variable name as a string, or #f if the environment variable is not defined. | ||
Returns | The value of the environment variable name as a string, or #f if the environment variable is not defined. | ||
Examples | (get-environment-variable "QUERY_STRING") | ||
get-environment-variables | |||
Form | (get-environment-variables) | ||
Description | Returns names and values of all the environment variables as an a-list. | ||
Returns | Returns names and values of all the environment variables as an a-list. | ||
Examples | (get-environment-variables) | ||
sys-readdir | |||
Form | (sys-readdir path) | ||
Description | Returns a list of strings of the directory entries. | ||
Returns | A list of strings of the directory entries. | ||
get-timeofday | |||
Form | (get-timeofday) | ||
Description | Get-timeofday | ||
Returns | (get-timeofday) | ||
13 Generic. | |||
let1 | |||
Form | (let1 var val body ...) | ||
Description | Same as (let ((var val)) body ...) | ||
map-with-index | |||
Form | (map-with-index f l) | ||
Description | Like map, map-to and for-each, except proc receives the index as the first argument. | ||
Returns | Like map, map-to and for-each, except proc receives the index as the first argument. | ||
Examples | (map-with-index list '(a b c d)) => ((0 a (1 b) (2 c (3 d)) | ||
symbol-concat | |||
Form | (symbol-concat . symbols) | ||
Description | Concatnates symbols | ||
Returns | concatnated symbols | ||
string->lines | |||
Form | (string->lines s) | ||
Description | Returns list of lines. | ||
Returns | list of lines. | ||
macroexpand-1 | |||
Form | (macroexpand-1 form) | ||
Description | Expand macro | ||
Returns | expanded only once macro form.(Now you can expand only top-level defined macro) | ||
macroexpand | |||
Form | (macroexpand form) | ||
Description | Expand macro | ||
Returns | expanded macro form.(Now you can expand only top-level defined macro) | ||
gensym | |||
Form | (gensym) | ||
Description | Returns a new symbol. | ||
Returns | A new symbol. | ||
Examples | (gensym) => G100 | ||
digit->integer | |||
Form | (digit->integer char &optional (radix 10)) | ||
Description | If given character char is a valid digit character in radix radix number, the corresponding integer is returned. Otherwise #f is returned. | ||
Returns | If given character char is a valid digit character in radix radix number, the corresponding integer is returned. Otherwise #f is returned. | ||
Examples | (digit->integer #\4) => 4 | ||
(digit->integer #\e 16) => 14 | |||
(digit->integer #\9 8) => #f | |||
Form | (print obj) | ||
Description | Writes a representation of obj to the current output port and (newline) 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. | ||
Returns | unspecified values | ||
map1 | |||
Form | (map1 proc l) | ||
Description | The map1 procedure applies proc element-wise to the elements of the list and returns a list of the results, in order. | ||
Parameters | l | list | |
proc | should accept as many arguments as there are lists and return a single value. | ||
Returns | a list of the results | ||
assoc-ref | |||
Form | (assoc-ref lst key) | ||
Description | Returns the cdr of first pair whose car fields satisfies a given key. | ||
Returns | Returns the cdr of first pair whose car fields satisfies a given key. | ||
read-line | |||
Form | (read-line . port) | ||
Description | Reads one line (a sequence of characters terminated by newline or EOF) from port and returns a string. | ||
Returns | line as a string | ||
write-to-file | |||
Form | (write-to-file path content) | ||
Description | Same as (call-with-output-file path (lambda (port) (display content obj))) | ||
Returns | unspecified. | ||
See also | R6RS | call-with-output-file | |
file->string | |||
Form | (file->string filename) | ||
Description | Read string from a file filename. | ||
Returns | whole file content as string | ||
call-with-string-io | |||
Form | (call-with-string-io str proc) | ||
Description | Convenient string I/O procedure. (define (call-with-string-io str proc) | ||
Returns | output-string | ||
call-with-string-input-port | |||
Form | (call-with-string-input-port str proc) | ||
Description | Creates a textual input port from string str and calls proc with that input port as an argument. | ||
Parameters | proc | proc must accept one argument | |
Returns | values proc returns | ||
14 SRFI-1 List library. | |||
split-at | |||
Form | (split-at x k) | ||
Description | 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)) | ||
Returns | (values (take x i) (drop x i)) | ||
split-at! | |||
Form | (split-at! x k) | ||
Description | Split-at! is the linear-update variant. It is allowed, but not required, to alter the argument list to produce the result. | ||
Returns | split-at! is the linear-update variant. It is allowed, but not required, to alter the argument list to produce the result. | ||
not-pair? | |||
Form | (not-pair? x) | ||
Description | 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. | ||
Returns | (not (pair? x)) | ||
list= | |||
Form | (list= pred . lists) | ||
Description | 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. | ||
xcons | |||
Form | (xcons d a) | ||
Description | Of utility only as a value to be conveniently passed to higher-order procedures. | ||
Returns | (xcons '(b c) 'a) => (a b c) | ||
Examples | (xcons '(b c) 'a) => (a b c) | ||
make-list | |||
Form | (make-list len . maybe-elt) | ||
Description | 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. | ||
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. | ||
Examples | (make-list 4 'c) => (c c c c) | ||
list-tabulate | |||
Form | (list-tabulate len proc) | ||
Description | 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. | ||
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. | ||
Examples | list-tabulate 4 values) => (0 1 2 3) | ||
list-copy | |||
Form | (list-copy lis) | ||
Description | Copies the spine of the argument. | ||
Returns | copied list | ||
last-pair | |||
Form | (last-pair lis) | ||
Description | Returns the last pair in the non-empty, finite list pair. | ||
Returns | the last pair in the non-empty, finite list pair. | ||
Examples | (last-pair '(a b c)) => (c) | ||
last | |||
Form | (last lis) | ||
Description | Returns the last element of the non-empty, finite list pair. | ||
Returns | the last element of the non-empty, finite list pair. | ||
Examples | (last '(a b c)) => c | ||
circular-list | |||
Form | (circular-list val1 . vals) | ||
Description | Constructs a circular list of the elements. | ||
Returns | Constructs a circular list of the elements. | ||
Examples | (circular-list 'z 'q) => (z q z q z q ...) | ||
proper-list? | |||
Form | (proper-list? x) | ||
Description | Returns true iff x is a proper list -- a finite, nil-terminated list. More carefully: The empty list is a proper list. | ||
Returns | #t iff x is a proper list -- a finite, nil-terminated list. | ||
circular-list? | |||
Form | (circular-list? x) | ||
Description | True if x is a circular list. A circular list is a value such that for every n >= 0, cdrn(x) is a pair. | ||
Returns | #t if x is a circular list. A circular list is a value such that for every n >= 0, cdrn(x) is a pair. | ||
dotted-list? | |||
Form | (dotted-list? x) | ||
Description | 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. | ||
Returns | #t 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. | ||
take | |||
Form | (take lis k) | ||
Description | Returns the first i elements of list x. | ||
Returns | the first i elements of list x. | ||
drop | |||
Form | (drop lis k) | ||
Description | Returns all but the first i elements of list x. | ||
Returns | all but the first i elements of list x. | ||
take! | |||
Form | (take! lis k) | ||
Description | Take! is linear-update variants of take. The procedure is allowed, but not required, to alter the argument list to produce the result. | ||
Returns | take! is linear-update variant of take. The procedure is allowed, but not required, to alter the argument list to produce the result. | ||
take-right | |||
Form | (take-right lis k) | ||
Description | Returns the last i elements of flist. | ||
Returns | the last i elements of flist. | ||
drop-right | |||
Form | (drop-right lis k) | ||
Description | Returns all but the last i elements of flist. | ||
Returns | all but the last i elements of flist. | ||
drop-right! | |||
Form | (drop-right! lis k) | ||
Description | Drop-right! is linear-update variant of drop-right: the procedure is allowed, but not required, to alter the argument list to produce the result. | ||
Returns | drop-right! is linear-update variant of drop-right: the procedure is allowed, but not required, to alter the argument list to produce the result. | ||
first | |||
Form | (first pair) | ||
Description | Synonym for car | ||
Returns | (car pair) | ||
See also | SRFI-1 | SRFI-1 List Library | |
second | |||
Form | (second pair) | ||
Description | Synonym for cadr | ||
Returns | (cadr pair) | ||
See also | SRFI-1 | SRFI-1 List Library | |
third | |||
Form | (third pair) | ||
Description | Synonym for caddr | ||
Returns | (caddr pair) | ||
See also | SRFI-1 | SRFI-1 List Library | |
fourth | |||
Form | (fourth pair) | ||
Description | Synonym for cadddr | ||
Returns | (cadddr pair) | ||
See also | SRFI-1 | SRFI-1 List Library | |
fifth | |||
Form | (fifth x) | ||
Description | Synonym for (car (cddddr x)) | ||
Returns | (car (cddddr x)) | ||
See also | SRFI-1 | SRFI-1 List Library | |
sixth | |||
Form | (sixth x) | ||
Description | Synonym for (cadr (cddddr x)) | ||
Returns | (cadr (cddddr x)) | ||
See also | SRFI-1 | SRFI-1 List Library | |
seventh | |||
Form | (seventh x) | ||
Description | Synonym for (caddr (cddddr x)) | ||
Returns | (caddr (cddddr x)) | ||
See also | SRFI-1 | SRFI-1 List Library | |
eighth | |||
Form | (eighth x) | ||
Description | Synonym for (cadddr (cddddr x)) | ||
Returns | (cadddr (cddddr x)) | ||
See also | SRFI-1 | SRFI-1 List Library | |
ninth | |||
Form | (ninth x) | ||
Description | Synonym for (car (cddddr (cddddr x))) | ||
Returns | (car (cddddr (cddddr x))) | ||
See also | SRFI-1 | SRFI-1 List Library | |
tenth | |||
Form | (tenth x) | ||
Description | Synonym for (cadr (cddddr (cddddr x))) | ||
Returns | (cadr (cddddr (cddddr x))) | ||
See also | SRFI-1 | SRFI-1 List Library | |
cons* | |||
Form | (cons* elt1 elt2 ...) | ||
Description | |||
Returns | (cons elt1 (cons elt2 (cons ... eltn))) | ||
Examples | (cons* 1 2 3 4) => (1 2 3 . 4) | ||
(cons* 1) => 1 | |||
See also | SRFI-1 | SRFI-1 List Library | |
car+cdr | |||
Form | (car+cdr pair) | ||
Description | Same as (lambda (p) (values (car p) (cdr p))) | ||
Returns | (values (car p) (cdr p)) | ||
null-list? | |||
Form | (null-list? list) | ||
Description | 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. | ||
Precondition | List is a proper or circular list. | ||
Returns | true if the argument is the empty list (), and false otherwise. | ||
filter-map | |||
Form | (filter-map f lis1 . lists) | ||
Description | Like map, but only true values are saved. | ||
Returns | Like map, but only true values are saved. | ||
Examples | (filter-map (lambda (x) (and (number? x) (* x x))) '(a 1 b 3 c 7)) => (1 9 49) | ||
See also | SRFI-1 | SRFI-1 List Library | |
15 SRFI-8 Binding to multiple values. | |||
receive | |||
Form | (receive formals expression body ...) | ||
Description | This is the way to receive multiple values. Formals can be a (maybe-improper) list of symbols. Expression is evaluated, and the returned value(s) are bound to formals like the binding of lambda formals, then body ... are evaluated. | ||
Returns | The results of the last expression in the body are the values of the receive-expression. | ||
Examples | (receive (a b c) (values 1 2 3) (+ a b c)) => 6 | ||
16 SRFI-28 Basic format strings. | |||
format | |||
Form | (format string arg ...) (format port string arg ...) | ||
Description | Format arg ... according to string. port specifies the destination; if it is an output port, the formatted result is written to it; if it is #t, the result is written to the current output port; if it is #f, the formatted result is returned as a string. Port can be omitted, as SRFI-28 format; it has the same effects as giving #f to the port. string is a string that contains format directives. A format directive is a character sequence begins with tilda, `~', and ends with some specific characters. The rest of string is copied to the output as is. Currently supported directive is ~a/~A (The corresponding argument is printed by display.), ~s/~S (The corresponding argument is printed by write.) | ||
Returns | unspecified or string | ||
Examples | (format #f "apple is ~a" "sweet") => "apple is sweet" | ||
(call-with-output-string (lambda (out) (format out "apple is ~a" "sweet"))) => "apple is sweet" | |||
hashtable-for-each | |||
Form | (hashtable-for-each proc ht) | ||
Description | Todo document | ||
17 Pattern matching. | |||
A port of Andrew Wright's pattern matching macro library. See the Gauche's pattern match document | |||
match | |||
Form | (match) | ||
Description | |||
See also | Gauche's manual | match | |
void | |||
Form | (void) | ||
Description | For psyntax.pp | ||
dynamic-wind | |||
Form | (dynamic-wind before thunk after) | ||
Description | Dynamic-wind implementation The Scheme Programming Language Third Edition by R. Kent Dybvig. | ||
make-parameter | |||
Form | (make-parameter init . conv) | ||
Description | Srfi-39 parameter objects | ||
with-exception-handler | |||
Form | (with-exception-handler new thunk) | ||
Description | Borrowed from ypsilon scheme by Yoshikatsu Fujita | ||
* | (* z1 ...) | Returns the product of their arguments. |
+ | (+ z1 ...) | Returns the sum of their arguments. |
- | (- z1 z2 ...) (- z) | With two or more arguments, this procedures returns the difference of its arguments, associating to the left. |
/ | (/ z1 ...) | Returns the division of their arguments. |
< | (< x1 x2 x3 ...) | Returns #t if its arguments are monotonically increasing and #f otherwise. |
<= | (<= x1 x2 x3 ...) | Returns #t if its arguments are monotonically nondecreasing and #f otherwise. |
= | (= x1 x2 x3 ...) | Returns #t if its arguments are equal and #f otherwise. |
> | (> x1 x2 x3 ...) | Returns #t if its arguments are monotonically decreasing and #f otherwise. |
>= | (> x1 x2 x3 ...) | Returns #t if its arguments are monotonically increasing and #f otherwise. |
abs | (abs n) | Returns the absolute value of its argument. |
and | (and [test1] ...) | If there are no [test]s, #t is returned. |
append | (append list ... obj) | Returns a possibly improper list 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. |
apply | (apply proc arg1 ... rest-args) | The apply procedure calls proc with the elements of the list (append (list arg1 ...) rest-args) as the actual arguments. |
assoc | (assoc obj alist) | Find the first pair in alist whose car field satisfies a given condition, and returns that pair without traversing alist further. |
assoc-ref | (assoc-ref lst key) | Returns the cdr of first pair whose car fields satisfies a given key. |
assv | (assv obj alist) | Find the first pair in alist whose car field satisfies a given condition, and returns that pair without traversing alist further. |
begin | (begin [form] ...) (begin [expression] [expression] ...) | The [begin] keyword has two different roles, depending on its context: It may appear as a form in a [body] , [library body] , or [top-level body], or directly nested in a begin form that appears in a body. |
boolean? | (boolean? obj) | Returns #t if obj is either #t or #f and returns #f otherwise. |
bytevector-for-each | (bytevector-for-each bv proc) | Applies proc element-wise to the elements of the bytevector for its side effects, in order from the first elements to the last. |
bytevector-length | (bytevector-length bytevector) | Returns, as an exact integer object, the number of bytes in bytevector. |
bytevector-u8-ref | (bytevector-u8-ref bytevector k) | Returns the byte at index k of bytevector, as an octet. |
bytevector-u8-set! | (bytevector-u8-set! bytevector k octet) | Stores octet in element k of bytevector. |
caaaaar | (caaaaar p) | returns (car (car (car (car (car p))))) |
caaaadr | (caaaadr p) | returns (car (car (car (car (cdr p))))) |
caaaar | (caaaar p) | returns (car (car (car (car p)))) |
caaadar | (caaadar p) | returns (car (car (car (cdr (car p))))) |
caaaddr | (caaaddr p) | returns (car (car (car (cdr (cdr p))))) |
caaadr | (caaadr p) | returns (car (car (car (cdr p)))) |
caaar | (caaar p) | returns (car (car (car p))) |
caadaar | (caadaar p) | returns (car (car (cdr (car (car p))))) |
caadadr | (caadadr p) | returns (car (car (cdr (car (cdr p))))) |
caadar | (caadar p) | returns (car (car (cdr (car p)))) |
caaddar | (caaddar p) | returns (car (car (cdr (cdr (car p))))) |
caadddr | (caadddr p) | returns (car (car (cdr (cdr (cdr p))))) |
caaddr | (caaddr p) | returns (car (car (cdr (cdr p)))) |
caadr | (caadr p) | returns (car (car (cdr p))) |
caar | (caar p) | returns (car (car p)) |
cadaaar | (cadaaar p) | returns (car (cdr (car (car (car p))))) |
cadaadr | (cadaadr p) | returns (car (cdr (car (car (cdr p))))) |
cadaar | (cadaar p) | returns (car (cdr (car (car p)))) |
cadadar | (cadadar p) | returns (car (cdr (car (cdr (car p))))) |
cadaddr | (cadaddr p) | returns (car (cdr (car (cdr (cdr p))))) |
cadadr | (cadadr p) | returns (car (cdr (car (cdr p)))) |
cadar | (cadar p) | returns (car (cdr (car p))) |
caddaar | (caddaar p) | returns (car (cdr (cdr (car (car p))))) |
caddadr | (caddadr p) | returns (car (cdr (cdr (car (cdr p))))) |
caddar | (caddar p) | returns (car (cdr (cdr (car p)))) |
cadddar | (cadddar p) | returns (car (cdr (cdr (cdr (car p))))) |
caddddr | (caddddr p) | returns (car (cdr (cdr (cdr (cdr p))))) |
cadddr | (cadddr p) | returns (car (cdr (cdr (cdr p)))) |
caddr | (caddr p) | returns (car (cdr (cdr p))) |
cadr | (cadr p) | returns (car (cdr p)) |
call-with-bytevector-output-port | (call-with-bytevector-output-port proc transcoder) | Creates an output port that accumulates the bytes written to it and calls proc with that output port as an argument. Whenever proc returns, a bytevector consisting of all of the port's accumulated bytes (regardless of the port’s currentposition) is returned and the port is closed. |
call-with-current-continuation | (call-with-current-continuation proc) | The procedure call-with-current-continuation (which is the same as the procedure call/cc) packages the current continuation 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 reinstate the continuation that was in effect when the escape procedure was created. |
call-with-input-file | (call-with-input-file filename proc) | Open the file named by filename for input, with no specified file options, and call proc with the obtained port as an argument. If proc returns, the port is closed automatically and the values returned by proc are returned. |
call-with-output-file | (call-with-output-file filename proc) | Open the file named by filename for output, with no specified file options, and call proc with the obtained port as an argument. If proc returns, the port is closed automatically and the values returned by proc are returned. |
call-with-string-input-port | (call-with-string-input-port str proc) | Creates a textual input port from string str and calls proc with that input port as an argument. |
call-with-string-io | (call-with-string-io str proc) | Convenient string I/O procedure. (define (call-with-string-io str proc) |
call-with-string-output-port | (call-with-string-output-port proc) | Creates a textual output port that accumulates the characters written to it and calls proc with that output port as an argument. Whenever proc returns, a string consisting of all of the port's accumulated characters (regardless of the port's current position) is returned and the port is closed. |
call-with-values | (call-with-values producer consumer) | Calls producer with no arguments and a continuation that, when passed some values, calls the consumer procedure with those values as arguments. |
car | (car pair) | Returns the contents of the car field of pair. |
car+cdr | (car+cdr pair) | same as (lambda (p) (values (car p) (cdr p))) |
case | (case [key] [case clause1] [case clause2] ...) | case expression is evaluated as follows. [Key] is evaluated and its result is compared using eqv? against the data represented by the [datum]s of each [case clause] in turn, proceeding in order from left to right through the set of clauses. If the result of evaluating [key] is equivalent to a datum of a [case clause], the corresponding [expression]s are evaluated from left to right and the results of the last expression in the [case clause] are returned as the results of the case expression. |
cdaaaar | (cdaaaar p) | returns (cdr (car (car (car (car p))))) |
cdaaadr | (cdaaadr p) | returns (cdr (car (car (car (cdr p))))) |
cdaaar | (cdaaar p) | returns (cdr (car (car (car p)))) |
cdaadar | (cdaadar p) | returns (cdr (car (car (cdr (car p))))) |
cdaaddr | (cdaaddr p) | returns (cdr (car (car (cdr (cdr p))))) |
cdaadr | (cdaadr p) | returns (cdr (car (car (cdr p)))) |
cdaar | (cdaar p) | returns (cdr (car (car p))) |
cdadaar | (cdadaar p) | returns (cdr (car (cdr (car (car p))))) |
cdadadr | (cdadadr p) | returns (cdr (car (cdr (car (cdr p))))) |
cdadar | (cdadar p) | returns (cdr (car (cdr (car p)))) |
cdaddar | (cdaddar p) | returns (cdr (car (cdr (cdr (car p))))) |
cdadddr | (cdadddr p) | returns (cdr (car (cdr (cdr (cdr p))))) |
cdaddr | (cdaddr p) | returns (cdr (car (cdr (cdr p)))) |
cdadr | (cdadr p) | returns (cdr (car (cdr p))) |
cdar | (cdar p) | returns (cdr (car p)) |
cddaaar | (cddaaar p) | returns (cdr (cdr (car (car (car p))))) |
cddaadr | (cddaadr p) | returns (cdr (cdr (car (car (cdr p))))) |
cddaar | (cddaar p) | returns (cdr (cdr (car (car p)))) |
cddadar | (cddadar p) | returns (cdr (cdr (car (cdr (car p))))) |
cddaddr | (cddaddr p) | returns (cdr (cdr (car (cdr (cdr p))))) |
cddadr | (cddadr p) | returns (cdr (cdr (car (cdr p)))) |
cddar | (cddar p) | returns (cdr (cdr (car p))) |
cdddaar | (cdddaar p) | returns (cdr (cdr (cdr (car (car p))))) |
cdddadr | (cdddadr p) | returns (cdr (cdr (cdr (car (cdr p))))) |
cdddar | (cdddar p) | returns (cdr (cdr (cdr (car p)))) |
cddddar | (cddddar p) | returns (cdr (cdr (cdr (cdr (car p))))) |
cdddddr | (cdddddr p) | returns (cdr (cdr (cdr (cdr (cdr p))))) |
cddddr | (cddddr p) | returns (cdr (cdr (cdr (cdr p)))) |
cdddr | (cdddr p) | returns (cdr (cdr (cdr p))) |
cddr | (cddr p) | returns (cdr (cdr p)) |
cdr | (cdr pair) | Returns the contents of the cdr field of pair. |
char->integer | (char->integer char) | Given a character, char->integer returns its Unicode scalar value as an exact integer object. |
char<=? | (char<=? char1 char2 char3 ...) | Impose a total ordering on the set of characters according to their Unicode scalar values. |
char | (char char1 char2 char3 ...) | Impose a total ordering on the set of characters according to their Unicode scalar values. |
char=? | (char=? char1 char2 char3 ...) | Returns #t if all given charctors are same charctor. |
char>=? | (char>=? char1 char2 char3 ...) | Impose a total ordering on the set of characters according to their Unicode scalar values. |
char>? | (char>? char1 char2 char3 ...) | Impose a total ordering on the set of characters according to their Unicode scalar values. |
char? | (char? obj) | Returns #t if obj is a character, otherwise returns #f. |
circular-list | (circular-list val1 . vals) | Constructs a circular list of the elements. |
circular-list? | (circular-list? x) | True if x is a circular list. |
close-input-port | (close-input-port input-port) | Closes input-port or output-port, respectively. |
close-output-port | (close-output-port output-port) | Closes output-port. |
cond | (cond [cond clause1] [cond clause2] ...) | A cond expression is evaluated by evaluating the [test] expressions of successive [cond clause]s in order until one of them evaluates to a true value. When a [test] evaluates to a true value, then the remaining [expression]s in its [cond clause] are evaluated in order, and the results of the last [expression] in the [cond clause] are returned as the results of the entire cond expression. If the selected [cond clause] contains only the [test] and no [expression]s, then the value of the [test] is returned as the result. |
cons | (cons obj1 obj2) | Returns a newly allocated pair whose car is obj1 and whose cdr is obj2. |
cons* | (cons* elt1 elt2 ...) | |
current-error-port | (current-error-port) | Returns default textual ports for regular error output. |
current-input-port | (current-input-port) | Returns a default textual port for input. |
current-output-port | (current-output-port) | Returns a default textual port for output. |
define | (define [variable] [expression]) (define [variable]) (define ([variable] [formals]) [body]) (define ([variable] . [formal]) [body]) | The define form is used to create variable bindings and may appear anywhere other definitions may appear. |
define-macro | (define-macro (name . args) body) | The define-macro form is used to create traditional macro. |
digit->integer | (digit->integer char &optional (radix 10)) | If given character char is a valid digit character in radix radix number, the corresponding integer is returned. |
display | (display obj) or (display obj textual-output-port) | Writes a representation of obj to the given textual-output-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. The textual-output-port argument may be omitted, in which case it defaults to the value returned by current-output-port. |
do | (do (([variable1] [init1] [step1]) ...) ([test] [expression] ...) [command] ...) | 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 #f, then the [command]s are evaluated in order for effect, the [step] expressions are evaluated in some unspecified order, the [variable]s are bound to fresh locations holding the results, and the next iteration begins. If [test] evaluates to a true value, the [expression]s are evaluated from left to right and the values of the last [expression] are returned. If no [expression]s are present, then the do expression returns unspecified values. The regionof the binding of a [variable] consists of the entire do expression except for the [init]s. 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]). |
dotted-list? | (dotted-list? x) | True if x is a finite, non-nil-terminated list. |
drop | (drop lis k) | Returns all but the first i elements of list x. |
drop-right | (drop-right lis k) | Returns all but the last i elements of flist. |
drop-right! | (drop-right! lis k) | drop-right! is linear-update variant of drop-right: the procedure is allowed, but not required, to alter the argument list to produce the result. |
dynamic-wind | (dynamic-wind before thunk after) | dynamic-wind implementation The Scheme Programming Language Third Edition by R. |
eighth | (eighth x) | Synonym for (cadddr (cddddr x)) |
eof-object | (eof-object) | Returns the end-of-file object. |
eof-object? | (eof-object? obj) | Returns #t if obj is the end-of-file object, #f otherwise. |
eq? | (eq?) | The eq? predicate is similar to eqv? except that in some cases it is capable of discerning distinctions finer than those detectable by eqv?. The eq? and eqv? predicates are guaranteed to have the same behavior on symbols, booleans, the empty list, pairs, procedures, non-empty strings, bytevectors, and vectors, and records. |
equal? | (equal? obj1 obj2) | The equal? predicate returns #t if and only if the unfoldings of its arguments into regular trees are equal as ordered trees. |
eqv? | (eqv? obj1 obj2) | The eqv? procedure defines a useful equivalence relation on objects. |
error | (error message) | This error procedure will be replaced with R6RS (error) |
eval | (eval expression environment) | Evaluates expression in the specified environment and returns its value. Note that currently the environment argument is ignored. |
even? | (even? x) | Returns whether x is even. |
fifth | (fifth x) | Synonym for (car (cddddr x)) |
file->string | (file->string filename) | Read string from a file filename. |
file-exists? | (file-exists? filename) | Returns #t if the named file exists at the time the procedure is called, #f otherwise. |
filter | (filter proc list) | The filter procedure applies proc to each element of list and returns a list of the elements of list for which proc returned a true value. The elements of the result list(s) are in the same order as they appear in the input list. |
filter-map | (filter-map f lis1 . lists) | Like map, but only true values are saved. |
find | (find pred lst) | The find procedure applies proc to the elements of list in order. |
first | (first pair) | Synonym for car |
fold-left | (fold-left combine nil list1 list2 ...listn) | The fold-left procedure iterates the combine procedure over an accumulator value and the elements of the lists from left to right, starting with an accumulator value of nil. More specifically, fold-left returns nil if the lists are empty. |
for-each | (for-each proc list1 list2 ...) | The for-each procedure applies proc element-wise to the elements of the lists for its side effects, in order from the first elements to the last. |
format | (format string arg ...) (format port string arg ...) | Format arg ... |
fourth | (fourth pair) | Synonym for cadddr |
gensym | (gensym) | Returns a new symbol. |
get-bytevector-n | (get-bytevector-n binary-input-port count) | Reads from binary-input-port, blocking as necessary, until count bytes are available from binary-input-port or until an end of file is reached. If count bytes are available before an end of file, get-bytevector-n returns a bytevector of size count. |
get-environment-variable | (get-environment-variable name) | Returns the value of the environment variable name as a string, or #f if the environment variable is not defined. |
get-environment-variables | (get-environment-variables) | Returns names and values of all the environment variables as an a-list. |
get-timeofday | (get-timeofday) | get-timeofday |
get-u8 | (get-u8 binary-input-port) | Reads from binary-input-port, blocking as necessary, until a byte is available from binary-input-port or until an end of file is reached. If a byte becomes available, get-u8 returns the byte as an octet and updates binary-input-port to point just past that byte. |
guard | (guard ([variable] [cond clause1] [cond clause2] ...) | (guard ([variable] syntax [cond clause1] [cond clause2] ...) [body]) => auxiliary syntax else auxiliary syntax Semantics: Evaluating a guard form evaluates [body] with an exception handler that binds the raised object to [variable] and within the scope of that binding evaluates the clauses as if they were the clauses of a cond expression. |
hashtable-for-each | (hashtable-for-each proc ht) | todo document |
hashtable-keys | (hashtable-keys hashtable) | (not implmented) Returns a vector of all keys in hashtable. |
hashtable-ref | (hashtable-ref hashtable key default) | Returns the value in hashtable associated with key. |
hashtable-set! | (hashtable-set! hashtable key obj) | Changes hashtable to associate key with obj, adding a new association or replacing any existing association for key. |
if | (if [test] [consequent] [alternate]) (if [test] [consequent]) | An if expression is evaluated as follows: first, [test] is evaluated. If it yields a true value, then [consequent] is evaluated and its values are returned.Otherwise If |
integer->char | (integer->char sv) | For a Unicode scalar value sv, integer->char returns its associated character. |
integer? | (integer? obj) | Returns#t if obj is integer, otherwise #f. |
lambda | (lambda [formals] [body]) | A lambda expression evaluates to a procedure. |
last | (last lis) | Returns the last element of the non-empty, finite list pair. |
last-pair | (last-pair lis) | Returns the last pair in the non-empty, finite list pair. |
length | (length l) | Returns the length of list. |
let | (let [bindings] [body]) | (let [bindings] [body]) Syntax: [Bindings] must have the form (([variable1] [init1]) ...), where each [init] is an expression. Any variable must not appear more than once in the [variable]s. |
let* | (let* [bindings] [body]) | (let* [bindings] [body]) Syntax: [Bindings] must have the form (([variable1] [init1]) ...), Semantics: The let* form is similar to let, but the [init]s are evaluated and bindings created sequentially from left to right, with the regionof each binding including the bindings to its right as well as [body]. Thus the second [init] is evaluated in an environment in which the first binding is visible and initialized, and so on. |
let1 | (let1 var val body ...) | Same as (let ((var val)) body ...) |
letrec | (letrec [bindings] [body]) | (letrec [bindings] [body]) Syntax: [Bindings] must have the form (([variable1] [init1]) ...), Any variable must not appear more than once in the [variable]s. Semantics: The [variable]s are bound to fresh locations, 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 values of the last expression in are returned.Each binding of a [variable] has the entire letrec expression as its region, making it possible to define mutually recursive procedures. |
list | (list obj ...) | Returns a newly allocated list of its arguments. |
list->string | (list->string l) | The list->string procedure returns a newly allocated string formed from the characters in list. |
list->vector | (list->vector l) | The list->vector procedure returns a newly created vector initialized to the elements of the list list. |
list-copy | (list-copy lis) | Copies the spine of the argument. |
list-ref | (list-ref l k) | returns the kth element of list. |
list-tabulate | (list-tabulate len proc) | Returns an n-element list. |
list-tail | (list-tail l k) | returns the subchain of pairs of list obtained by omitting the first k elements |
list= | (list= pred . lists) | Determines list equality, given an element-equality procedure. |
list? | (list? obj) | (not implemented yet) Returns #t if obj is a list, #f otherwise. |
list? | (list? obj) | Returns #t if obj is a list, #f otherwise. |
macroexpand | (macroexpand form) | Expand macro |
macroexpand-1 | (macroexpand-1 form) | Expand macro |
make-custom-binary-input-port | (make-custom-binary-input-port id read! procedure get-position set-position! close) | Note. |
make-eq-hashtable | (make-eq-hashtable) (make-eq-hashtable k) | Returns a newly allocated mutable hashtable that accepts arbitrary objects as keys, and compares those keys with eq?. |
make-list | (make-list len . maybe-elt) | Returns an n-element list, whose elements are all the value fill. |
make-parameter | (make-parameter init . conv) | srfi-39 parameter objects |
make-string | (make-string k &optional char) | Returns a newly allocated string of length k. |
make-transcoder | (make-transcoder codec) | Returns transcoder with the behavior specified by its arguments. |
map | (map proc list1 list2 ...) | The map procedure applies proc element-wise to the elements of the lists and returns a list of the results, in order. |
map-with-index | (map-with-index f l) | Like map, map-to and for-each, except proc receives the index as the first argument. |
map1 | (map1 proc l) | The map1 procedure applies proc element-wise to the elements of the list and returns a list of the results, in order. |
match | (match) | |
memq | (memq obj list) | Return the first sublist of list whose car satisfies a given condition with eq?, where the sublists of lists are the lists returned by (list-tail list k) for k less than the length of list. |
mode | (mod z1 z2) | Returns the modulo of their arguments. |
newline | (newline . p) | This is equivalent to using write-char to write #\linefeed to textual-output-port. |
ninth | (ninth x) | Synonym for (car (cddddr (cddddr x))) |
not | (not obj) | Returns #t if obj is #f, and returns #f otherwise. |
not-pair? | (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. |
null-list? | (null-list? list) | Returns true if the argument is the empty list (), and false otherwise. |
null? | (null? obj) | Returns #t if obj is the empty list, #f otherwise. |
number->string | (number->string z radix) | Takes a number object and a radix and returns as a string an external representation of the given number object in the given radix. |
number->string | (number->string z) | Takes a number object and returns as a string an external representation of the given number object. |
number? | (number? obj) | return #t if obj is number object and #f otherwise. |
open-bytevector-output-port | (open-bytevector-output-port transcoder) | Returns two values: an output port and an extraction procedure. The output port accumulates the bytes written to it for later extraction by the procedure. If transcoder is a transcoder, it becomes the transcoder associated with the port. |
open-file-input-port | (open-file-input-port filename) | Returns an input port for the named file. |
open-file-output-port | (open-file-output-port filename) | Returns an output port for the named file. |
open-output-file | (open-output-file filename) | Opens filename for output, with empty file options, and returns the obtained port. |
open-string-input-port | (open-string-input-port string) | Returns a textual input port whose characters are drawn from string. |
open-string-output-port | (open-string-output-port) | Returns two values: a textual output port and an extraction procedure. The output port accumulates the characters written to it for later extraction by the procedure. The extraction procedure takes no arguments. When called, it returns a string consisting of all of the port's accumulated characters (regardless of the current position),removes the accumulated characters from the port, and resetsthe port's position |
or | (or [test1] ...) | If there are no [test]s, #f is returned. |
pair? | (pair? obj) | Returns #t if obj is a pair, and otherwise returns #f. |
(print obj) | Writes a representation of obj to the current output port and (newline) Strings that appear in the written representation are not enclosed in doublequotes, and no characters are escaped within those strings. | |
procedure? | (procedure? obj) | Returns #t if obj is a procedure, otherwise returns #f. |
proper-list? | (proper-list? x) | Returns true iff x is a proper list -- a finite, nil-terminated list. |
quasiquote | (quasiquote [qq template]) | Quasiquote |
quote | (quote [datum]) | Evaluates to the datum value represented by [datum]. |
raise | (raise obj) | Raises a non-continuable exception by invoking the current exception handler on obj. |
raise-continuable | (raise-continuable obj) | Raises a continuable exception by invoking the current exception handler on obj. The handler is called with a continuation that is equivalent to the continuation of the call to raise-continuable, with these two exceptions: (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. |
read | (read) (read textual-input-port) | Reads an external representation from textual-input-port and returns the datum it represents. |
read-char | (read-char &optional textual-input-port) | Reads from textual-input-port, blocking as necessary until a character is available from textual-input-port, or the data that are available cannot be the prefix of any valid encoding, or an end of file is reached. If a complete character is available before the next end of file, read-char returns that character, and updates the input port to point past that character. |
read-line | (read-line . port) | Reads one line (a sequence of characters terminated by newline or EOF) from port and returns a string. |
receive | (receive formals expression body ...) | This is the way to receive multiple values. Formals can be a (maybe-improper) list of symbols. Expression is evaluated, and the returned value(s) are bound to formals like the binding of lambda formals, then body ... |
regexp | (regexp string) | Regexp is a regular expression object. |
regexp->string | (regexp->string regexp) | Returns a source string describing the regexp regexp. |
regexp-replace | (regexp-replace regexp string substitution) | Replaces the part of string that matched to regexp for substitution. |
regexp-replace-all | (regexp-replace-all regexp string substitution) | Replaces the part of string that matched to regexp for substitution. |
regexp? | (regexp? obj) | Returns #t if obj is a regexp object. |
regmatch | (regmatch 'after &optional index) | Works same as (rxmatch-after regmatch) |
regmatch | (regmatch 'before &optional index) | Works same as (rxmatch-before regmatch) |
regmatch | (regmatch &optional index) | Works same as (rxmatch-substring regmatch index), |
remp | (remp proc l) | The remp procedure applies proc to each element of list and returns a list of the elements of list for which proc returned #f. |
reverse | (reverse l) | Returns a newly allocated list consisting of the elements of list in reverse order. |
rxmatch | (rxmatch regexp string) | Regexp is a regular expression object. |
rxmatch-after | (rxmatch-after match &optional (i 0)) | Returns substring of the input string after match. |
rxmatch-before | (rxmatch-before match &optional (i 0)) | Returns substring of the input string before match. |
rxmatch-end | (rxmatch-end match &optional (i 0)) | If i equals to zero, the functions return end of entire match. |
rxmatch-start | (rxmatch-start match &optional (i 0)) | If i equals to zero, the functions return start of entire match. |
rxmatch-substring | (rxmatch-substring match &optional (i 0)) | If i equals to zero, the functions return substring of entire match. |
second | (second pair) | Synonym for cadr |
set! | (set! [variable] [expression]) | [Expression] is evaluated, and the resulting value is stored in the location to which [variable] is bound. |
set-car! | (set-car! pair obj) | Stores obj in the car field of pair. |
set-cdr! | (set-cdr! pair obj) | Stores obj in the cdr field of pair. |
set-current-input-port! | (set-current-input-port!) | used internal |
set-current-output-port! | (set-current-output-port!) | used internal |
seventh | (seventh x) | Synonym for (caddr (cddddr x)) |
sixth | (sixth x) | Synonym for (cadr (cddddr x)) |
split-at | (split-at x k) | split-at splits the list x at index i, returning a list of the first i elements, and the remaining tail. |
split-at! | (split-at! x k) | split-at! is the linear-update variant. |
standard-input-port | (standard-input-port) | Returns a fresh binary input port connected to standard input. |
string | (string char ...) | Returns a newly allocated string composed of the arguments. |
string->lines | (string->lines s) | Returns list of lines. |
string->number | (string->number string) | Returns a number by the given string. |
string->regexp | (string->regexp string) | Takes string as a regexp specification, and constructs [regexp] object. |
string->symbol | (string->symbol string) | Returns the symbol whose name is string. |
string-append | (string-append string ...) | Returns a newly allocated string whose characters form the concatenation of the given strings. |
string-length | (string-length string) | Returns the number of characters in the given string as an exact integer object. |
string-ref | (string-ref string k) | character at index k in string |
string-ref | (string-ref string k) | Returns character k of string using zero-origin indexing. |
string-set! | (string-set! string k char) | stores char in element k of string. |
string-split | (string-split string splitter) | Splits string by splitter and returns a list of strings. |
string=? | (string=? string1 string2 string3 ...) | Returns #t if the strings are the same length and contain the same characters in the same positions. Otherwise, the string=? procedure returns #f.Returns #t if obj is a string, otherwise returns #f. |
string? | (string? obj) | Returns #t if obj is a string, otherwise returns #f. |
symbol->string | (symbol->string symbol) | Returns the name of symbol as an immutable string. |
symbol-concat | (symbol-concat . symbols) | concatnates symbols |
symbol? | (symbol? obj) | Returns #t if obj is a symbol, otherwise returns #f. |
sys-readdir | (sys-readdir path) | Returns a list of strings of the directory entries. |
take | (take lis k) | Returns the first i elements of list x. |
take! | (take! lis k) | take! is linear-update variants of take. |
take-right | (take-right lis k) | Returns the last i elements of flist. |
tenth | (tenth x) | Synonym for (cadr (cddddr (cddddr x))) |
third | (third pair) | Synonym for caddr |
transcoded-port | (transcoded-port binary-port transcoder) | Returns a new textual port with the specified transcoder. Otherwise the new textual port's state is largely the same as that of binary-port. If binary-port is an input port, the new textual port will be an input port and will transcode the bytes that have not yet been read from binary-port. |
unless | (unless test body ...) | Evaluates test. |
utf-8-codec | (utf-8-codec) | Predefined codecs for the UTF-8 encoding schemes. |
utf8->string | (utf8->string bytevector) | Returns a newly allocated (unless empty) string whose character sequence is encoded by the given bytevector. |
values | (values obj ...) | Delivers all of its arguments to its continuation. |
vector | (vector obj ...) | Returns a newly allocated vector whose elements contain the given arguments. |
vector->list | (vector->list v) | returns a newly allocated list of the objects contained in the elements of vector |
vector-for-each | (vector-for-each proc vector1 vector2 ...) | Applies proc element-wise to the elements of the vectors for its side effects, in order from the first elements to the last. |
vector-length | (vector-length vector) | Returns the number of elements in vector as an exact integer object. |
vector-map | (vector-map proc vector1 vector2 ...) | Applies proc element-wise to the elements of the vectors and returns a vector of the results, in order. |
vector-ref | (vector-ref vector k) | Returns the contents of elementk of vector. |
vector-set! | (vector-set! vector k obj) | stores obj in element k of vector, and returns unspecified values. |
vector? | (vector? obj) | Returns #t if obj is a vector. |
void | (void) | for psyntax.pp |
when | (when test body ...) | Evaluates test. |
with-exception-handler | (with-exception-handler new thunk) | borrowed from ypsilon scheme by Yoshikatsu Fujita |
with-exception-handler | (with-exception-handler handler thunk) | Returns the results of invoking thunk. |
with-input-from-file | (with-input-from-file filename thunk) | |
write | (write obj &optional textual-output-port) | Writes the external representation of obj to textual-output-port. |
write-to-file | (write-to-file path content) | Same as (call-with-output-file path (lambda (port) (display content obj))) |
xcons | (xcons d a) | Of utility only as a value to be conveniently passed to higher-order procedures. |
zero? | (zero? n) | tests if the number object is = to zero |