Hacker News new | past | comments | ask | show | jobs | submit login

This example is not so difficult to understand.

The important thing to realise is that the dot operator is used to access functions grouped into modules (or even invoke anonymous functions) rather than invoke methods on an object. Because Elixir being a functional language, the central operation is invoking functions on data and passing the results to other functions, rather than calling methods on objects.

From this understanding you can just grok from the code that this is a program that takes a list of numbers and squares them concurrently, in the process using your computer’s parallel processing hardware. And as this is a high level language you can create concurrent workloads with minimal implementation knowledge.

Even if you come from C family of languages where the & denotes something to do with address, you’ll realise the way Elixir uses it is not far away from that, but without the added tediousness of memory management. So elixir builds upon common conventions.

Some things like Enum may confuse a Java programmer. It’s Elixir speak for enumerable data rather than a collection of constants. And of course the pipe operator is different.

It’s certainly not easy to see this and write your own code and offer suggestions. But for a mildly experienced programmer who has already adopted the mindset that code is just a bunch of instructions presented in non-linear fashion, like in a legal document, this is an approachable intro to start asking questions from. First of all one should be willing to read a couple of pages from some book on what are anonymous functions and what is the syntax like for that etc.

The task is a bit more difficult for people who tend to look at code with a more inflexible viewpoint ie junior developers.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: