zurich-erlang-user-group/2012-meetups — pull request #2 by dergraf (2012-06-05 14:20:57+00:00)
Title: use list comprehension for this sort of things

hello there!
a small contribution from Berlin...
since you don't have a for loop in Erlang you must use either list comprehensions or recursion to iterate. if you just want to repeat a specific action several times I prefer using [your_action() || _ <- lists:seq(1, N)]. the generated list (with lists:seq) is created very fast, but takes some extra memory for the list while the recursive version wont..

repeating an action in this way is faster as using recursion, and looks similar to Python's "for i in range(10):"

so see you next time!
cheers
André