On Wed, 2005-11-09 at 07:24 -0600, Jon Wilson wrote:
> 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.)

Yes, but you'd lose more than you'd gain by making it a macro.  Unless
you really wanted to do something crazy like:

(define-syntax scheme->LaTeX
  (syntax-rules (+ /)
    ((_ (+ f1 f2 ... f3))
     (string-append "(" (scheme->LaTeX (+ f1 f2 ...))
                    " + " (scheme->LaTeX f3) ")"))
    ((_ (+ f1))
     (scheme->LaTeX f1))
    ((_ (/ f1 f2 f3 ...))
     (string-append "\frac{" (scheme->LaTeX f1)
                    "}{" (scheme->LaTeX (* f2 f3 ...)) "}"))
    ;;and so on....
    ))

Of course that has many drawbacks of its own.  Better to just handle it
in functions, which, for example, wouldn't have the spurious parenthesis
problem of the multiple + argument syntax, and so on.  Not to mention
the added benefit of scheme->LaTeXing forms unknown at load-time without
using eval.

Remember Norvig's first step to writing a macro: Decide if the macro is
really necessary.

-- 
Stephen Compall
http://scompall.nocandysoftware.com/blog

Attachment: signature.asc
Description: This is a digitally signed message part

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

Reply via email to