[erlang-questions] The Beauty of Erlang Syntax

Michael Radford mrad-direct-erlang@REDACTED
Thu Feb 26 20:27:38 CET 2009

Hynek Vychodil writes:
> But anyway, how often you need do something N times without take care for
> result for *practical* purpose? I think you choose wrong example ;-)

Off-topic, but it's funny there are no standard library functions
(AFAIK) that simply iterate over a range of integers.

The common idiom seems to be to use lists:seq and a list iterator
function like lists:foreach or lists:foldl.  Which, I will preemptively
agree, is clear and efficient enough for most purposes.  (Is the
compiler smart enough to optimize away the construction of the list of
integers in cases like that?)

But still, if there were standard functions like these I would use them
all the time:
	foreach_range (fun (I) -> ... end, 1, 10)
	foldl_range (fun (I, Acc) -> ... end, Acc0, 1, 10)


More information about the erlang-questions mailing list