Elixir Blog Posts

Elixir code style, a brief example

The other day I wrote

  def build_string(a, b, ops, sep) do
    Enum.reduce(ops, "", fn op, acc ->
      acc <> sep <> Integer.to_string(calculate(a, b, op))
    |> String.trim_leading(sep)

For a function, and was annoyed by how ugly it was. Improved version is

  def build_string(a, b, ops, sep) do
    |> Enum.map(&calculate(a, b, &1))
    |> Enum.join(sep)

The real point of the blog post is to avoid introducing cases like the first function, which requires a call to String.trim_leading.

Also can use Enum.map_join/3 like:

def build_string(a, b, ops, sep) do
  Enum.map_join(ops, sep, &calculate(a, b, &1))

Good to see blog posts like this too!


Elixir 1.14.0 added Kernel.dbg/2 to improve developer experience. I spent some time playing around with dbg as a replacement for IO.inspect. Here is a post with some examples of debugging a Phoenix app.

Learn how dbg can replace IO.inspect to enhance your debugging workflow.


Elixir is gaining in popularity and as a result many SaaS companies are now using Elixir and Phoenix as the basis of their technology stack. Here are some of the most interesting examples.

8 SaaS Using Elixir and Phoenix in Production

A quick dive into ExUnit’s @tag-attributes and how to use them for clean and explicit test configuration

1 Like

Many consider Elixir to be Ruby’s successor, so we decided to settle that. Together with CTO, Michał Buszkiewicz and experienced Elixir & React Developer, Krzysztof Janiec, we decided to compare the two programming languages.
Elixir vs Ruby in Depth Comparison

I wrote a blog post about how we have been using Ecto Queries for search / filter forms in web applications. It aims at the same problem as the ransack gem in the rails world, but with less magic.


Thanks for sharing! Great post and I love the accompanying Livebook as a means of extending the content without adding too much bloat to the post itself. That’s a great pattern for future content like that.

1 Like

I took a deep-dive into Upserts with Ecto and investigated odd behaviors like:

  • Why does Ecto return a new binary_id every time I upsert a schema?
  • Why do upserts introduce gaps in the IDs of schemas?

This and more is all answered here now:


haha two butts and kills people, anyways great content!