On 18/09/16 18:41, Waldek Hebisch wrote:
Martin Baker wrote:


Thanks for applying previous patch.

When you did this you made some changes and one of these changes
introduced a bug, so here is a fix for this bug:

I got caught by Spad weirdness.  In Spad

   "string"::OutputForm

is the same as

   "string"@OutputForm

which gives the same result as

   message("string")

that is without string quotes.  OTOH
   ss : String := "string"
   ss::OutputForm

is the same as interpreter "string"::OutputForm and adds
string quote.  I am thinking about removing the special
handling of '"string"@OutputForm' from Spad compiler.
There seem to be several uses of this in algebra, so there
is some work adjusting.  But still I think that removing this
irregularity is better.

Waldek,

I think the main problem is much simpler than that, its not doing anything with the result, it should assign it to variable 's'. So it gives empty output like this:

(1) -> UNTYP := SKICombinators Untyped

   (1)  SKICombinators(Untyped)
                                      Type: Type
(2) -> m1 := I()$UNTYP

   (2)
                                      Type:SKICombinators(Untyped)

but it should give output like this:

(2) -> m1 := I()$UNTYP

   (2)  I
                                      Type:SKICombinators(Untyped)

I think the code should be like this:

  -- output
  coerce(n : %) : OutputForm ==
      s : OutputForm := empty()$OutputForm
      if n case lf then
          -- leaf node so print I, K or S
          s := (n.lf)::OutputForm -- **need to assign to s here **
      if n case nd then
          -- binary node which has two subnodes c1 and c2
          if atom?(n.nd.c2) then
              if variable?(n.nd.c2) then
                  s := hconcat([s,_
                                (n.nd.c1)::OutputForm,_
                                message(" "),_
                                (n.nd.c2)::OutputForm])$OutputForm
              else
                  s := hconcat([s, (n.nd.c1)::OutputForm,
                                (n.nd.c2)::OutputForm])$OutputForm
          else
              s := hconcat([s,(n.nd.c1)::OutputForm,message("("),_
             (n.nd.c2)::OutputForm,message(")")])$OutputForm
      if n case vr then
          -- variable node so print name
          s := (n.vr)::OutputForm
      s

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