Hi Klaus,
scheme->LaTeX would have to be a macro, then it receives its arguments
before they are evaluated.  Unless of course I'm mistaken about the
nature of macros.  (I'm still relatively new to the idea.)

eg (simple example, its 7am here and I got to sleep at 2.):
(define-macro (+->LaTeX +expr)
 (string-append
   (number->string (cadr +expr))
   "+"
   (number->string (caddr +expr))))

(+->LaTeX (+ 9 15))
=>
"9+15"

Unless I've screwed something up in my sleepiness, but I just tested
it and yeah that seems to work as far as a proof of concept goes.
Guile version 1.6.4, I don't know if things have changed in unstable
version.

Regards,
Jon

klaus schilling wrote:
Jon Wilson writes:
> > (scheme->LaTeX (+ 7 (/ 18 5)))
 > =>
 > "7 + \frac{18}{5}"


shouldn't the argument be quoted? otherwise it will be evaluated straight to 10.6 (or whatever style of representation has been chosen for rationals, the unstable versions for guile seem to provide for more possibilities)

Klaus Schilling



_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-user

Reply via email to