2 ms·
Yes. To explain to others, it's easy to miss how dynamic Erlang is if you don't study the syntax, but generally, where ever you see a module or a function, you'
by jerf 11y ago
Yes. To explain to others, it's easy to miss how dynamic Erlang is if you don't study the syntax, but generally, where ever you see a module or a function, you're actually using atoms, and they can be freely substituted by variables containing atoms.
Eshell V5.10.1 (abort with ^G)
1> lists:reverse([1,2,3]).
[3,2,1]
2> L = lists.
lists
3> R = reverse.
reverse
4> L:R([1,2,3]).
[3,2,1]
This makes it easy to iterate through lists of modules, calling an init function on them, or generally treating modules generically. It is, I think, perhaps less powerful than Python's capabilities, but it can still take you a long ways, and save you a lot of code.