0

I have this list:

<c:let>
    a = list('a','b','c')
</c:let>

How can i modify each elements for that list?

I need something like:

for (int i = 0; i < a.length; i++) {
    a[i] += 'd';
}

I looked in the tutorial, but the examples show only how to retrieve a list element, not how to modify it.

So, how can i modify list elements, iterating on it?

Thanks!

alem0lars
  • 660
  • 2
  • 10
  • 23

1 Answers1

1

There is (currently) no function which lets you manipulate lists. All you could do is

<let>
  a = list('a', 'b', .. )    ; your list
  b = list()                 ; empty list 
</let>
<for var=" item " in=" a ">
 <let>
   x = some-el-expression( item ) ;     
   b = append(b, x)
 </let>
</for>
<let>
 a = b
</let>

Work has started which allows one to use functions with arguments - besides the convenience functions (append() and other functions listed in section 3.6 of the manual). Other work has also been started to allow you to plugin your own functions (would require Java programming - providing functions via Groovy or (J)Ruby needs some research).

wh81752
  • 869
  • 9
  • 16