mkfunc.spad line 1 [edit on github]
Domain of parsed forms which can be passed to the interpreter. This is also the interface between algebra code and facilities in the interpreter.
a * b
returns the input form corresponding to a * b
.
a + b
returns the input form corresponding to a + b
.
a / b
returns the input form corresponding to a / b
.
0
returns the input form corresponding to 0.
1
returns the input form corresponding to 1.
a ^ b
returns the input form corresponding to a ^ b
.
a ^ b
returns the input form corresponding to a ^ b
.
binary(op, [a1, ..., an])
returns the input form corresponding to a1 op a2 op ... op an
.
compile(f, [t1, ..., tn])
forces the interpreter to compile the function f
with signature (t1, ..., tn) -> ?
. returns the symbol f
if successful. Error: if f
was not defined beforehand in the interpreter, or if the ti
's
are not valid types, or if the compiler fails.
convert(s)
makes s
into an input form.
declare(t)
returns a name f
such that f
has been declared to the interpreter to be of type t
, but has not been assigned a value yet. Note: t
should be created as devaluate(T)$Lisp
where T
is the actual type of f
(this hack is required for the case where T
is a mapping type).
flatten(s)
returns an input form corresponding to s
with all the nested operations flattened to triples using new local variables. If s
is a piece of code, this speeds up the compilation tremendously later on.
function(code, [x1, ..., xn], f)
returns the input form corresponding to f(x1, ..., xn) == code
.
interpret(f)
passes f
to the interpreter.
interpret_in_new_env(f)
evaluates f
in the interpreter using fresh environment which is discarded after evaluation
lambda(code, [x1, ..., xn])
returns the input form corresponding to (x1, ..., xn) +-> code
if n > 1
, or to x1 +-> code
if n = 1
.
parse(s)
is the inverse of unparse. It parses a string to InputForm
unparse(f)
returns a string s
such that the parser would transform s
to f
. Error: if f
is not the parsed form of a string.