Let's say I'm invoking something like this
Enum.count(list)
And list
is not defined in 'upper scope'. In most of languages you'll probably get something like Variable list is undefined
, but in Elixir (it comes from Erlang, so I hope it's same behaviour) you'll be getting undefined function list/0 (there is no such import)
.
What's the difference in Elixir from other (let's say imperative) programming languages in sense of distinction between variable and function?
Also I've noticed you can make a function in module, and if it takes zero arguments, you can call it without parentheses, I was wondering what's special about that. (was answered below by @sabiwara)