Be concise.
Be useful.
All contributions dictatorially edited by webmasters to match personal tastes.
Please do not paste any copyright violating material.
Please try to avoid dependencies to third-party libraries and frameworks.
(doseq [e x]
(f e))
for (auto e : x)
f(e);
C++11 or later
If f is expected to change e as a side effect, replace auto with auto&
If f is expected to change e as a side effect, replace auto with auto&
foreach(var e in x)
f(e);
x.forEach(f);
Note that for this to work, function f must accept (key, value) as parameters.
for e := range x {
f(e)
}
x is implemented as a map whose values are ignored.
for e in x do f(e);
f($_) for @x;
list(map(lambda e: f(e), x))
It will not work until list transformation
for e in x:
f(e)
for e in x: f(e)