3 ms·
If you have experience in Python then it's clear that the Ruby code won't be hard to understand, because those languages are similar. The Erlang code makes use
by cx01 18y ago
If you have experience in Python then it's clear that the Ruby code won't be hard to understand, because those languages are similar. The Erlang code makes use of pattern-matching, which is mostly used in functional languages. So I think someone with experience in Haskell or O'Caml wouldn't have problems understanding the Erlang code.
- felixmar 18y agoRecursion also takes a while getting used to if you don't have a math background. Another issue is the frequent use of abbreviations in functional languages as seen in the Erlang example. A bit more verbosity in function and variable naming is useful to make the true abstractions more clear. On the other hand swombat's Ruby examples which use mapping, filtering etc. would be more elegant in many functional languages.
- eru 18y agoYes. You do not see naked recursion very often in, say, Haskell. Most of the time you use the built-in combinators or roll your own.