Martin Baker wrote:
>
> On 15/09/16 19:49, Waldek Hebisch wrote:
> > Martin Baker wrote:
> >>
> >> Minor code changes to computation.spad
> >> 1) Change sayMsg to print.
> >> 2) Improve OutputForm, don't use string.
> >> 3) implement CoercibleTo(OutputForm).
> >
> > I see that you have a lot of code like:
> >
> > str::Symbol::OutputForm
> >
> > If you want to print string without quotes use 'message':
> >
> > message(str)
> >
> > gives you desired OutputForm. For nonconstant strings
> > this is more efficient and in all cases is clearer
> > than going via symbols.
>
> OK, I have done that.
>
> Updated file is here:
> https://github.com/martinbaker/multivector/blob/master/computation.spad
> and patch is here:
> https://github.com/martinbaker/multivector/blob/master/computation3.patch
>
> This compiles and works so, as far as I can tell, its ready to go. There
> is just one thing that I'm curious about. I now have lot of lines like this:
>
> print(message "warning I does not have a parameter to act on")
>
> This generates a compiler error like this:
>
> compiling exported coerce : SKICombinators UT -> ILogic
> ****** comp fails at level 11 with expression: ******
> error in function coerce
> <snip>
> ****** level 11 ******
> $x:= (message warning I does not have a parameter to act on)
> $m:= $EmptyMode
> $f:=
> ((((#:G6598 # #) (#:G6601 # #) (|s| # #) (|lambdaOverSki| #))
> ((|lambdaOverSki| #) (= #) (I #) (K #) ...)
> ((|Ski2Lambda| #) (= #) (|atom?| #) (|bind| #) ...)))
>
> >> Apparent user error:
> NoValueMode
> is an unknown mode
>
> I assume this is because there are 2 print functions with the same
> signature (although the error message gives no clue to this).
>
> So I changed the line to:
> print(message "warning I does not have a parameter to act on")$OutputForm
>
> and this makes the error go away.
>
> The interesting thing is, I only have to do this once (see line 2794 in
> code) and then all other similar functions compile without specifying
> domain. Its like I only have to tell the compiler which version of
> 'print' to use once and it then uses the same for all future 'print' calls.
>
> So, my questions are:
> 1) Are my suppositions correct?
> 2) If so, is it safe to rely on it?
No. The real thing is that Spad compiler considers only functions
from "visible" domains. Main way to make domain visible is to
import it:
import OutputForm
Currently Spad compiler performs implicit import in some situations.
In particular 'f()$Dom' as a byproduct imports Dom. This is a
misfeature and sooner or later will go away.
--
Waldek Hebisch
--
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 post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.