On 01/16/2012 08:02 PM, Waldek Hebisch wrote:
I have now commited support for parametrized macros.

Wow! That was quick! Big thanks from me!

Waldek, I hope you don't mind if I keep asking for things that I would find useful.

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?

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


Ralf

(20) -> )co mex.spad
   Compiling FriCAS source code from file
      /home/hemmecke/p/mex.spad using old system
      compiler.
rep x ==> (x@%) pretend Rep


Type: Void
per x ==> (x@Rep) pretend %


Type: Void
   MEX abbreviates domain MExpression
------------------------------------------------------------------------
   initializing NRLIB MEX for MExpression
   compiling into NRLIB MEX
(converted function Rep to macro)
   compiling local args : $ -> List $
****** comp fails at level 5 with expression: ******
error in function args

(COLLECT (IN |a| (|argument| (|first| (|kernels| | << | (|rep| |x|) | >> |))))
         (|per| |a|))
****** level 5  ******
$x:= (rep x)
$m:= $EmptyMode
$f:=
((((|x| # . #1=#) (|args| #) (|x| . #1#) (|args| #) ...)))

   >> Apparent user error:
   cannot compile (rep x)


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