[erlang-questions] conses in erlang?

Christian S <>
Wed Jul 2 10:54:22 CEST 2008


You have the operator [End|Acc] to cons End on to the list Acc. See below.

Preferably, you implement seq from the end to the start.

seq(Start, End) -> seq(Start, End, []).

seq(Start, End, Acc) when Start =< End ->
   seq(Start, End-1, [End|Acc]);
seq(_, _, Acc) ->
   Acc.



More information about the erlang-questions mailing list