Maybe enough of this "interpreter magic" is in the 'form2String' function.

(1) -> )r /home/wspage/typeof

typeof(t:Any):OutputForm ==
  if #(dom t)>1 then
    hconcat(destruct form2String(dom t)$Lisp :: List OutputForm)
  else
    form2String(dom t)$Lisp

   Function declaration typeof : Any -> OutputForm has been added to
      workspace.
                                                                   Type: Void
(2) ->  ts := taylor(x, x=1)

   (2)  1 + (x - 1)
                        Type: UnivariateTaylorSeries(Expression(Integer),x,1)
(3) -> t1:=-1

   (3)  - 1
                                                                Type: Integer
(4) -> s:="sss"

   (4)  "sss"
                                                                 Type: String
(5) -> m:=matrix([[1]])

   (5)  [1]
                                                        Type: Matrix(Integer)
(6) -> p:=x+1

   (6)  x + 1
                                                    Type: Polynomial(Integer)
(7) -> typeof(ts)
   Compiling function typeof with type Any -> OutputForm

   (7)  UnivariateTaylorSeries(Expression(Integer),x,1)
                                                             Type: OutputForm
(8) -> typeof(t1)

   (8)  Integer
                                                             Type: OutputForm
(9) -> typeof(s)

   (9)  String
                                                             Type: OutputForm
(10) -> typeof(m)

   (10)  Matrix(Integer)
                                                             Type: OutputForm
(11) -> typeof(p)

   (11)  Polynomial(Integer)
                                                             Type: OutputForm

'form2String' could probably best be called from

On 18 August 2016 at 18:18, Waldek Hebisch <[email protected]> wrote:
>
> There are known bugs in printing routines.  They are hard to fix
> because printing routines may get several similar, but subtly different
> things:
> - trees from interpreter parser
> - compiler internal forms
> - forms repesenting interpreter values (that includes types)
> - OutputForm
> - HyperDoc forms (few different kinds)
>
> Making sure that data arriving at given place has consistent
> representation is a substantial work (part of this is done,
> but a lot remins to do).  Let me add that printing routines
> may be used to print error messages during typechecking,
> so it is important to print _something_ without crashing
> on incorrect data.
>

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

Reply via email to