guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: string parsing/preparation for latex


From: Jon Wilson
Subject: Re: string parsing/preparation for latex
Date: Wed, 09 Nov 2005 07:24:14 -0600
User-agent: Mozilla Thunderbird 1.0.2 (X11/20050324)

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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]