SketchyLISP Reference Manual - Copyright (C) 2005 Nils M Holm

7 Library Functions

7.1 Type Predicates

boolean? Check whether an expression X is a truth value. R5RS
list? Check if an expression is a (proper) list. R5RS
natural? Test whether a number is a natural number. Core
symbol? Check whether an expression is a symbol. R5RS

7.2 List Functions

append Append lists. R5RS
assoc Retrieve a binding from an association list. R5RS
assq Retrieve a binding from an association list. R5RS
caaaar ... cddddr Access elements of nested lists. R5RS
caaar ... cdddr Access elements of nested lists. R5RS
caar ... cddr Access elements of nested lists. R5RS
count Recursively count the atoms of a list. Ext.
depth Compute the depth of a list. Ext.
equal? Compare two S-expressions. R5RS
filter Extract members from a list that match a given predicate. Ext.
head? Check whether an expression X is the head of an expression Y. Ext.
insert Insert a member into an ordered list. Ext.
iota Generate a sequence of natural numbers. Ext.
isort Sort a list using insertion sort. Ext.
iterate Iterate through a list. Core
last Extract the last member of a list. Ext.
length Compute the length of a list. R5RS
list-ref Extract the n'th member of a list. R5RS
list-tail Extract the tail of a list beginning at the n'th member of that list. R5RS
map Map N lists to one using an N-ary function F. R5RS
maplist Apply a function to each CDR of a list. Ext.
member Check whether a list has a member that is equal to a given S-expression. R5RS
memq Check whether a list has a member that is identical to a given symbol. R5RS
not-equal? Compare two lists (S-expressions, in fact) with negative result. Ext.
ordered? Check whether the members of a list are in a given monotonic order. Ext.
pair Build an association list from two lists. Ext.
quicksort Sort a list using the Quicksort algorithm. Ext.
reduce Reduce a list. Ext.
remove Remove members from lists. Ext.
reverse Reverse the order of members of a list. R5RS
sort Sort a list. Ext.
sublist Substitute variables in S-expressions. Ext.
subst Substitute X for each occurence of Y in Z. Ext.
tail? Check if an expression X is the tail of an expression Y. Ext.
unsort Generate some entropy by un-sorting a list of natural numbers. Ext.

7.3 Logic and Combinatoric Functions

any? Verify that at least one member of a list has a given property. Ext.
every? Verify that all members of a list have a given property. Ext.
id Express identity. Core
intersection Compute the intersection of two sets. Ext.
logand Logical product (AND). Core
logeqv Logical equivalence (EQV). Core
lognand Logical negative product (NAND). Core
logneqv Logical negative equivalence (XOR). Core
lognor Logical negative sum (NOR). Core
lognot Logical negation (NOT). Core
logor Logical sum (OR). Core
member? Check whether a list has a member that is equal to a given S-expression. Ext.
memq? Check whether a list has a member that is equal to a given symbol. Ext.
neq? Negative identity. Ext.
not Logical negation (NOT). R5RS
permute Generate permutations of a set. Ext.
some Extract the tail of a list where the first member of the tail has a given property. Ext.
union Compute the union of two sets. Ext.
unique Transform a list into a set (a list containing only unique elements). Ext.

7.4 Numeric Functions

* Multiply numbers. R5RS
+ Add numbers. R5RS
- Subtract numbers. R5RS
< Check whether two or more numbers are in ascending order. R5RS
<= Check whether two or more numbers are in non-ascending order. R5RS
= Check whether two or more numbers are equal. R5RS
> Check whether two or more numbers are in descending order. R5RS
>= Check whether two or more numbers are in non-ascending order. R5RS
abs Compute the absolute value of a number. R5RS
digits Constants for representing decimal digits. Core
divide Divide two numbers, giving a result of the form (quotient remainder). Core
even? Test a number N for being even (N modulo 2 = 0) R5RS
expt Compute the X raised to the power of Y. R5RS
fact Compute X!. Ext.
gcd Compute the greatest common divisor (GCD) of two integer numbers. R5RS
integer Convert a natural or integer number to an integer. Core
lcm Compute the least common multiple (LCM) of two integer numbers. R5RS
list->number Convert a number to a list of digits. Core
max Find the maximum of a list of numbers. R5RS
min Find the minimum of a list of numbers. R5RS
modulo Compute the modulo of two numbers. R5RS
natural Convert an integer or natural number to a natural number. Core
ndivide Divide two natural numbers, giving a result of the form (quotient remainder). Core
negate Compute the negative value of a number. Core
negative? Check whether a number is negative. R5RS
nexpt Compute the X raised to the power of Y. Core
n> Check whether two natural numbers are in descending order. Core
n>= Check if two natural numbers are in non-ascending order. Core
n< Check if two natural numbers are in ascending order. Core
n<= Check whether two natural numbers are in non-descending order. Core
n- Subtract two natural numbers. Core
non-negative? Check whether a number is positive or zero. Core
normalize Normalize a number by removing leading zeroes and plus signs. Core
n+ Add two natural numbers. Core
nqoutient Divide two natural numbers. Core
nremainder Compute the remainder of the division of two natural numbers. Core
n* Compute the product of two natural numbers. Core
number->list Convert a list of digits to a number. Core
odd? Test a number N for being odd (N modulo 2 = 1). R5RS
one? Test a number for being one. Ext.
hyper Compute A hyperN B. Ext.
positive? Check whether a number is positive. R5RS
pred Find the predecessor of a decimal digit. Core
product Compute the product of a sequence of positive numbers. Ext.
quotient Divide two numbers, returning their integer quotient. R5RS
remainder Compute the remainder of the integer division of two numbers. R5RS
sqrt Compute the square root of a natural number. R5RS
succ Find the successor of a decimal digit. Core
sum Compute the sum of a sequence of positive numbers. Ext.
zero? Test a number for being zero. R5RS

7.5 Library Loaders

sketchy Load the SketchyLISP core library into memory. Core
sketchy-ext Load the SketchyLISP extension library into memory. Ext.