• Pl chevron_right

      Erlang Solutions: Looking Forward to ElixirConf EU 2025

      news.movim.eu / PlanetJabber • 1 May 2025 • 6 minutes

    ElixirConf EU 2025 is only two weeks away! Soon, it will once again be time for the Elixir community from Europe and beyond to come together, connect, and learn from each other about Elixir and its ecosystem. There will be dozens of talks from speakers across the community, training opportunities, and more.

    This year’s event is being held in Kraków, Poland from May 15-16, with optional training available on May 14. Both in-person and virtual tickets are available.

    Here’s a preview of some of the speakers on the schedule, and what to expect from their talks:

    Keynotes

    José Valim: Type System and Elixir Updates

    No ElixirConf would be complete without an appearance from Dashbit’s José Valim , the creator of Elixir.


    Since announcing it at ElixirConf EU 2022 , José and the Elixir team have been hard at work on a type system for the language based on set-theoretic types. Implementation of this system is still underway , and José will offer an update on its progress, as well as other recent activities from the Elixir team and what to expect in the next release. Guillaume Duboc , a PhD student at Université Paris Cité who is working on the type system for his thesis, will provide a more in-depth look at it in a separate talk, “What’s New with Elixir Types”.

    James Arthur: Introducing Phoenix.Sync

    James Arthur is a TED Prize and Microsoft Prize-winning co-founder of Opendesk , Hazy , and Post Urban , with prior software development experience for Apple and IDEO .

    He is currently the CEO of ElectricSQL , developers of the Elixir sync engine Electric , and will be bringing that knowledge to his keynote introducing Phoenix.Sync , a new library that adds real-time sync to Phoenix. Expect a tour through the basics of the library, how to use it to sync data into both backend and frontend applications, and its potential uses in AI systems.

    Davide Bettio and Mateusz Front: The AtomVM and New Horizons for Elixir

    SECO Mind’s Davide Bettio has years of embedded systems and IoT experience, and began work on AtomVM , a lightweight BEAM implementation tailored for IoT devices, in 2017.

    He’ll be joined by Mateusz Front , an Elixir developer at Software Mansion , to explain the results of a collaboration that has proved Elixir can be run on a whole new platform. They’re keeping quiet about the specifics, so you’ll have to check out their keynote to find out what they’ve come up with, along with plenty more information about AtomVM and Elixir runtimes.


    Industry Stories

    Anita Ludermann: Turn Old Into New: Moving to Elixir Feature by Feature

    Anita Ludermann is a software engineer currently at Modell Aachen GmbH , where she has spent the last few years working with a team whose goal is to modernise a legacy codebase by transitioning it to Elixir.

    She’ll be offering a first-hand account of what adoption of Elixir and the functional paradigm in general looks like in a real-world industry context, with all the challenges of shifting an entire system to a new language bit by bit while maintaining consistent functionality for the user.

    Ettore Berardi: How Elixir Powers the BBC: From PoC to Production at Scale

    After a stint at MacMillan Science and Education , Ettore Berardi joined the BBC , where he has now been working for eight years as a tech lead.

    He’ll be relaying another story of Elixir adoption in action, namely the four-year process of shifting to Elixir at the BBC, starting with an initial proof of concept and culminating with nearly all BBC app and web traffic being served by Elixir. On top of the technical side of things, he’ll also discuss the realities of building and maintaining Elixir expertise in an environment largely unfamiliar with the language.

    Libraries and Frameworks

    Gus Workman: Introducing Trellis: Open Source Hardware for Nerves

    You may already be familiar with Nerves , a framework for using Elixir to build embedded systems. Gus Workman is the founder of Protolux Electronics , a company specialising in Nerves-based hardware and software.

    His talk will introduce Trellis, an open-source hardware platform reminiscent of Raspberry Pi , but specifically built with the purpose of producing custom circuit boards for Nerves and Elixir.

    Parker and Shannon Selbert: The Architecture of Oban Web

    Oban Web , the live dashboard for the prominent Elixir background job library Oban , recently became fully open source.

    Now, Oban’s creator Parker Selbert and Oban core team member Shannon Selbert, co-founders of Soren , will be diving into the internals of the project, touring its key elements and interesting features. They promise to reveal how to structure a complex LiveView application with extensive real-world use, backed by Oban Met , a purpose-built distributed database.

    Ridwan Otun and Sola-Aremu ‘Pelumi: Whisperer: An Elixir-Based Multi-Agent Framework

    Ridwan Otun and Sola-Aremu ‘Pelumi are two self-described Elixir evangelists working as engineering vice presidents at Juicyway and Bank of America , respectively.
    Their talk will introduce Whisperer , a new and recently open-sourced framework that allows users to define, sequence, and orchestrate multi-agent AI systems. It’s another talk that’s well worth checking out if you’re interested in learning how Elixir developers are taking advantage of the new possibilities afforded by agents and LLMs.

    Deep Dives

    Conor Sinclair: Meta-Programming in Elixir: Dynamic Function Calling with LLMs

    Multiverse’s Conor Sinclair is a senior software engineer specialising in frontend and with a passion for Elixir.

    He’ll be joining the conference to address the now-ubiquitous topic of LLMs. Conor will be addressing Elixir specifically, walking the audience through the process of creating generic interfaces and using the Langchain library to expose them to LLMs. It’s sure to be a fascinating talk for anyone curious as to how these models interface with an existing application.

    Robert Virding: Unveiling the Magic of Erlang/OTP Behaviours: A Deep Dive in the Codebase & Björn Gustavsson: My Beam History

    We’ll also be getting talks from two developers whose experience with Erlang and the BEAM goes back to the very beginning. Robert Virding was one of the co-creators of Erlang at Ericsson , and now works for Erlang Solutions as Principle Language Expert.
    He’ll be offering a deep dive into the Erlang/OTP codebase, as well as a BEAM VM training session the day before the conference proper. Björn Gustavsson , meanwhile, joined the OTP team in 1996 and later became the main developer for the BEAM, which is partially named for him. His talk will explore his three decades of history with the BEAM.

    And More!

    Of course, that’s only a fraction of the talks at this year’s event – there are plenty of others, and it’s worth checking out the full list of speakers to see if there’s anything else that catches your eye. If you’ve already committed to attending, the schedule is now available, so you can start deciding which talks to attend.

    There’s sure to be something for everyone with an interest in Elixir and the BEAM, and Erlang Solutions will be present at the event as always, so be sure to say hi to our team if you do attend. We hope to see you in Kraków in a few weeks for ElixirConf EU 2025!

    The post Looking Forward to ElixirConf EU 2025 appeared first on Erlang Solutions .

    • Pl chevron_right

      Erlang Solutions: Looking Forward to ElixirConf EU 2025

      news.movim.eu / PlanetJabber • 1 May 2025 • 6 minutes

    ElixirConf EU 2025 is only two weeks away! Soon, it will once again be time for the Elixir community from Europe and beyond to come together, connect, and learn from each other about Elixir and its ecosystem. There will be dozens of talks from speakers across the community, training opportunities, and more.

    This year’s event is being held in Kraków, Poland from May 15-16, with optional training available on May 14. Both in-person and virtual tickets are available.

    Here’s a preview of some of the speakers on the schedule, and what to expect from their talks:

    Keynotes

    José Valim: Type System and Elixir Updates

    No ElixirConf would be complete without an appearance from Dashbit’s José Valim , the creator of Elixir.


    Since announcing it at ElixirConf EU 2022 , José and the Elixir team have been hard at work on a type system for the language based on set-theoretic types. Implementation of this system is still underway , and José will offer an update on its progress, as well as other recent activities from the Elixir team and what to expect in the next release. Guillaume Duboc , a PhD student at Université Paris Cité who is working on the type system for his thesis, will provide a more in-depth look at it in a separate talk, “What’s New with Elixir Types”.

    James Arthur: Introducing Phoenix.Sync

    James Arthur is a TED Prize and Microsoft Prize-winning co-founder of Opendesk , Hazy , and Post Urban , with prior software development experience for Apple and IDEO .

    He is currently the CEO of ElectricSQL , developers of the Elixir sync engine Electric , and will be bringing that knowledge to his keynote introducing Phoenix.Sync , a new library that adds real-time sync to Phoenix. Expect a tour through the basics of the library, how to use it to sync data into both backend and frontend applications, and its potential uses in AI systems.

    Davide Bettio and Mateusz Front: The AtomVM and New Horizons for Elixir

    SECO Mind’s Davide Bettio has years of embedded systems and IoT experience, and began work on AtomVM , a lightweight BEAM implementation tailored for IoT devices, in 2017.

    He’ll be joined by Mateusz Front , an Elixir developer at Software Mansion , to explain the results of a collaboration that has proved Elixir can be run on a whole new platform. They’re keeping quiet about the specifics, so you’ll have to check out their keynote to find out what they’ve come up with, along with plenty more information about AtomVM and Elixir runtimes.


    Industry Stories

    Anita Ludermann: Turn Old Into New: Moving to Elixir Feature by Feature

    Anita Ludermann is a software engineer currently at Modell Aachen GmbH , where she has spent the last few years working with a team whose goal is to modernise a legacy codebase by transitioning it to Elixir.

    She’ll be offering a first-hand account of what adoption of Elixir and the functional paradigm in general looks like in a real-world industry context, with all the challenges of shifting an entire system to a new language bit by bit while maintaining consistent functionality for the user.

    Ettore Berardi: How Elixir Powers the BBC: From PoC to Production at Scale

    After a stint at MacMillan Science and Education , Ettore Berardi joined the BBC , where he has now been working for eight years as a tech lead.

    He’ll be relaying another story of Elixir adoption in action, namely the four-year process of shifting to Elixir at the BBC, starting with an initial proof of concept and culminating with nearly all BBC app and web traffic being served by Elixir. On top of the technical side of things, he’ll also discuss the realities of building and maintaining Elixir expertise in an environment largely unfamiliar with the language.

    Libraries and Frameworks

    Gus Workman: Introducing Trellis: Open Source Hardware for Nerves

    You may already be familiar with Nerves , a framework for using Elixir to build embedded systems. Gus Workman is the founder of Protolux Electronics , a company specialising in Nerves-based hardware and software.

    His talk will introduce Trellis, an open-source hardware platform reminiscent of Raspberry Pi , but specifically built with the purpose of producing custom circuit boards for Nerves and Elixir.

    Parker and Shannon Selbert: The Architecture of Oban Web

    Oban Web , the live dashboard for the prominent Elixir background job library Oban , recently became fully open source.

    Now, Oban’s creator Parker Selbert and Oban core team member Shannon Selbert, co-founders of Soren , will be diving into the internals of the project, touring its key elements and interesting features. They promise to reveal how to structure a complex LiveView application with extensive real-world use, backed by Oban Met , a purpose-built distributed database.

    Ridwan Otun and Sola-Aremu ‘Pelumi: Whisperer: An Elixir-Based Multi-Agent Framework

    Ridwan Otun and Sola-Aremu ‘Pelumi are two self-described Elixir evangelists working as engineering vice presidents at Juicyway and Bank of America , respectively.
    Their talk will introduce Whisperer , a new and recently open-sourced framework that allows users to define, sequence, and orchestrate multi-agent AI systems. It’s another talk that’s well worth checking out if you’re interested in learning how Elixir developers are taking advantage of the new possibilities afforded by agents and LLMs.

    Deep Dives

    Conor Sinclair: Meta-Programming in Elixir: Dynamic Function Calling with LLMs

    Multiverse’s Conor Sinclair is a senior software engineer specialising in frontend and with a passion for Elixir.

    He’ll be joining the conference to address the now-ubiquitous topic of LLMs. Conor will be addressing Elixir specifically, walking the audience through the process of creating generic interfaces and using the Langchain library to expose them to LLMs. It’s sure to be a fascinating talk for anyone curious as to how these models interface with an existing application.

    Robert Virding: Unveiling the Magic of Erlang/OTP Behaviours: A Deep Dive in the Codebase & Björn Gustavsson: My Beam History

    We’ll also be getting talks from two developers whose experience with Erlang and the BEAM goes back to the very beginning. Robert Virding was one of the co-creators of Erlang at Ericsson , and now works for Erlang Solutions as Principle Language Expert.
    He’ll be offering a deep dive into the Erlang/OTP codebase, as well as a BEAM VM training session the day before the conference proper. Björn Gustavsson , meanwhile, joined the OTP team in 1996 and later became the main developer for the BEAM, which is partially named for him. His talk will explore his three decades of history with the BEAM.

    And More!

    Of course, that’s only a fraction of the talks at this year’s event – there are plenty of others, and it’s worth checking out the full list of speakers to see if there’s anything else that catches your eye. If you’ve already committed to attending, the schedule is now available, so you can start deciding which talks to attend.

    There’s sure to be something for everyone with an interest in Elixir and the BEAM, and Erlang Solutions will be present at the event as always, so be sure to say hi to our team if you do attend. We hope to see you in Kraków in a few weeks for ElixirConf EU 2025!

    The post Looking Forward to ElixirConf EU 2025 appeared first on Erlang Solutions .

    • Pl chevron_right

      Erlang Solutions: Looking Forward to ElixirConf EU 2025

      news.movim.eu / PlanetJabber • 1 May 2025 • 6 minutes

    ElixirConf EU 2025 is only two weeks away! Soon, it will once again be time for the Elixir community from Europe and beyond to come together, connect, and learn from each other about Elixir and its ecosystem. There will be dozens of talks from speakers across the community, training opportunities, and more.

    This year’s event is being held in Kraków, Poland from May 15-16, with optional training available on May 14. Both in-person and virtual tickets are available.

    Here’s a preview of some of the speakers on the schedule, and what to expect from their talks:

    Keynotes

    José Valim: Type System and Elixir Updates

    No ElixirConf would be complete without an appearance from Dashbit’s José Valim , the creator of Elixir.


    Since announcing it at ElixirConf EU 2022 , José and the Elixir team have been hard at work on a type system for the language based on set-theoretic types. Implementation of this system is still underway , and José will offer an update on its progress, as well as other recent activities from the Elixir team and what to expect in the next release. Guillaume Duboc , a PhD student at Université Paris Cité who is working on the type system for his thesis, will provide a more in-depth look at it in a separate talk, “What’s New with Elixir Types”.

    James Arthur: Introducing Phoenix.Sync

    James Arthur is a TED Prize and Microsoft Prize-winning co-founder of Opendesk , Hazy , and Post Urban , with prior software development experience for Apple and IDEO .

    He is currently the CEO of ElectricSQL , developers of the Elixir sync engine Electric , and will be bringing that knowledge to his keynote introducing Phoenix.Sync , a new library that adds real-time sync to Phoenix. Expect a tour through the basics of the library, how to use it to sync data into both backend and frontend applications, and its potential uses in AI systems.

    Davide Bettio and Mateusz Front: The AtomVM and New Horizons for Elixir

    SECO Mind’s Davide Bettio has years of embedded systems and IoT experience, and began work on AtomVM , a lightweight BEAM implementation tailored for IoT devices, in 2017.

    He’ll be joined by Mateusz Front , an Elixir developer at Software Mansion , to explain the results of a collaboration that has proved Elixir can be run on a whole new platform. They’re keeping quiet about the specifics, so you’ll have to check out their keynote to find out what they’ve come up with, along with plenty more information about AtomVM and Elixir runtimes.


    Industry Stories

    Anita Ludermann: Turn Old Into New: Moving to Elixir Feature by Feature

    Anita Ludermann is a software engineer currently at Modell Aachen GmbH , where she has spent the last few years working with a team whose goal is to modernise a legacy codebase by transitioning it to Elixir.

    She’ll be offering a first-hand account of what adoption of Elixir and the functional paradigm in general looks like in a real-world industry context, with all the challenges of shifting an entire system to a new language bit by bit while maintaining consistent functionality for the user.

    Ettore Berardi: How Elixir Powers the BBC: From PoC to Production at Scale

    After a stint at MacMillan Science and Education , Ettore Berardi joined the BBC , where he has now been working for eight years as a tech lead.

    He’ll be relaying another story of Elixir adoption in action, namely the four-year process of shifting to Elixir at the BBC, starting with an initial proof of concept and culminating with nearly all BBC app and web traffic being served by Elixir. On top of the technical side of things, he’ll also discuss the realities of building and maintaining Elixir expertise in an environment largely unfamiliar with the language.

    Libraries and Frameworks

    Gus Workman: Introducing Trellis: Open Source Hardware for Nerves

    You may already be familiar with Nerves , a framework for using Elixir to build embedded systems. Gus Workman is the founder of Protolux Electronics , a company specialising in Nerves-based hardware and software.

    His talk will introduce Trellis, an open-source hardware platform reminiscent of Raspberry Pi , but specifically built with the purpose of producing custom circuit boards for Nerves and Elixir.

    Parker and Shannon Selbert: The Architecture of Oban Web

    Oban Web , the live dashboard for the prominent Elixir background job library Oban , recently became fully open source.

    Now, Oban’s creator Parker Selbert and Oban core team member Shannon Selbert, co-founders of Soren , will be diving into the internals of the project, touring its key elements and interesting features. They promise to reveal how to structure a complex LiveView application with extensive real-world use, backed by Oban Met , a purpose-built distributed database.

    Ridwan Otun and Sola-Aremu ‘Pelumi: Whisperer: An Elixir-Based Multi-Agent Framework

    Ridwan Otun and Sola-Aremu ‘Pelumi are two self-described Elixir evangelists working as engineering vice presidents at Juicyway and Bank of America , respectively.
    Their talk will introduce Whisperer , a new and recently open-sourced framework that allows users to define, sequence, and orchestrate multi-agent AI systems. It’s another talk that’s well worth checking out if you’re interested in learning how Elixir developers are taking advantage of the new possibilities afforded by agents and LLMs.

    Deep Dives

    Conor Sinclair: Meta-Programming in Elixir: Dynamic Function Calling with LLMs

    Multiverse’s Conor Sinclair is a senior software engineer specialising in frontend and with a passion for Elixir.

    He’ll be joining the conference to address the now-ubiquitous topic of LLMs. Conor will be addressing Elixir specifically, walking the audience through the process of creating generic interfaces and using the Langchain library to expose them to LLMs. It’s sure to be a fascinating talk for anyone curious as to how these models interface with an existing application.

    Robert Virding: Unveiling the Magic of Erlang/OTP Behaviours: A Deep Dive in the Codebase & Björn Gustavsson: My Beam History

    We’ll also be getting talks from two developers whose experience with Erlang and the BEAM goes back to the very beginning. Robert Virding was one of the co-creators of Erlang at Ericsson , and now works for Erlang Solutions as Principle Language Expert.
    He’ll be offering a deep dive into the Erlang/OTP codebase, as well as a BEAM VM training session the day before the conference proper. Björn Gustavsson , meanwhile, joined the OTP team in 1996 and later became the main developer for the BEAM, which is partially named for him. His talk will explore his three decades of history with the BEAM.

    And More!

    Of course, that’s only a fraction of the talks at this year’s event – there are plenty of others, and it’s worth checking out the full list of speakers to see if there’s anything else that catches your eye. If you’ve already committed to attending, the schedule is now available, so you can start deciding which talks to attend.

    There’s sure to be something for everyone with an interest in Elixir and the BEAM, and Erlang Solutions will be present at the event as always, so be sure to say hi to our team if you do attend. We hope to see you in Kraków in a few weeks for ElixirConf EU 2025!

    The post Looking Forward to ElixirConf EU 2025 appeared first on Erlang Solutions .

    • Pl chevron_right

      Erlang Solutions: Reduce, Reuse… Refactor: Clearer Elixir with the Enum Module

      news.movim.eu / PlanetJabber • 24 April 2025 • 4 minutes

    “When an operation cannot be expressed by any of the functions in the Enum module, developers will most likely resort to reduce/3.”

    -From the docs for Enum.reduce/3

    In many Elixir applications, I find Enum.reduce is used frequently. Enum.reduce can do anything, but that doesn’t mean it should. In many cases, other Enum functions are more readable, practically as fast, and easier to refactor.

    I would also like to discuss situations that are a good fit for Enum.reduce and also introduce you to a custom credo check I’ve created, which can help you identify places where Enum.reduce could be replaced with a simpler option.

    Readability

    Here are a few common reduce patterns—and their simpler alternatives.  For example, here’s something I see quite often:

    Enum.reduce(numbers, [], fn i, result -> [i * 10 | result] end)
    |> Enum.reverse()
    
    

    This is a situation that the Enum.map function was designed for:

    Enum.map(numbers, & &1 * 10)
    

    Perhaps you know about Enum.map , but you might see a call to reduce like this:

    Enum.reduce(numbers, 0, fn number, result -> (number * 2) + result end)
    
    

    Let me introduce you to Enum.sum_by !


    Enum.sum_by(numbers, & &1 * 2)
    
    

    Let’s look at something a bit more complex:

    Enum.reduce(numbers, [], fn item, acc ->
      if rem(item, 2) == 0 do
        [item * 2 | acc]
      else
        acc
      end
    end)
    |> Enum.reverse()
    
    

    This is a perfect case for piping together two Enum functions:

    numbers
    |> Enum.filter(& rem(&1, 2) == 0)
    |> Enum.map(& &1 * 2)
    

    Another option for this case could even be to use Enum.flat_map :


    Enum.flat_map(numbers, fn number ->
      if rem(number, 2) == 0 do
        [number * 2]
      else
        []
      end
    end)
    
    

    This is a decent option, but while this achieves the purpose of both filtering and mapping in a single pass, it may not be as intuitive for everybody.

    Lastly, say you see something like this and think that it would be difficult to improve:

    Enum.reduce(invoices, {[], []}, fn invoice, result ->
      Enum.reduce(invoice.items, result, fn item, {no_tax, with_tax} ->
        if Invoices.Items.taxable?(item) do
          tax = tax_for_value(item.amount, item.product_type)
          item = Map.put(item, :tax, tax)
    
          if Decimal.equal?(tax, 0) do
            {no_tax ++ [item], with_tax}
          else
            {no_tax, with_tax ++ [item]}
          end
        else
          {no_tax, with_tax}
        end
      end)
    end)
    
    

    But this is just the same:

    invoices
    |> Enum.flat_map(& &1.items)
    |> Enum.filter(&Invoices.Items.taxable?/1)
    |> Enum.map(& Map.put(&1, :tax, tax_for_value(&1.amount, &1.product_type)))
    |> Enum.split_with(& Decimal.equal?(&1.tax, 0))
    
    
    

    Aside from improving readability, splitting code out into pipes like this can make it easier to see the different parts of your logic.  Especially once you’ve created more than a few lines of pipes, it becomes easier to see how I can pull out different pieces when refactoring.  In the above, for example, you might decide to create a calculate_item_taxes function which takes a list of items and performs the logic of the Enum.map line.

    Performance

    You may have already thought of a counterpoint: when you pipe functions together, you end up creating new lists, which means more work to be done as well as more memory usage (which means more garbage collection).  This is absolutely true, and you should be thinking about this!

    But I find that 99% of the time, the data I’m working with makes the performance difference negligible.  If you find that your code is slow because of the amount of data that you need to process, you might try using the Stream module — it has many of the same functions as Enum , but works lazily.  If that doesn’t work, then by all means, create a reduce (and maybe put it into a well-named function)!

    As Joe Armstrong said:

    “Make it work, then make it beautiful, then if you really, really have to, make it fast.”

    For some information about benchmarks that I’ve run to understand this better, see this analysis and discussion .



    Good Opportunities for Enum.reduce

    Aside from occasional performance reasons, Enum.reduce can often be the simplest solution when you want to transform a data structure over a series of steps.  For example:

    Find Cases in Your Own Code with credo_unnecessary_reduce

    Remember that no one pattern works in all cases, so know what tools you have available! If you’d like to quickly find instances for potential improvements in readability, I built a Credo check to help spot where reduce can be swapped for something simpler.

    You can drop it into your project and start catching these anti-patterns automatically.

    https://github.com/cheerfulstoic/credo_unnecessary_reduce

    Simply add it to your mix.exs file:


    {:credo_unnecessary_reduce, "~> 0.1.0"}
    

    …and then enable it in your .credo.exs file:


    {CredounnecessaryReduce.Check, []}
    

    The post Reduce, Reuse… Refactor: Clearer Elixir with the Enum Module appeared first on Erlang Solutions .

    • Pl chevron_right

      Erlang Solutions: Reduce, Reuse… Refactor: Clearer Elixir with the Enum Module

      news.movim.eu / PlanetJabber • 24 April 2025 • 4 minutes

    “When an operation cannot be expressed by any of the functions in the Enum module, developers will most likely resort to reduce/3.”

    -From the docs for Enum.reduce/3

    In many Elixir applications, I find Enum.reduce is used frequently. Enum.reduce can do anything, but that doesn’t mean it should. In many cases, other Enum functions are more readable, practically as fast, and easier to refactor.

    I would also like to discuss situations that are a good fit for Enum.reduce and also introduce you to a custom credo check I’ve created, which can help you identify places where Enum.reduce could be replaced with a simpler option.

    Readability

    Here are a few common reduce patterns—and their simpler alternatives.  For example, here’s something I see quite often:

    Enum.reduce(numbers, [], fn i, result -> [i * 10 | result] end)
    |> Enum.reverse()
    
    

    This is a situation that the Enum.map function was designed for:

    Enum.map(numbers, & &1 * 10)
    

    Perhaps you know about Enum.map , but you might see a call to reduce like this:

    Enum.reduce(numbers, 0, fn number, result -> (number * 2) + result end)
    
    

    Let me introduce you to Enum.sum_by !


    Enum.sum_by(numbers, & &1 * 2)
    
    

    Let’s look at something a bit more complex:

    Enum.reduce(numbers, [], fn item, acc ->
      if rem(item, 2) == 0 do
        [item * 2 | acc]
      else
        acc
      end
    end)
    |> Enum.reverse()
    
    

    This is a perfect case for piping together two Enum functions:

    numbers
    |> Enum.filter(& rem(&1, 2) == 0)
    |> Enum.map(& &1 * 2)
    

    Another option for this case could even be to use Enum.flat_map :


    Enum.flat_map(numbers, fn number ->
      if rem(number, 2) == 0 do
        [number * 2]
      else
        []
      end
    end)
    
    

    This is a decent option, but while this achieves the purpose of both filtering and mapping in a single pass, it may not be as intuitive for everybody.

    Lastly, say you see something like this and think that it would be difficult to improve:

    Enum.reduce(invoices, {[], []}, fn invoice, result ->
      Enum.reduce(invoice.items, result, fn item, {no_tax, with_tax} ->
        if Invoices.Items.taxable?(item) do
          tax = tax_for_value(item.amount, item.product_type)
          item = Map.put(item, :tax, tax)
    
          if Decimal.equal?(tax, 0) do
            {no_tax ++ [item], with_tax}
          else
            {no_tax, with_tax ++ [item]}
          end
        else
          {no_tax, with_tax}
        end
      end)
    end)
    
    

    But this is just the same:

    invoices
    |> Enum.flat_map(& &1.items)
    |> Enum.filter(&Invoices.Items.taxable?/1)
    |> Enum.map(& Map.put(&1, :tax, tax_for_value(&1.amount, &1.product_type)))
    |> Enum.split_with(& Decimal.equal?(&1.tax, 0))
    
    
    

    Aside from improving readability, splitting code out into pipes like this can make it easier to see the different parts of your logic.  Especially once you’ve created more than a few lines of pipes, it becomes easier to see how I can pull out different pieces when refactoring.  In the above, for example, you might decide to create a calculate_item_taxes function which takes a list of items and performs the logic of the Enum.map line.

    Performance

    You may have already thought of a counterpoint: when you pipe functions together, you end up creating new lists, which means more work to be done as well as more memory usage (which means more garbage collection).  This is absolutely true, and you should be thinking about this!

    But I find that 99% of the time, the data I’m working with makes the performance difference negligible.  If you find that your code is slow because of the amount of data that you need to process, you might try using the Stream module — it has many of the same functions as Enum , but works lazily.  If that doesn’t work, then by all means, create a reduce (and maybe put it into a well-named function)!

    As Joe Armstrong said:

    “Make it work, then make it beautiful, then if you really, really have to, make it fast.”

    For some information about benchmarks that I’ve run to understand this better, see this analysis and discussion .



    Good Opportunities for Enum.reduce

    Aside from occasional performance reasons, Enum.reduce can often be the simplest solution when you want to transform a data structure over a series of steps.  For example:

    Find Cases in Your Own Code with credo_unnecessary_reduce

    Remember that no one pattern works in all cases, so know what tools you have available! If you’d like to quickly find instances for potential improvements in readability, I built a Credo check to help spot where reduce can be swapped for something simpler.

    You can drop it into your project and start catching these anti-patterns automatically.

    https://github.com/cheerfulstoic/credo_unnecessary_reduce

    Simply add it to your mix.exs file:


    {:credo_unnecessary_reduce, "~> 0.1.0"}
    

    …and then enable it in your .credo.exs file:


    {CredounnecessaryReduce.Check, []}
    

    The post Reduce, Reuse… Refactor: Clearer Elixir with the Enum Module appeared first on Erlang Solutions .

    • Pl chevron_right

      Erlang Solutions: Reduce, Reuse… Refactor: Clearer Elixir with the Enum Module

      news.movim.eu / PlanetJabber • 24 April 2025 • 4 minutes

    “When an operation cannot be expressed by any of the functions in the Enum module, developers will most likely resort to reduce/3.”

    -From the docs for Enum.reduce/3

    In many Elixir applications, I find Enum.reduce is used frequently. Enum.reduce can do anything, but that doesn’t mean it should. In many cases, other Enum functions are more readable, practically as fast, and easier to refactor.

    I would also like to discuss situations that are a good fit for Enum.reduce and also introduce you to a custom credo check I’ve created, which can help you identify places where Enum.reduce could be replaced with a simpler option.

    Readability

    Here are a few common reduce patterns—and their simpler alternatives.  For example, here’s something I see quite often:

    Enum.reduce(numbers, [], fn i, result -> [i * 10 | result] end)
    |> Enum.reverse()
    
    

    This is a situation that the Enum.map function was designed for:

    Enum.map(numbers, & &1 * 10)
    

    Perhaps you know about Enum.map , but you might see a call to reduce like this:

    Enum.reduce(numbers, 0, fn number, result -> (number * 2) + result end)
    
    

    Let me introduce you to Enum.sum_by !


    Enum.sum_by(numbers, & &1 * 2)
    
    

    Let’s look at something a bit more complex:

    Enum.reduce(numbers, [], fn item, acc ->
      if rem(item, 2) == 0 do
        [item * 2 | acc]
      else
        acc
      end
    end)
    |> Enum.reverse()
    
    

    This is a perfect case for piping together two Enum functions:

    numbers
    |> Enum.filter(& rem(&1, 2) == 0)
    |> Enum.map(& &1 * 2)
    

    Another option for this case could even be to use Enum.flat_map :


    Enum.flat_map(numbers, fn number ->
      if rem(number, 2) == 0 do
        [number * 2]
      else
        []
      end
    end)
    
    

    This is a decent option, but while this achieves the purpose of both filtering and mapping in a single pass, it may not be as intuitive for everybody.

    Lastly, say you see something like this and think that it would be difficult to improve:

    Enum.reduce(invoices, {[], []}, fn invoice, result ->
      Enum.reduce(invoice.items, result, fn item, {no_tax, with_tax} ->
        if Invoices.Items.taxable?(item) do
          tax = tax_for_value(item.amount, item.product_type)
          item = Map.put(item, :tax, tax)
    
          if Decimal.equal?(tax, 0) do
            {no_tax ++ [item], with_tax}
          else
            {no_tax, with_tax ++ [item]}
          end
        else
          {no_tax, with_tax}
        end
      end)
    end)
    
    

    But this is just the same:

    invoices
    |> Enum.flat_map(& &1.items)
    |> Enum.filter(&Invoices.Items.taxable?/1)
    |> Enum.map(& Map.put(&1, :tax, tax_for_value(&1.amount, &1.product_type)))
    |> Enum.split_with(& Decimal.equal?(&1.tax, 0))
    
    
    

    Aside from improving readability, splitting code out into pipes like this can make it easier to see the different parts of your logic.  Especially once you’ve created more than a few lines of pipes, it becomes easier to see how I can pull out different pieces when refactoring.  In the above, for example, you might decide to create a calculate_item_taxes function which takes a list of items and performs the logic of the Enum.map line.

    Performance

    You may have already thought of a counterpoint: when you pipe functions together, you end up creating new lists, which means more work to be done as well as more memory usage (which means more garbage collection).  This is absolutely true, and you should be thinking about this!

    But I find that 99% of the time, the data I’m working with makes the performance difference negligible.  If you find that your code is slow because of the amount of data that you need to process, you might try using the Stream module — it has many of the same functions as Enum , but works lazily.  If that doesn’t work, then by all means, create a reduce (and maybe put it into a well-named function)!

    As Joe Armstrong said:

    “Make it work, then make it beautiful, then if you really, really have to, make it fast.”

    For some information about benchmarks that I’ve run to understand this better, see this analysis and discussion .



    Good Opportunities for Enum.reduce

    Aside from occasional performance reasons, Enum.reduce can often be the simplest solution when you want to transform a data structure over a series of steps.  For example:

    Find Cases in Your Own Code with credo_unnecessary_reduce

    Remember that no one pattern works in all cases, so know what tools you have available! If you’d like to quickly find instances for potential improvements in readability, I built a Credo check to help spot where reduce can be swapped for something simpler.

    You can drop it into your project and start catching these anti-patterns automatically.

    https://github.com/cheerfulstoic/credo_unnecessary_reduce

    Simply add it to your mix.exs file:


    {:credo_unnecessary_reduce, "~> 0.1.0"}
    

    …and then enable it in your .credo.exs file:


    {CredounnecessaryReduce.Check, []}
    

    The post Reduce, Reuse… Refactor: Clearer Elixir with the Enum Module appeared first on Erlang Solutions .

    • Pl chevron_right

      Erlang Solutions: Erlang Solutions’ Blog round-up

      news.movim.eu / PlanetJabber • 17 April 2025 • 2 minutes

    The tech world doesn’t slow down, and neither do we. From the power of big data in healthcare to keeping you up-to-date about fintech compliance, our latest blog posts explore the important topics shaping today’s digital world.

    Whether you’re leading a business, building software, or just curious about the future of tech, check out what the Erlang Solutions team has been talking about.

    Understanding Big Data in Healthcare


    From smartwatches to digital patient records, healthcare is generating more data than ever before. In our post, Understanding Big Data in Healthcare , we explore how big data is transforming patient care—think predictive health trends, precision medicine, and smarter decision-making.

    We also dig into the challenges of handling sensitive information and how tech like Erlang, Elixir, and SAFE can help keep that data secure. It’s a must-read if you’re curious about how data is shaping the future of healthcare.

    Understanding Digital Wallets


    Digital wallets aren’t just convenient, but they’re quickly becoming essential. In Understanding Digital Wallets , we break down how they work, why they’re gaining momentum, and what they mean for businesses today.

    From improved security and cost savings to global access and smoother customer experiences, this blog gives a clear look at the benefits (and a few of the challenges) of going digital.

    Women in BEAM

    Lorena Mireles takes us through the key takeaways from her Women in BEAM survey, while also sharing her personal journey within the Elixir community.

    From representation gaps to the importance of strong role models, this piece highlights real experiences from developers in the BEAM ecosystem and why inclusion still matters in tech.

    Top 5 IoT Business Security Basics

    Billions of connected devices = billions of entry points for hackers. In Top 5 IoT Business Security Basics , we outline five practical tips to boost your IoT security:

    • Use strong, unique passwords
    • Encrypt your data
    • Run regular security audits
    • Train your team
    • Disable features you don’t use

    Simple, effective, and easy to implement—these tips will help you keep your systems (and customers) safe.

    DORA Compliance: What Fintech Businesses Need to Know


    Digital Operational Resilience Act (DORA) for fintech

    As of January 2025, the Digital Operational Resilience Act (DORA) is live, and if you’re in fintech, you need to be ready. Our post, DORA Compliance: What Fintech Businesses Need to Know , breaks down what DORA is, who it affects, and what steps you need to take to stay compliant (if you haven’t already).

    We explore its five key pillars and how to build a more resilient, disruption-proof business. With over 22,000 companies affected, it’s a timely read for anyone in the financial space.

    To conclude

    Staying ahead in tech doesn’t have to be overwhelming. Our goal? To make it easier for you to understand what’s happening and what it means for your business.

    Got questions? Let’s chat.

    The post Erlang Solutions’ Blog round-up appeared first on Erlang Solutions .

    • Pl chevron_right

      Erlang Solutions: Erlang Solutions’ Blog round-up

      news.movim.eu / PlanetJabber • 17 April 2025 • 2 minutes

    The tech world doesn’t slow down, and neither do we. From the power of big data in healthcare to keeping you up-to-date about fintech compliance, our latest blog posts explore the important topics shaping today’s digital world.

    Whether you’re leading a business, building software, or just curious about the future of tech, check out what the Erlang Solutions team has been talking about.

    Understanding Big Data in Healthcare


    From smartwatches to digital patient records, healthcare is generating more data than ever before. In our post, Understanding Big Data in Healthcare , we explore how big data is transforming patient care—think predictive health trends, precision medicine, and smarter decision-making.

    We also dig into the challenges of handling sensitive information and how tech like Erlang, Elixir, and SAFE can help keep that data secure. It’s a must-read if you’re curious about how data is shaping the future of healthcare.

    Understanding Digital Wallets


    Digital wallets aren’t just convenient, but they’re quickly becoming essential. In Understanding Digital Wallets , we break down how they work, why they’re gaining momentum, and what they mean for businesses today.

    From improved security and cost savings to global access and smoother customer experiences, this blog gives a clear look at the benefits (and a few of the challenges) of going digital.

    Women in BEAM

    Lorena Mireles takes us through the key takeaways from her Women in BEAM survey, while also sharing her personal journey within the Elixir community.

    From representation gaps to the importance of strong role models, this piece highlights real experiences from developers in the BEAM ecosystem and why inclusion still matters in tech.

    Top 5 IoT Business Security Basics

    Billions of connected devices = billions of entry points for hackers. In Top 5 IoT Business Security Basics , we outline five practical tips to boost your IoT security:

    • Use strong, unique passwords
    • Encrypt your data
    • Run regular security audits
    • Train your team
    • Disable features you don’t use

    Simple, effective, and easy to implement—these tips will help you keep your systems (and customers) safe.

    DORA Compliance: What Fintech Businesses Need to Know


    Digital Operational Resilience Act (DORA) for fintech

    As of January 2025, the Digital Operational Resilience Act (DORA) is live, and if you’re in fintech, you need to be ready. Our post, DORA Compliance: What Fintech Businesses Need to Know , breaks down what DORA is, who it affects, and what steps you need to take to stay compliant (if you haven’t already).

    We explore its five key pillars and how to build a more resilient, disruption-proof business. With over 22,000 companies affected, it’s a timely read for anyone in the financial space.

    To conclude

    Staying ahead in tech doesn’t have to be overwhelming. Our goal? To make it easier for you to understand what’s happening and what it means for your business.

    Got questions? Let’s chat.

    The post Erlang Solutions’ Blog round-up appeared first on Erlang Solutions .

    • Pl chevron_right

      Erlang Solutions: Erlang Solutions’ Blog round-up

      news.movim.eu / PlanetJabber • 17 April 2025 • 2 minutes

    The tech world doesn’t slow down, and neither do we. From the power of big data in healthcare to keeping you up-to-date about fintech compliance, our latest blog posts explore the important topics shaping today’s digital world.

    Whether you’re leading a business, building software, or just curious about the future of tech, check out what the Erlang Solutions team has been talking about.

    Understanding Big Data in Healthcare


    From smartwatches to digital patient records, healthcare is generating more data than ever before. In our post, Understanding Big Data in Healthcare , we explore how big data is transforming patient care—think predictive health trends, precision medicine, and smarter decision-making.

    We also dig into the challenges of handling sensitive information and how tech like Erlang, Elixir, and SAFE can help keep that data secure. It’s a must-read if you’re curious about how data is shaping the future of healthcare.

    Understanding Digital Wallets


    Digital wallets aren’t just convenient, but they’re quickly becoming essential. In Understanding Digital Wallets , we break down how they work, why they’re gaining momentum, and what they mean for businesses today.

    From improved security and cost savings to global access and smoother customer experiences, this blog gives a clear look at the benefits (and a few of the challenges) of going digital.

    Women in BEAM

    Lorena Mireles takes us through the key takeaways from her Women in BEAM survey, while also sharing her personal journey within the Elixir community.

    From representation gaps to the importance of strong role models, this piece highlights real experiences from developers in the BEAM ecosystem and why inclusion still matters in tech.

    Top 5 IoT Business Security Basics

    Billions of connected devices = billions of entry points for hackers. In Top 5 IoT Business Security Basics , we outline five practical tips to boost your IoT security:

    • Use strong, unique passwords
    • Encrypt your data
    • Run regular security audits
    • Train your team
    • Disable features you don’t use

    Simple, effective, and easy to implement—these tips will help you keep your systems (and customers) safe.

    DORA Compliance: What Fintech Businesses Need to Know


    Digital Operational Resilience Act (DORA) for fintech

    As of January 2025, the Digital Operational Resilience Act (DORA) is live, and if you’re in fintech, you need to be ready. Our post, DORA Compliance: What Fintech Businesses Need to Know , breaks down what DORA is, who it affects, and what steps you need to take to stay compliant (if you haven’t already).

    We explore its five key pillars and how to build a more resilient, disruption-proof business. With over 22,000 companies affected, it’s a timely read for anyone in the financial space.

    To conclude

    Staying ahead in tech doesn’t have to be overwhelming. Our goal? To make it easier for you to understand what’s happening and what it means for your business.

    Got questions? Let’s chat.

    The post Erlang Solutions’ Blog round-up appeared first on Erlang Solutions .