Tell me more ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

http://www.erlang.org/news/35 mentioned that this will be documented, but I can't find it in the documentation.

share|improve this question

1 Answer

A "tuple module" is a tuple with two elements, the name of a module and a list of extra arguments. For example:

{my_module, [foo, bar]}

Such a tuple can be used instead of a module name in function calls. In this case, the function being called will get the tuple in question as an additional argument at the end of the argument list:

3> Module = {lists, [[foo]]}.
{lists,[[foo]]}
4> Module:append([bar]).
[bar|{lists,[[foo]]}]

This call is equivalent to:

7> lists:append([bar], {lists, [[foo]]}).
[bar|{lists,[[foo]]}]

Tuple modules are kept for backwards compatibility, as they were the implementation mechanism for parameterised modules, which were removed from the language in R16.

share|improve this answer
hum, I was expecting [foo, bar] as the end result – Isac 2 days ago
Me too, thus my choice of function for testing :) – legoscia 2 days ago

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.