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?

Martin B

--
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 fricas-devel+unsubscr...@googlegroups.com.
To post to this group, send email to fricas-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to