|
|
|
|
|
by nivenhuh
2338 days ago
|
|
I’ve been using elixir for about a year now. It really makes writing API code joyful. The pattern matching concept works so well for handling the variation that happens in API request handling. I also love working with Plugs. The pipeline nature of elixir translates directly into how you manage a request/response, and the plug abstraction pattern allows you to be explicit about what should happen, and hide the details in a clean way. Overall, there are a few simple language patterns that, when used together, provide a lot of power and flexibility — without the drawback of over complicated code. |
|
Supporting a different second parameter (a symbol rather than a function) can be implemented with another function that pattern matches to :asc or :desc. They can each call the original function(s) too.
In many other languages you'd start `sort` with a conditional and that function would need to handle every case. Not here. Each function worries about itself and what it can handle.
There's a beauty and practicality that Elixir hits so well.