Lisp is the underlying runtime environment and SPAD relies on direct calls to Lisp to provide basic functionality. The names of these function calls end with $Lisp.
I am searching through the FriCAS library code to find what Lisp functions are called from SPAD code.
As Waldek Hebisch explains here the $Lisp calls are of 3 types
- Wrapping Lisp functionality to make it available as Spad functions.
- System interface such as accessing files.
- What Waldek describes as 'interpreter functions' this code is independent and could equally well be written in SPAD.
If you look at top users of '$Lisp' calls you will see:
- ../algebra/omdev.spad.pamphlet:59
- ../algebra/fortran.spad.pamphlet:57
- ../algebra/sf.spad.pamphlet:56
- ../algebra/files.spad.pamphlet:55
- ../algebra/si.spad.pamphlet:54
- ../algebra/u32vec.spad.pamphlet:41
- ../algebra/list.spad.pamphlet:39
- ../algebra/string.spad.pamphlet:36
- ../algebra/integer.spad.pamphlet:35
- ../algebra/mathml.spad.pamphlet:32
- ../algebra/boolean.spad.pamphlet:24
- ../algebra/numarr.spad.pamphlet:22
Most of them wrap Lisp functionality and make it available as Spad functions. For example in sf.spad we have
x + y == add_DF(x, y)$Lisp
This effectively tells Spad compiler how to add machine floats. _All_ other places in algebra which want to add machine floats should use '+' from DoubleFloat instead of calling underlying Lisp operation. Operation like this form largest and most important group, basically anything we do with integers, machine floats, booleans, stings, lists will end up being performed as one or more Lisp operations. So all primitive operations are taken from Lisp and other are written in terms of primitives (via Spad wrappers). Normally you should have no need to directly use Lisp primitives, because you can get the same effect from Spad operations. Of course, you need Lisp primitives when you want to add new basic type, but then you need _new_ primitives specially written for your new type.
Other group of operations are ones which form system interface. Such operations form bulk of '$Lisp' calls in 'files.spad'.
Next, there are calls to interpreter functions. Those are candidates for replacements by Spad code. In principle user may want to call them. Note however that functions which looked useful are typically exposed via Spad interface. Also, technically it is possible to call from Spad arbitrary interpreter function and there is no reason to think that functions already called are more likely to be called than other. So when you think about documenting such calls for possible uses, you really have task of documenting interpreter functions.
These are my results so far:
Lisp Functions
Here are some Lisp functions which can be called from SPAD
lisp function | Called from Pamphlet | information |
---|---|---|
sayTeX$Lisp "hello" | Description
|
|
mathObject2String$Lisp | Description
|
|
ATOM(expr)$Lisp | Descriptionbreak down an expression into atoms |
|
trapNumericErrors(ff)$Lisp | Description
ExamplemyTrap1(ff:DF-> DF, f:DF):DF == |
|
outputTran$Lisp | Description |
|
COMPLEXP(x)$Lisp | DescriptionTest if x is complex number |
|
EQ(a, b)$Lisp |
aggcat any boolean |
Descriptiontests if parameters are same objects Signature(%, %) -> Boolean Exampleeq?(a, b) == EQ(a, b)$Lisp |
NIL$Lisp | aggcat2 |
Description
Examplei := minIndex(w := new(#l, NIL$Lisp)$B) |
assignSymbol(x,f,%)$Lisp | algfunc | Description
Exampleassign(x, f) == (assignSymbol(x, f, %)$Lisp; f) |
dbName(x)$Lisp | alqi | Description
Examplename : OutputForm := dbName(x)$Lisp |
dbPart(x, 4, x)$Lisp | alqi | Description
Exampletype : OutputForm := dbPart(x, 4, 1$Lisp)$Lisp |
1$Lisp (or other number such as 0) |
alqi array1 |
Description
Exampletype : OutputForm := dbPart(x, 4, 1$Lisp)$Lisp |
hconcat | alqi | Description
Examplehconcat(alqlGetOrigin(x$Lisp)$Lisp |
x$Lisp (where x is a string) |
alqi | Description
Examplex$Lisp |
alqlGetParams(par)$Lisp | alqi | Description
ExamplealqlGetParams(x$Lisp)$Lisp |
SUBSTRING(part, 0, 1)$Lisp | alqi | Description
ExampleString := SUBSTRING(dbPart(x, 3, 1)$Lisp, 0, 1)$Lisp |
PNAME(sel)$Lisp | alqi | Description
ExamplePNAME(sel)$Lisp |
alqlGetKindString(x)$Lisp | alqi | Description
Examples = "kind" => alqlGetKindString(x)$Lisp |
alqlGetOrigin(x)$Lisp | alqi | Description
Examples = "origin" => alqlGetOrigin(x)$Lisp |
alqlGetParams(x)$Lisp | alqi | Description
Examples = "params" => alqlGetParams(x)$Lisp |
dbComments(x)$Lisp | alqi | Description
Examples = "doc" => dbComments(x)$Lisp |
stringMatches?(val, x.field)$Lisp | alqi | Description
ExamplestringMatches?(val, x.field)$Lisp |
getBrowseDatabase(s)$Lisp | alqi | Description
ExamplegetDatabase(s) == getBrowseDatabase(s)$Lisp |
QSMULMOD32$Lisp | amodgcd | Description
ExampleQmul ==> QSMULMOD32$Lisp |
QSMULADDMOD64_-32$Lisp | amodgcd | Description
ExampleQmuladd ==> QSMULADDMOD64_-32$Lisp |
SETF$Lisp | amodgcd | Description
Example(SETF$Lisp)(xr, xr) pretend MP |
evalType(dx)$Lisp | any | Description
ExampleDx : Type := evalType(dx)$Lisp |
spad2BootCoerce(x.ob, x.dm, list)$Lisp |
any | Description
Examplespad2BootCoerce(x.ob, x.dm, |
prefix2String(dev)$Lisp | any | Description
Examplep : Symbol := prefix2String(devaluate(x.dm)$Lisp)$Lisp |
devaluate(x.dm)$Lisp | any | Description
Examplep : Symbol := prefix2String(devaluate(x.dm)$Lisp)$Lisp |
isValidType(domain)$Lisp | any | Description
Example(isValidType(domain)$Lisp)@Boolean |
QVMAXINDEX$Lisp |
array1 | Description
ExampleQmax ==> QVMAXINDEX$Lisp |
QVSIZE$Lisp | array1 | Description
ExampleQsize ==> QVSIZE$Lisp |
QAREF1$Lisp | array1 | Description
ExampleQelt ==> QAREF1$Lisp |
QSETAREF1$Lisp | array1 | Description
ExampleQsetelt ==> QSETAREF1$Lisp |
MAKE_-ARRAY$Lisp | array1 | Description
ExampleQnew ==> MAKE_-ARRAY$Lisp |
MAKEARR1$Lisp | array1 | Description
ExampleQnew1 ==> MAKEARR1$Lisp |
less_SI(i, num)$Lisp | array1 | Description
Exampleless_SI(i, 1$Lisp)$Lisp |
QAREF1O$Lisp |
array1 | Description
ExampleQelt1 ==> QAREF1O$Lisp |
QSETAREF1O$Lisp | array1 | Description
ExampleQSETAREF1O$Lisp |
MATRIX_SIZE$Lisp | array2 | Description
ExampleQsize ==> MATRIX_SIZE$Lisp |
MAKE_MATRIX$Lisp |
array2 | Description
ExampleQnew ==> MAKE_MATRIX$Lisp |
MAKE_MATRIX1$Lisp | array2 | Description
ExampleQnew1 ==> MAKE_MATRIX1$Lisp |
ANROWS$Lisp |
array2 | Description
ExampleQnrows ==> ANROWS$Lisp |
ANCOLS$Lisp |
array2 | Description
ExampleQncols ==> ANCOLS$Lisp |
QAREF2O$Lisp | array2 | Description
ExampleQelt2 ==> QAREF2O$Lisp |
QSETAREF2O$Lisp | array2 | Description
ExampleQsetelt2 ==> QSETAREF2O$Lisp |
LAST$Lisp | bags | Description
ExamplelastTail==> LAST$Lisp |
NOT(b)$Lisp | boolean | Description
Examplenot b == NOT(b)$Lisp |
AND(a, b)$Lisp | boolean | Description
Example_/_\(a, b) == AND(a, b)$Lisp |
OR(a, b)$Lisp | boolean | Description
Example_\_/(a, b) == OR(a, b)$Lisp |
BooleanEquality(a, b)$Lisp | boolean | Description
Examplea = b == BooleanEquality(a, b)$Lisp |
bool_to_bit(b)$Lisp | boolean | Description
Examplenew(n, b) == make_BVEC(n, bool_to_bit(b)$Lisp)$Lisp |
make_BVEC(n,bool)$Lisp | boolean | Description
Examplenew(n, b) == make_BVEC(n, bool_to_bit(b)$Lisp)$Lisp |
copy_BVEC(v)$Lisp | boolean | Description
Examplecopy v == copy_BVEC(v)$Lisp |
size_BVEC(v)$Lisp | boolean | Description
Example#v == size_BVEC(v)$Lisp |
equal_BVEC(v, u)$Lisp | boolean | Description
Examplev = u == equal_BVEC(v, u)$Lisp |
and_BVEC(v, u)$Lisp | boolean | Description
Exampleand_BVEC(v, u)$Lisp |
or_BVEC(v, u)$Lisp | boolean | Description
Exampleor_BVEC(v, u)$Lisp |
xor_BVEC(v, u)$Lisp | boolean | Description
Examplexor_BVEC(v, u)$Lisp |
SETELT_BVEC(v, range, bit)$Lisp | boolean | Description
ExampleSETELT_BVEC(v, range(v, i - mn), bool_to_bit(f)$Lisp)$Lisp |
ELT_BVEC(v, range)$Lisp | boolean | Description
ExampleELT_BVEC(v, range(v, i - mn))$Lisp |
not_BVEC(v)$Lisp | boolean | Description
Examplenot_BVEC(v)$Lisp |
devaluate(S)$Lisp::OutputForm | Description'devaluate' produces "type name", which uniquely identifies type. The name suggests that is is inverse of 'evaluate'. Actually you can massage result of 'devaluate' and pass to Lisp 'eval' to get the same type. But 'devaluate' does _not_ produce OutputForm, namely, result of 'devaluate' contains raw representation of parameters which in general need to be converted to OutputForm. Examplesee this thread |
|
outputDomainConstructor(S)$Lisp | Descriptionobtain the name (domain expression) of a domain as a OutputForm in SPAD 'outputDomainConstructor' calls 'devalute', but needs to do extra work. There are same tricky corner cases when printing types. 'outputDomainConstructor' is supposed to know how to handle them. Any method of printing types which does not ultimately go via 'outputDomainConstructor' is buggy or is likely to be broken by future changes. Examplesee this thread |
|
Description
Example
|