[stringtemplate-interest] New question

Terence Parr parrt at cs.usfca.edu
Thu May 11 23:20:00 PDT 2006


On May 11, 2006, at 11:14 PM, David Moshal wrote:

> Sorry to be such a pest, here's a new question:

Not a problem...glad to help.

> If know that I can get an iterator in the following way:
>
> $arr:{
>
>   $i$
>
> }$
>
>
> but what if I want nested iterators?
>
> ie: in java
> for (int i=0; i<10; i++)
> {
>    for (int j=0; j <10; j++)
>    {
>
>    }
> }
>
> is there a way in ST to get nested iterators? (I know one can get  
> the nested values of the collection)

Sure.  I think ;)  Probably involves passing a parameter to a  
subtemplate:

$numbers:{n | subtemplate(outer=i)}$

Hmm...something is bugging me about that...i.e., perhaps the outer=i  
will be evaluated in the subtempalte context...anyway, try it! :)   
use $outer$ and $i$ inside subtemplate.

Ter


More information about the stringtemplate-interest mailing list