unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: Stephen Compall <s11@member.fsf.org>
Cc: guile-user <guile-user@gnu.org>
Subject: Re: string parsing/preparation for latex
Date: Sun, 13 Nov 2005 21:17:28 -0600	[thread overview]
Message-ID: <1131938248.25280.17.camel@nocandy.dyndns.org> (raw)
In-Reply-To: <4371F87E.1060700@fastmail.fm>


[-- Attachment #1.1: Type: text/plain, Size: 1248 bytes --]

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 #1.2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

[-- Attachment #2: Type: text/plain, Size: 140 bytes --]

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

  reply	other threads:[~2005-11-14  3:17 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-07 13:53 string parsing/preparation for latex David Pirotte
2005-11-07 15:49 ` Jose Roberto B. de A. Monteiro
2005-11-08 14:52   ` David Pirotte
2005-11-08 16:35     ` Jose Roberto B. de A. Monteiro
2005-11-08 16:56     ` Stephen Compall
2005-11-08  0:34 ` Jon Wilson
2005-11-08 14:26   ` David Pirotte
2005-11-08 20:42     ` Jon Wilson
2005-11-08 21:08       ` klaus schilling
2005-11-09 13:24         ` Jon Wilson
2005-11-14  3:17           ` Stephen Compall [this message]
2005-11-15  1:50             ` Jon Wilson
2005-11-16  2:52               ` Stephen Compall

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1131938248.25280.17.camel@nocandy.dyndns.org \
    --to=s11@member.fsf.org \
    --cc=guile-user@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).