List comprehension or lists:foldl/3 ?
Shawn Pearce
spearce@REDACTED
Fri Feb 13 06:56:10 CET 2004
Which is the more preferred form amongst you hacker types?
NodeList = [...],
[erlang:monitor(process, {myserv, N}) || N <- NodeList],
ok
or
NodeList = [...],
lists:foldl(
fun(N, _) -> erlang:monitor(process, {myserv, N}) end,
0,
NodeList
),
ok
I'm not concerned about the speed here, as its a startup routine
run once when the node boots. Even for a very large cluster of
over 200+ nodes (highly unlikely in my application) this would take
no time either way. This is a preferred syntax poll.
I find the LC easier to read by far.
--
Shawn.
"... all the modern inconveniences ..."
-- Mark Twain
More information about the erlang-questions
mailing list