Hi,
I'm used to parametrized macros. Are they available in SPAD?
The following program seems to suggest NO, but it also seems to contain
a bug, since it compiles with X which is nowhere defined.
---rhxBEGIN tst.spad
EXX ==> Expression X
EX Y ==> Expression Y
fooz z ==> 2*z+3^z
)abbrev category CATX CatX
CatX(R: Ring): Category == with
foo: EXX -> Integer
)abbrev category CATY CatY
CatY(R: Ring): Category == with
foo2: EX R -> Integer
)abbrev domain MINT MyInteger
MyInteger: IntegerNumberSystem with
baz: Integer -> Integer
== Integer add
-- fooz z ==> 2*z+3^z
baz(x: Integer): Integer == fooz x
---rhxEND tst.spad
Compilation aborts with the following message.
MINT abbreviates domain MyInteger
------------------------------------------------------------------------
initializing NRLIB MINT for MyInteger
compiling into NRLIB MINT
compiling exported baz : Integer -> Integer
****** comp fails at level 1 with expression: ******
error in function baz
((|fooz| |x|))
****** level 1 ******
$x:= (fooz x)
$m:= (Integer)
$f:=
((((|x| # #) (* #) (+ #) (- #) ...)))
>> Apparent user error:
cannot compile (fooz x)
==============================
When "fooz z ==> 2*z+3^z" is mooved inside the "add" part of MINT, the
error message is different. Why?
****** comp fails at level 3 with expression: ******
error in function baz
((+ (* 2 | << z >> |) (^ 3 |z|)) |x|)
****** level 3 ******
$x:= z
$m:= $EmptyMode
$f:=
((((|x| # #) (* #) (+ #) (- #) ...)))
>> Apparent user error:
Cannot coerce 2
of mode (PositiveInteger)
to mode $
==============================
The compilation also shows
--->/home/hemmecke/p/tst.spad-->CatX((foo ((Integer) (Expression X)))):
Not documented!!!!
--->/home/hemmecke/p/tst.spad-->CatY((foo2 ((Integer) (EX R)))): Not
documented!!!!
for CatX and CatY respectively, i.e. EXX seems to have been expanded to
Expression X, but EX R is left untouched and not expanded to Expression R.
Can I somehow get paremetrized macros like in Aldor? According to the
Axiom book (Chapter 6.2) parametrized macros should be available, but I
guess that only applies to the interpreter.
Ralf
Ralf
--
You received this message because you are subscribed to the Google Groups "FriCAS -
computer algebra system" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/fricas-devel?hl=en.