Re: Outputting S-expressions

[email protected] (Ludovic Courtès)
Newsgroups gmane.comp.mathematics.axiom.user
Organization LAAS-CNRS
Message-ID <[email protected]>
Hi,

Themos Tsikas <[email protected]> writes:

> (1) -> p:=(1+x)^5
>
>          5     4      3      2
>    (1)  x  + 5x  + 10x  + 10x  + 5x + 1
>                                                      Type: Polynomial Integer
> (2) -> VALUES(p)$Lisp
>
>    (2)  (1 x (5 0 . 1) (4 0 . 5) (3 0 . 10) (2 0 . 10) (1 0 . 5) (0 0 . 1))
>                                                             Type: SExpression

Actually, I want a "parsable" S-exp, like `(** (+ 1 x) 5)' in this case.

In the meantime, I found `convert' and `$Lisp', so what I do is the
following:

  -> p := (1+x)^5
  -> )fin
  BOOT> (defun my-output (sexp)
          (with-open-file (out "out.sexp" :direction :output)
            (format out "~a~%" sexp)))
  BOOT> (|spad|)
  -> sexp := convert(p)
  -> (my-output sexp)$Lisp

However, I can't get `my-output' to be visible from Spad.  Hint?

Thanks,
Ludovic.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.