Warning: This is the manual of the legacy Guile 2.2 series. You may want to read the manual of the current stable series instead.

Next: , Previous: , Up: R6RS Standard Libraries   [Contents][Index]


7.6.2.2 rnrs base

The (rnrs base (6)) library exports the procedures and syntactic forms described in the main section of the Report (see R6RS Base library in The Revised^6 Report on the Algorithmic Language Scheme). They are grouped below by the existing manual sections to which they correspond.

Scheme Procedure: boolean? obj
Scheme Procedure: not x

See Booleans, for documentation.

Scheme Procedure: symbol? obj
Scheme Procedure: symbol->string sym
Scheme Procedure: string->symbol str

See Symbol Primitives, for documentation.

Scheme Procedure: char? obj
Scheme Procedure: char=?
Scheme Procedure: char<?
Scheme Procedure: char>?
Scheme Procedure: char<=?
Scheme Procedure: char>=?
Scheme Procedure: integer->char n
Scheme Procedure: char->integer chr

See Characters, for documentation.

Scheme Procedure: list? x
Scheme Procedure: null? x

See List Predicates, for documentation.

Scheme Procedure: pair? x
Scheme Procedure: cons x y
Scheme Procedure: car pair
Scheme Procedure: cdr pair
Scheme Procedure: caar pair
Scheme Procedure: cadr pair
Scheme Procedure: cdar pair
Scheme Procedure: cddr pair
Scheme Procedure: caaar pair
Scheme Procedure: caadr pair
Scheme Procedure: cadar pair
Scheme Procedure: cdaar pair
Scheme Procedure: caddr pair
Scheme Procedure: cdadr pair
Scheme Procedure: cddar pair
Scheme Procedure: cdddr pair
Scheme Procedure: caaaar pair
Scheme Procedure: caaadr pair
Scheme Procedure: caadar pair
Scheme Procedure: cadaar pair
Scheme Procedure: cdaaar pair
Scheme Procedure: cddaar pair
Scheme Procedure: cdadar pair
Scheme Procedure: cdaadr pair
Scheme Procedure: cadadr pair
Scheme Procedure: caaddr pair
Scheme Procedure: caddar pair
Scheme Procedure: cadddr pair
Scheme Procedure: cdaddr pair
Scheme Procedure: cddadr pair
Scheme Procedure: cdddar pair
Scheme Procedure: cddddr pair

See Pairs, for documentation.

Scheme Procedure: number? obj

See Numerical Tower, for documentation.

Scheme Procedure: string? obj

See String Predicates, for documentation.

Scheme Procedure: procedure? obj

See Procedure Properties, for documentation.

Scheme Syntax: define name value
Scheme Syntax: set! variable-name value

See Definition, for documentation.

Scheme Syntax: define-syntax keyword expression
Scheme Syntax: let-syntax ((keyword transformer) …) exp1 exp2 …
Scheme Syntax: letrec-syntax ((keyword transformer) …) exp1 exp2 …

See Defining Macros, for documentation.

Scheme Syntax: identifier-syntax exp

See Identifier Macros, for documentation.

Scheme Syntax: syntax-rules literals (pattern template) ...

See Syntax Rules, for documentation.

Scheme Syntax: lambda formals body

See Lambda, for documentation.

Scheme Syntax: let bindings body
Scheme Syntax: let* bindings body
Scheme Syntax: letrec bindings body
Scheme Syntax: letrec* bindings body

See Local Bindings, for documentation.

Scheme Syntax: let-values bindings body
Scheme Syntax: let*-values bindings body

See SRFI-11, for documentation.

Scheme Syntax: begin expr1 expr2 ...

See begin, for documentation.

Scheme Syntax: quote expr
Scheme Syntax: quasiquote expr
Scheme Syntax: unquote expr
Scheme Syntax: unquote-splicing expr

See Expression Syntax, for documentation.

Scheme Syntax: if test consequence [alternate]
Scheme Syntax: cond clause1 clause2 ...
Scheme Syntax: case key clause1 clause2 ...

See Conditionals, for documentation.

Scheme Syntax: and expr ...
Scheme Syntax: or expr ...

See and or, for documentation.

Scheme Procedure: eq? x y
Scheme Procedure: eqv? x y
Scheme Procedure: equal? x y
Scheme Procedure: symbol=? symbol1 symbol2 ...

See Equality, for documentation.

symbol=? is identical to eq?.

Scheme Procedure: complex? z

See Complex Numbers, for documentation.

Scheme Procedure: real-part z
Scheme Procedure: imag-part z
Scheme Procedure: make-rectangular real_part imaginary_part
Scheme Procedure: make-polar x y
Scheme Procedure: magnitude z
Scheme Procedure: angle z

See Complex, for documentation.

Scheme Procedure: sqrt z
Scheme Procedure: exp z
Scheme Procedure: expt z1 z2
Scheme Procedure: log z
Scheme Procedure: sin z
Scheme Procedure: cos z
Scheme Procedure: tan z
Scheme Procedure: asin z
Scheme Procedure: acos z
Scheme Procedure: atan z

See Scientific, for documentation.

Scheme Procedure: real? x
Scheme Procedure: rational? x
Scheme Procedure: numerator x
Scheme Procedure: denominator x
Scheme Procedure: rationalize x eps

See Reals and Rationals, for documentation.

Scheme Procedure: exact? x
Scheme Procedure: inexact? x
Scheme Procedure: exact z
Scheme Procedure: inexact z

See Exactness, for documentation. The exact and inexact procedures are identical to the inexact->exact and exact->inexact procedures provided by Guile’s code library.

Scheme Procedure: integer? x

See Integers, for documentation.

Scheme Procedure: odd? n
Scheme Procedure: even? n
Scheme Procedure: gcd x ...
Scheme Procedure: lcm x ...
Scheme Procedure: exact-integer-sqrt k

See Integer Operations, for documentation.

Scheme Procedure: =
Scheme Procedure: <
Scheme Procedure: >
Scheme Procedure: <=
Scheme Procedure: >=
Scheme Procedure: zero? x
Scheme Procedure: positive? x
Scheme Procedure: negative? x

See Comparison, for documentation.

Scheme Procedure: for-each f lst1 lst2 ...

See SRFI-1 Fold and Map, for documentation.

Scheme Procedure: list elem …

See List Constructors, for documentation.

Scheme Procedure: length lst
Scheme Procedure: list-ref lst k
Scheme Procedure: list-tail lst k

See List Selection, for documentation.

Scheme Procedure: append lst … obj
Scheme Procedure: append
Scheme Procedure: reverse lst

See Append/Reverse, for documentation.

Scheme Procedure: number->string n [radix]
Scheme Procedure: string->number str [radix]

See Conversion, for documentation.

Scheme Procedure: string char ...
Scheme Procedure: make-string k [chr]
Scheme Procedure: list->string lst

See String Constructors, for documentation.

Scheme Procedure: string->list str [start [end]]

See List/String Conversion, for documentation.

Scheme Procedure: string-length str
Scheme Procedure: string-ref str k
Scheme Procedure: string-copy str [start [end]]
Scheme Procedure: substring str start [end]

See String Selection, for documentation.

Scheme Procedure: string=? s1 s2 s3 …
Scheme Procedure: string<? s1 s2 s3 …
Scheme Procedure: string>? s1 s2 s3 …
Scheme Procedure: string<=? s1 s2 s3 …
Scheme Procedure: string>=? s1 s2 s3 …

See String Comparison, for documentation.

Scheme Procedure: string-append arg …

See Reversing and Appending Strings, for documentation.

Scheme Procedure: string-for-each proc s [start [end]]

See Mapping Folding and Unfolding, for documentation.

Scheme Procedure: + z1 ...
Scheme Procedure: - z1 z2 ...
Scheme Procedure: * z1 ...
Scheme Procedure: / z1 z2 ...
Scheme Procedure: max x1 x2 ...
Scheme Procedure: min x1 x2 ...
Scheme Procedure: abs x
Scheme Procedure: truncate x
Scheme Procedure: floor x
Scheme Procedure: ceiling x
Scheme Procedure: round x

See Arithmetic, for documentation.

Scheme Procedure: div x y
Scheme Procedure: mod x y
Scheme Procedure: div-and-mod x y

These procedures accept two real numbers x and y, where the divisor y must be non-zero. div returns the integer q and mod returns the real number r such that x = q*y + r and 0 <= r < abs(y). div-and-mod returns both q and r, and is more efficient than computing each separately. Note that when y > 0, div returns floor(x/y), otherwise it returns ceiling(x/y).

(div 123 10) ⇒ 12
(mod 123 10) ⇒ 3
(div-and-mod 123 10) ⇒ 12 and 3
(div-and-mod 123 -10) ⇒ -12 and 3
(div-and-mod -123 10) ⇒ -13 and 7
(div-and-mod -123 -10) ⇒ 13 and 7
(div-and-mod -123.2 -63.5) ⇒ 2.0 and 3.8
(div-and-mod 16/3 -10/7) ⇒ -3 and 22/21
Scheme Procedure: div0 x y
Scheme Procedure: mod0 x y
Scheme Procedure: div0-and-mod0 x y

These procedures accept two real numbers x and y, where the divisor y must be non-zero. div0 returns the integer q and mod0 returns the real number r such that x = q*y + r and -abs(y/2) <= r < abs(y/2). div0-and-mod0 returns both q and r, and is more efficient than computing each separately.

Note that div0 returns x/y rounded to the nearest integer. When x/y lies exactly half-way between two integers, the tie is broken according to the sign of y. If y > 0, ties are rounded toward positive infinity, otherwise they are rounded toward negative infinity. This is a consequence of the requirement that -abs(y/2) <= r < abs(y/2).

(div0 123 10) ⇒ 12
(mod0 123 10) ⇒ 3
(div0-and-mod0 123 10) ⇒ 12 and 3
(div0-and-mod0 123 -10) ⇒ -12 and 3
(div0-and-mod0 -123 10) ⇒ -12 and -3
(div0-and-mod0 -123 -10) ⇒ 12 and -3
(div0-and-mod0 -123.2 -63.5) ⇒ 2.0 and 3.8
(div0-and-mod0 16/3 -10/7) ⇒ -4 and -8/21
Scheme Procedure: real-valued? obj
Scheme Procedure: rational-valued? obj
Scheme Procedure: integer-valued? obj

These procedures return #t if and only if their arguments can, respectively, be coerced to a real, rational, or integer value without a loss of numerical precision.

real-valued? will return #t for complex numbers whose imaginary parts are zero.

Scheme Procedure: nan? x
Scheme Procedure: infinite? x
Scheme Procedure: finite? x

nan? returns #t if x is a NaN value, #f otherwise. infinite? returns #t if x is an infinite value, #f otherwise. finite? returns #t if x is neither infinite nor a NaN value, otherwise it returns #f. Every real number satisfies exactly one of these predicates. An exception is raised if x is not real.

Scheme Syntax: assert expr

Raises an &assertion condition if expr evaluates to #f; otherwise evaluates to the value of expr.

Scheme Procedure: error who message irritant1 ...
Scheme Procedure: assertion-violation who message irritant1 ...

These procedures raise compound conditions based on their arguments: If who is not #f, the condition will include a &who condition whose who field is set to who; a &message condition will be included with a message field equal to message; an &irritants condition will be included with its irritants list given by irritant1 ....

error produces a compound condition with the simple conditions described above, as well as an &error condition; assertion-violation produces one that includes an &assertion condition.

Scheme Procedure: vector-map proc v
Scheme Procedure: vector-for-each proc v

These procedures implement the map and for-each contracts over vectors.

Scheme Procedure: vector arg …
Scheme Procedure: vector? obj
Scheme Procedure: make-vector len
Scheme Procedure: make-vector len fill
Scheme Procedure: list->vector l
Scheme Procedure: vector->list v

See Vector Creation, for documentation.

Scheme Procedure: vector-length vector
Scheme Procedure: vector-ref vector k
Scheme Procedure: vector-set! vector k obj
Scheme Procedure: vector-fill! v fill

See Vector Accessors, for documentation.

Scheme Procedure: call-with-current-continuation proc
Scheme Procedure: call/cc proc

See Continuations, for documentation.

Scheme Procedure: values arg …
Scheme Procedure: call-with-values producer consumer

See Multiple Values, for documentation.

Scheme Procedure: dynamic-wind in_guard thunk out_guard

See Dynamic Wind, for documentation.

Scheme Procedure: apply proc arg … arglst

See Fly Evaluation, for documentation.


Next: , Previous: , Up: R6RS Standard Libraries   [Contents][Index]