Ralf Hemmecke wrote:
> 
> Now having parametrized macros, I can write
> 
> rep x ==> (x@%) pretend Rep
> per x ==> (x@Rep) pretend %
> 
> and that seems to work. At least it compiled one file that uses it.
> 
> Naturally, I don't want to repeat these macros in every file. However, 
> if I replace the two macros in the .spad file by
> 
> )read mymacros.input
> 
> where mymacros.input just contains the rep+per lines, and then )compile, 
> I get an output as shown below. I get the same error message as if the 
> )read line wouldn't be there. Maybe the scope for macros from an input 
> file is not extended to the calling spad file?

Of course not.  Why would you expect this?  Interpreter macros
are different world from Spad compiler.  Also, you can not directly
use interpreter functions in Spad files,  why macros should be
different?.

Note that during build we compile all constructor separately,
and it is important they are indpendent, so I had no
motivation to support different way.  In the future we may
add support for ')include' directive, then overhead would be
reduced to single line, but I do not think we want to go
below that.

> Another issue. Should I be able to group macros like this (in a .spad file)?
> 
> macro
>      rep x == (x@%) pretend Rep
>      per x == (x@Rep) pretend %
> 
> At the moment I get
> 
>    >> Apparent user error:
>     Parsing error: illegal toplevel form

1) This form of macro is unsupported at top level (it works only
   inside implementation part.
2) I do not expect such "grouping" to work
3) When it works it is internally converted to '==>'

I would discourage using this form of macro definition -- it
just wastes potentially valuable syntax for trivial purpose.
AFAICS there are no uses of 'macro' in algebra.

-- 
                              Waldek Hebisch
[email protected] 

-- 
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.

Reply via email to