chicken-users
[Top][All Lists]
Advanced

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

Re: [Chicken-users] format-modular feature request: defining one's own m


From: Robin Lee Powell
Subject: Re: [Chicken-users] format-modular feature request: defining one's own multi-part formats
Date: Sat, 8 Mar 2008 16:05:52 -0800
User-agent: Mutt/1.5.17+20080114 (2008-01-14)

On Sat, Mar 08, 2008 at 01:01:05PM -0800, Robin Lee Powell wrote:
> On Sat, Mar 08, 2008 at 08:48:22AM -0800, Kon Lovett wrote:
> >> It seems to me that you could allow limited access to the state
> >> object; something like (start-long-fomatter 'name) which would
> >> do the sort of state-setup stuff that formatter-cond-start
> >> does, and similarily for formatter-cond-next and
> >> formatter-cond-end.  But I certainly do not understand the
> >> format-modular code, so I could be completely wrong.
> >
> > Yeah, I didn't understand it at first either.
> >
> > This will take some time. Are you sure you cannot get most of
> > what you want from the existing format?
> 
> As I said in another post, I can store the "start" parameters and
> then munge the string seperately, so it's not such a big deal.

Except that doesn't actually work, because the "start" values are
*before* substitution.  *sigh*

What I'm trying to do is this:

I have a table of functions.  I want to have a string substitution
that describes which function to use, and the arguments to it (which
may be parts of the original strinrg or may be arguments to format),
and subtitutes the result into the string.  So, given a function in
the table named "test" like so:

(lambda (x y) (conc "test out: ( " x ", " y " ) "))

Then:

(my-format #t "Testing: ~(test~.~A~.~A~).\n" "foo" "bar")

Should produce:

"Testing: test out: ( foo, bar ) \n"

or so.

For motivation, and why I can't just have the function run on the
arguments before string processing, see
http://search.cpan.org/dist/Locale-Maketext/lib/Locale/Maketext/TPJ13.pod

Frankly, I'm quite surprised such a thing doesn't already exist, but
if it does I can't find it.

It occurs to me that I can use my string-munging method by doing the
whole thing in two passes.  I'll see how that goes.

-Robin


-- 
Lojban Reason #17: http://en.wikipedia.org/wiki/Buffalo_buffalo
Proud Supporter of the Singularity Institute - http://singinst.org/
http://www.digitalkingdom.org/~rlpowell/ *** http://www.lojban.org/




reply via email to

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