Hi Waldek,
I just realized that macro expansion in the interpreter works
differently than in the compiler.
%%% (253) -> to(C)(x,y) ==> (x::C) + (y::C)
%%% (254) -> foo(x: Integer): Integer == to(Integer)(3+x, 2*x)
Function declaration foo : Integer -> Integer has been added to
workspace.
%%% (255) -> foo(4)
Compiling function foo with type Integer -> Integer
(255) 15
Type: PositiveInteger
That kind of macro seem to work in the interpreter.
Unfortunately, it doesn't in SPAD, see below.
Is there any way to make that work?
I actually want even something like
mac(A,B)(x,y) ==> ...
and then use mac(U,V) as an argument in another macro.
Shouldn't that be possible?
It would make me sad if this does really not work in SPAD.
Ralf
====================================================
)abbrev domain FOO Foo
Foo(): with
foo: Integer -> Integer
== add
to(C)(x,y) ==> (x::C) + (y::C)
foo(x: Integer): Integer == to(Integer)(3+x, 2*x)
====================================================
%%% (253) -> )co ../foo
Compiling FriCAS source code from file
/home/hemmecke/backup/git/qeta/tmp/../foo.spad using old system
compiler.
FOO abbreviates domain Foo
------------------------------------------------------------------------
initializing NRLIB FOO for Foo
compiling into NRLIB FOO
processing macro definition (to C)(x,y) ==> +(::(x,C),::(y,C))
>> Apparent user error:
invalid macro call, #args ~= #margs
--
You received this message because you are subscribed to the Google Groups "FriCAS -
computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/fricas-devel/0ec59bde-20f5-4b31-a4cb-4a5de572e83e%40hemmecke.org.