Lispkit Lisp - Base Language

Base Language

The base language provides the following functions only but extensions are discussed in Henderson's book for the explicit support of lazy evaluation and non-deterministic programming.

atom
given an expression returns True if its value is atomic; False if not.
add
given two expressions returns the sum of their numeric values.
car
given an expression whose value is a pair, returns the pair's first value.
cdr
given an expression whose value is a pair, returns the pair's second value.
cons
given two expressions returns a value pair consisting of their values.
div
given two expressions returns the dividend of their numeric values.
eq
given two expressions returns True if their values are equal; False if not.
if
given three expressions returns the value of the second if the value of the first is True, otherwise returns the value of the third.
lambda
given an expression, returns that expression as an evaluable value.
let
given a list of named expressions, returns that list as a single evaluable value.
letrec
given a list of named expressions, returns that list as a single evaluable value.
leq
given two expressions, returns True if the value of the first is numerically less than or equal to the value of the second; False if not.
mod (or rem)
given two expressions, returns the modulus (also known as the remainder) of their numeric values.
mul
given two expressions, returns the product of their numeric values.
quote
given an expression, returns that expression as a value.
sub
given two expressions, returns the difference of their numeric values.

The functions, lambda, let, and letrec, are similar but have subtle differences in the way that they treat named variables which make them useful in different ways. lambda defines and returns a function, let binds expressions to variable names, and letrec is essentially similar to let except it allows for the definition of recursive functions.

Read more about this topic:  Lispkit Lisp

Famous quotes containing the words base and/or language:

    The base of all artistic genius is the power of conceiving humanity in a new, striking, rejoicing way, of putting a happy world of its own creation in place of the meaner world of common days, of generating around itself an atmosphere with a novel power of refraction, selecting, transforming, recombining the images it transmits, according to the choice of the imaginative intellect. In exercising this power, painting and poetry have a choice of subject almost unlimited.
    Walter Pater (1839–1894)

    Our goal as a parent is to give life to our children’s learning—to instruct, to teach, to help them develop self-discipline—an ordering of the self from the inside, not imposition from the outside. Any technique that does not give life to a child’s learning and leave a child’s dignity intact cannot be called discipline—it is punishment, no matter what language it is clothed in.
    Barbara Coloroso (20th century)