hi,
can you explain why in the following example the lambda for fun1 does not return the values as expected? is that behaviour intentional? is the workaround used with fun2 the best solution?
void main() { array fun1 = ({}); array fun2 = ({}); foreach(enumerate(2); int index; int value) { fun1 += ({ lambda() { return ({ index, value }); } }); fun2 += ({ lambda(int i, int v) { return lambda() { return ({ i,v }); }; }(index, value) }); } write("%O", fun1()); write("%O", fun2()); }