[plt-scheme] format string with named parts

From: Eli Barzilay (eli at barzilay.org)
Date: Wed Feb 10 14:29:06 EST 2010

On Feb 10, Todd O'Bryan wrote:
> I wasn't clear. I need to make the format strings before I'm ready
> to plug in the named values. In Python, they're just strings, so
> there's no problem creating them before you have the values ready to
> insert, but since @-exprs are really code, you have to hold off
> evaluating them until you have the values ready to plug in.

I consider the python thing a hack, which is really compensating for
*not* having a proper string interpolation thing.  Perhaps a more
explicit way to see the hack is that the hash table is essentially a
kind of a namespace thing, which is orthogonal to the namespace your
code is using.  I guess that you could claim that it's less of a hack
in python since you can reify the current namespace as a hash table
anyway (and perhaps that's a common idiom?).

If you really want to plug in values later into some template, then
you really want a function -- the "~<x>a ~<y>a ~<z>s" (using Laurent's
syntax) is just that kind of a function in disguise (a bad one, IMO).

          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                    http://barzilay.org/                   Maze is Life!

Posted on the users mailing list.