All Packages Class Hierarchy This Package Previous Next Index
java.lang.Object | +----Jaja.Jaja | +----Jaja.Value | +----Jaja.Procedure
procedure?
predicate, they rather are the Java methods
that implement the Jaja primitives. You may use directly those
behaviors that have a fixed arity by saying
Procedure.cons(aValue, anotherValue) or simply as
car(aValue) if inheriting from the Procedure class. If the
arity is variant, these are n-ary functions, then write
list(anArrayOfValues) instead.
No explicit error checking is done that is, we leave to Java to take care of the validity of cast or message sending. Therefore we do not need a special Exception class nor we have to explicit that these procedures may throw RuntimeExceptions.
Most of the implementation lies in the functions here and not
in the classes that define the associated data (ie car
is there and not in Pair.java). This is to avoid indirections (as
well as name clashes: the static car method cannot be
defined in Pair that already contains a car field). Since
Scheme is not statically typed, all these functions take Values and
return Values. Arguments are appropriately cast in their definition
(these casts are checked by Java).
The invocation mechanism is pretty complex. The shape of a call to a procedure p depends on the number of arguments. Only invocations up to ten arguments are considered. Invocations with strictly more than 3 arguments pass through an array of arguments otherwise the procedure is invoked with that number of arguments.
Arity checking is done by Java. All methods that follow are default methods and must be refined according to the type of the procedure (@see Subr2 for instance that refines the invoke method for two arguments).
apply
can only manages up to ten arguments.
callep
is a call/cc
reduced to its
dynamic extent.
public Procedure()
public Value invoke()
public Value invoke(Value a)
public Value invoke(Value a, Value b)
public Value invoke(Value a, Value b, Value c)
public Value invoke(Value a, Value b, Value c, Value d)
public Value invoke(Value a, Value b, Value c, Value d, Value e)
public Value invoke(Value a, Value b, Value c, Value d, Value e, Value f)
public Value invoke(Value a, Value b, Value c, Value d, Value e, Value f, Value g)
public Value invoke(Value a, Value b, Value c, Value d, Value e, Value f, Value g, Value h)
public Value invoke(Value a, Value b, Value c, Value d, Value e, Value f, Value g, Value h, Value i)
public Value invoke(Value a, Value b, Value c, Value d, Value e, Value f, Value g, Value h, Value i, Value j)
public Value invoke(Value args[])
public static Value car(Value a)
public static Value cdr(Value a)
public static Value cons(Value a, Value d)
public static Value set_car(Value p, Value a)
public static Value set_cdr(Value p, Value a)
public static Value list(Value args[])
public static Value eqp(Value a, Value b)
public static Value equalp(Value a, Value b)
public static Value pairp(Value a)
public static Value nullp(Value a)
public static Value symbolp(Value a)
public static Value stringp(Value a)
public static Value numberp(Value a)
public static Value fixnump(Value a)
public static Value floatnump(Value a)
public static Value procedurep(Value a)
public static Value booleanp(Value a)
public static Value charp(Value a)
public static Value eofp(Value a)
public static Value symbol_to_string(Value a)
public static Value plus(Value args[])
public static Value minus(Value a, Value b)
public static Value times(Value args[])
public static Value divide(Value a, Value b)
public static Value quotient(Value a, Value b)
public static Value remainder(Value a, Value b)
public static Value modulo(Value a, Value b)
public static Value lep(Value a, Value b)
public static Value gep(Value a, Value b)
public static Value eqnp(Value a, Value b)
public static Value ltp(Value a, Value b)
public static Value gtp(Value a, Value b)
public static Value vectorp(Value arg1)
public static Value make_vector(Value args[])
public static Value vector_ref(Value v, Value i)
public static Value vector_set(Value v, Value i, Value o)
public static Value vector_length(Value v)
public static Value vector(Value args[])
public static Value integer_to_char(Value n)
public static Value char_to_integer(Value c)
public static Value string_length(Value s)
public static Value string_ref(Value s, Value i)
public static Value string_set(Value s, Value i, Value c)
public static Value make_string(Value args[])
public static Value string(Value args[])
public static Value string_to_symbol(Value arg1)
public static Value read(Value args[])
public static Value display(Value args[])
public static Value write(Value args[])
public static Value newline(Value args[])
public static Value current_input_port()
public static Value current_output_port()
public static Value open_input_file(Value s)
public static Value open_output_file(Value s)
public static Value close_port(Value p)
public static Value callep(Value arg)
callep
is a call/cc
reduced to its
dynamic extent.
public static Value apply(Value args[])
apply
can only manages up to ten arguments.
public static Value exit(Value arg1)
public static Value oblist()
public static Value detach(Value args[])
(detach! function arguments...)
spawns
a new thread in background and returns immediately. The
continuation of that invokation throws away the obtained value
and commits suicide. It is not possible to escape that
continuation. Nevertheless, this invokation shares the dynamic
environment of the invoker.
All Packages Class Hierarchy This Package Previous Next Index