[stringtemplate-interest] List comprehensions Was Re: Working with filtered list

Terence Parr parrt at cs.usfca.edu
Thu Jun 28 16:03:57 PDT 2007


On Jun 27, 2007, at 11:32 AM, Colin Bean wrote:
> Also, correct me if I'm wrong, but the main ability a comprehension
> gives you (aside from nicer code) is the ability to access an $i$
> value for the filtered attributes only -- as opposed to an existing
> expression like:
>
> $items:{
>       $if(it.isSmart)$ $it$ $endif$
> }$
>
> Would a comprehension allow you to do anything else that you can't  
> currently do?

Hi Colin!  Heh, yeah, I was wondering if it had something to do with  
how you could iterate; you picked a key feature.  We need more  
powerful data manipulation like splice and list comprehension.

Ter



More information about the stringtemplate-interest mailing list