This is the mail archive of the
guile@cygnus.com
mailing list for the Guile project.
Re: Bracket heresies. What about subscripting?
> Mailing-List: contact guile-help@sourceware.cygnus.com; run by ezmlm
> Precedence: bulk
> Sender: guile-owner@sourceware.cygnus.com
> Date: Fri, 02 Jul 1999 10:46:17 +1000
> From: Chris Bitmead <cbitmead@ozemail.com.au>
> X-Accept-Language: en
> Content-Type: text/plain; charset=us-ascii
>
> Michael Vanier wrote:
> It would be cool
> > to have a read-macro that translated infix to prefix e.g.
> >
> > #{ a**2 + b**4 / c[i] } ;; e.g.
> >
> > becomes:
> >
> > (/ (+ (pow a 2) (pow b 4))
> > (vector-ref c i))
> >
> > This would probably ease the transition to scheme for a
> > lot of people.
>
> I don't think you need a reader macro. Some plain old macro would do the
> trick. One probably already exists if you look around. Lots of people
> have suggested this over time.
>
True. However, a reader macro would be somewhat less onerous. In fact,
you might even consider just using curly braces for this, with the curlies
meaning begin-infix/end-infix. This is similar to what tcl does with expr:
set a [expr b**2 + c **2] # I think that's right...
but more readable and presumably more expandable. The point is, reader
macros are potentially a Good Thing, even if they can be abused (like
regular macros).
Mike