Skip to content
Andrzej edited this page Apr 7, 2011 · 1 revision

============== API for Scheme ==============

PScheme is striving for compatibility with R5RS specification of the Scheme language.

Primitive Data Types

Nil

An unspecified value. Returned by functions like set! or display.

Literals
none
Predicates
none
Equality
eq?, eqv, equal? - identity
Evaluates to
Itself

Boolean

A Boolean True or False. Following R5RS specification all other expressions equal to boolean True.

Literals
#t, #f
Predicates
bool?
Equality
eq? - identity
eqv?, equal? - value
Evaluates to
Itself

Char

Character type. PScheme uses unicode characters, roughly matching R6RS specification.

Literals
#\c, #\name, #\xhh, #\uhhhh, #\Uhhhhhh, where:
name = {space, newline}
h = {0-9, a-f}
c = ascii character literal, except space and control codes
Predicates
char?
Equality
eq?, - identity
eqv?, equal? - value
Evaluates to
Itself

String

Character String type. As for the Char type, PScheme uses unicode strings.

Literals
"c[c]", where c - ascii character literal
"\C[\C]", where C = {0, f, r, n, t, b}
"\xhh[\xhh]", "\uhhhh[\uhhhh]", "\Uhhhhhh[\Uhhhhhh]", where h = {0-9, a-f}
Predicates
string?
Equality
eq?, eqv? - identity
equal? - value
Evaluates to
Itself

Number

Abstract number

Literals
Sum of literals of Integer_, Fractional_, Real_, and Complex_ numbers.
Predicates
number?
Equality
eq? - identity
eqv?, equal? - value
Evaluates to
Itself

Integer

Arbitrary length integer number. It is the only exact number in PScheme. Implemented using Python's long numbers.

Literals
[+/-]ddd
Predicates
number?, exact?
Equality
eq? - identity
eqv?, equal? - value
Evaluates to
Itself

Rational

Not implemented.

Real

A floating point number. Implemented using Python's float numbers.

Literals
[+/-]ddd.ddd[e[+/-]d+]
Predicates
number?, exact?
Equality
eq? - identity
eqv?, equal? - value
Evaluates to
Itself

Complex

Complex Number

t.b.d.

Null

An empty list.

Literals
'()
(quote ())
Predicates
null?, list?
Equality
eq? - identity
eqv?, equal? - value
Evaluates to
Itself

Pair

A pair of two objects or a list if terminated with Null.

Literals
'(a . b)
'(a a-pair)
'(a [a])
Predicates
pair?
list?, if terminated with Null
Equality
eq?, eqv? - identity
equal? - value
Evaluates to
Itself

Symbol

An identifier.

Literals
'name
Predicates
symbol?
Equality
eq?, eqv?, equal? - identity
Evaluates to
Itself

Variable

A symbol, which was previously defined or bound to a value and was not quoted evaluates to that value.

Literals
name
Predicates
same as for the type of the returned value
Equality
depends on the type of the returned value
Evaluates to
An earlier defined or bound value. Follows lexical scoping.

Procedure

An object representing a procedure - a snippet of code that when applied to a list of arguments executes the code and returns a value.

Literals
Same as Symbol, which was earlier bound to a Procedure object.
Predicates
procedure?
Equality
eq?, eqv?, equal? - identity
Evaluates to
Itself

Procedure application

Literals
(procedure_name [list_of_arguments])
Predicates
same as for the type of the returned value
Equality
depends on the type of the returned value
Evaluates to
A result of application of the Procedure to a list of arguments.
Clone this wiki locally