[erlang-questions] What's the difference between tuple and list ?
Tue Sep 25 13:08:16 CEST 2007
On Tue, 25 Sep 2007, raocheng wrote:
> The Pragmatic Programming Erlang says:
> 1) Suppose you want to group a fixed number of items into a single
> entity.For this you'd use a tuple.
> 2) We use lists to store variable numbers of things.
> However, we know that variables in Erlang are in essence invariable. So what
> is the difference between tuple and list ?
Use list when you don't know how many elements will be used. In a code
loop([H | T] = L) ->
in each subsequent call you'll have one less element in the parameter
"Beware of bugs in the above code; I have only proved it correct, not
More information about the erlang-questions