AW: [stringtemplate-interest] Template-Operator []
Dreyer Ulf (CR/APA3)
Ulf.Dreyer at de.bosch.com
Wed Jun 7 00:31:24 PDT 2006
Hi Terence!
> > The [] operator in a template concatenates 2 lists
> (enumerables).
> > so that
> > A = [1,2,3]
> > B = [a,b,c]
> > $[A,B]$ = [1,2,3,a,b,c]
> >
> > is there a way to get the following list out of A and B?
> > [ [1,2,3] , [a,b,c] ]
> Hi. good question. Hmmm...not sure.
> That operator really needs to flatten the lists.
> Can you give an example usage?
Ok, You got me.
I can think of examples but they all can be solved in a
different way.
One example would be as follows :
NumberedList(List) ::=<<
List $i$: $List;separator=(";")$ $\n$
>>
[...]
$[listA,listB]:NumberedList()$
[...]
The above "enumerates" lists one level below of what I would
think.
This would be ok though, if [[listA],[listB]] would work that
way. But it can not because the []-Operator has to dereference all
elements within.
But as I can avoid all of those instances at the moment it is
not that important.
Another thing I noticed is that first() and rest() functions
can not be combined. (as in first(rest(someList)))
Is this intentional?
Thanks,
Ulf
More information about the stringtemplate-interest
mailing list