pike.git/
CHANGES
Branch:
Tag:
Non-build tags
All tags
No tags
2002-10-31
2002-10-31 11:37:39 by Johan Sundström <oyasumi@gmail.com>
4ec62aa8aafc4c6dbb488a27393c85e31081ba72 (
14
lines) (+
14
/-
0
)
[
Show
|
Annotate
]
Branch:
7.9
A shot at explaining automap.
Rev: CHANGES:1.24
89:
mixed any_index = Mapping.Iterator(m)->index(); o Automap
+
To perform per-element operations on arrays, there is now a convenience
+
syntax for map(), that can make code more readable in some situations.
+
Summing up two arrays element by element using automap looks like this:
-
+
a[*] + b[*]; // the result has as many elements as the shortest array
+
+
Multiplying all elements in a by a constant:
+
+
a[*] * 4711;
+
+
Make an array of what sprintf("%O", a[n]) returns for all elements in a:
+
+
sprintf("%O", a[*]);
+
o Implicit lambda. o Access to hidden variables in surrounding scopes.