[Jprogramming] Building multiline definitions in code
Miller, Raul D
rdmiller at usatoday.com
Mon Nov 6 05:43:22 HKT 2006
Pascal Jasmin wrote:
> Templating, even if very simple, could be useful to you, or to
> someone providing useful code to you.
I've seen several people write code that takes a J string,
evaluates everything between delimiters, and replaces the
delimiters and the contained code with the ravel of the format
of the result.
In other words, that would take:
This <%= 1+1 %> is an example.
or
This (: 1+1 ): is an example.
and produce
This 2 is an example.
I'm not sure if this would be useful in image processing, but
in other contexts (for example, boiler plate functions), this can
be handy.
Unfortunately, I don't have any of these handy, at the moment.
Typical design for these verbs used the ;: dyad to generate
a list of boxed strings, another verb to recognize and evaluate
(and format and ravel) the relevant part of those that had the
delimiters, then the ; monad to turn that back to a string.
--
Raul
More information about the Programming
mailing list