install

tutorials

- Java API

- Java + LISP

- Lisp Repl

- Assembler

Javadoc

Lisp manual

fun4j - functional programming for the JVM

Reference of Lisp functions and special forms

NameDescription
+(+ a1 a2 ... an) computes the sum of a1 + a2 + ... + an.
add1(add1 m) computes m + 1. m an n must be Integers or BigIntegers
and(and a b) returns true if both a and b return true, else false. a and b must return true or false.
atom?(atom? x) returns false if x is a Cons Object or null. True for Strings, Numbers and compiled Functions.
bigints(bigints true) advices the compiler to generate BigInteger code for all arithmetic operations. (bigints false) advices the compiler to generate Integer code for all arithmetic operations.
car(car (cons x xs)) returns x, where (cons x xs) returns a Cons Object with head x and tail xs.
cdr(cdr (cons x xs)) returns xs, where (cons x xs) is a Cons Object with head x and tail xs.
caar(caar x) is equivalent to (car (car x)).
cadr(cadr x) is equivalent to (car (cdr x)).
cdar(cdar x) is equivalent to (cdr (car x)).
cddr(cddr x) is equivalent to (cdr (cdr x)).
compile(compile x) explicitely compiles the expression x
compiled?(compiled? x) returns true if x is a compiled function, else false
cons(cons x y) returns a new Cons object with head x and tail y.
::equivalent to cons
debug-enable(debug-enable true) will advice the compiler to write .lsp files for AST-Pseudocode and .class files for the generated Java bytecode. It will also trigger the generation of JVM debugging bytecode.
define(define symbol value) binds symbol to value in the global lisp environment.
/(/ m n) divides m by n. m an n must be Integers or BigIntegers.
.(. class-or-instance field-or-method args*)the Dot operator allows to access Java class and instances.
eq(eq a b) returns true if a and b are equal, else false.
explode(explode symbol) explodes a string or symbol to a list of characters.
>(> m n) returns true if m is greater than n. m an n must be Integers or BigIntegers
>=(>= m n) returns true if m is greater or than or equal to n. m an n must be Integers or BigIntegers
hdequivalent to car.
if(if test thenDo elseDo) evaluates to thenDo if test evaluates to true, else elseDo is returned.
implode(implode list) forms a new symbol from list a list of single characters.
javafunctionIf qualified.classname represents a Java class implementing the org.fun4j.Function interface then (javafunction qualified.classname) returns an instance of that class, that is a function object. This function can be used as any other Lisp function.
lambda(lambda (list of vars) body) is a lisp special. it evaluates to itself. It represents an anonymous function.
\(\ (list of vars) body) short form for lambda.
<(< m n) returns true if m is smaller than n. m an n must be Integers or BigIntegers
<=(<= m n) returns true if m is smaller or than or equal to n. m an n must be Integers or BigIntegers
list?(list? x) returns true if x is null or a cons-expression, else false.
load(load filename) loads a lisp file named filename and evaluates all lisp expressions in that file.
lookup(lookup symbol) looks up symbol in the global environment.
*(* a1 a2 ... an) computes the product a1 * a2 * ... * an.
not(not a) returns true if a evaluates to false, else false.
null?(null? x) returns true if x is null, else false
number?(number? x) returns true if x is number, else false.
=(= m n) returns true if m equals n. m an n must be Integers or BigIntegers.
or(or a b) returns true if a or b evaluate to true, else false.
prin(prin x) prints out x, without adding a linefeed.
print(print x) prints out x, and adds a linefeed.
printdepth(printdepth n) sets the list printdepth to n
printlength(printlength n) sets the list printlength to n
quotequote is a special lisp form. It does not evaluate it's argument, but returns it as is. (quote x) returns x unevaluated.
read(read) reads a lisp expresion from standard in.
%(% m n) computes the remainder of the integer division of (/ m n).
staticfunctionThis function can be best explained by an example: (staticfunction 'java.lang.System 'getProperties "()Ljava/util/Properties;" ) this returns a function wrapping a call to System.getProperties().
-(- m n) computes the difference of m and n. m an n must be Integers or BigIntegers.
sub1(sub1 m) computes m - 1. m must be an Integer or a BigInteger.
symbol?(symbol? x) returns true if x is a symbol, else false.
tl equivalent to cdr.
tracing(tracing a) enables tracing of lisp function calls if a evaluates to true, else tracing will be disabled.