Algo - a Ramda.js-like library of utility functions

Ramda is a popular FP utility library for JavaScript. I’ve made Algo in a similar vein for Elixir.

Elixir already has an excellent standard library, and Enum along with Kernel.put_in and related functions go a long way. But I found that it’s still less than trivial to do a lot of transformations when working with nested maps and keyword lists, deep-merging data, or chunking lists based on adjacent elements. I haven’t found an Elixir library that conveniently packages all of that like Ramda, so I made Algo.

The idea is to replace common, boilerplatey code with more compact, more descriptive functions. For example, you could transform some nested map values like this:

normalised_user = Algo.evolve(user, %{
  profile: %{
    age: &String.to_integer/1
  },
  metadata: %{
    score: &round/1
  }
})

There are also functions like deep_merge_right for deep merging, each_depth_first for a depth-first traversal, and so on. The functions for nested data structures work on both maps and keyword lists.

Additionally, there is a bunch of functions for working with lists, for example:

iex> Algo.List.chunk_while_adjacent([1, 2, 3, 1, 2], fn left, right -> right == left + 1 end)
[[1, 2, 3], [1, 2]]

iex> Algo.List.get_permutations([1, 2, 3])
[[1, 2, 3], [1, 3, 2], [2, 1, 3], [2, 3, 1], [3, 1, 2], [3, 2, 1]]

I hope it’s useful.

Blog post with more details and examples: https://korban.net/posts/2026-05-20-algo-ramda-like-elixir-package

Docs: https://hexdocs.pm/algo
Hex package: https://hex.pm/packages/algo

Repo:

4 Likes

Looks nice!

The blog post URL gives a 404, it should be https://korban.net/posts/2026-05-20-algo-ramda-like-elixir-package

I am curious: why did you implement both verb-style and result-noun-style functions? I would strongly prefer the latter as well, and have advocated for that even in Ruby projects.

1 Like

In addition to this I don’t like all the alias for different functions. There is intersection_by/3 which is just an alias for intersect_by/3. If I want to refactor something I have to remember to grep for all alias versions of the same function.

1 Like

Sorry about that, fixed.

I think most people are more used to and prefer verb-style naming - even the Elixir standard library uses it. That’s why I made that the main style, but I wanted to have noun-style naming for myself.

In general I also prefer not to have multiple ways of doing the same thing. That’s why I didn’t put Algo.Alt aliases in the same namespace. You’d have to make extra effort to mix them up with the verb-based versions, so it seems OK to me.

Since I’m working on an application with lots of other developers I can 100% guarantee that people would choose ALL the different flavours of any given function.

1 Like

Nice! I wonder if I could utilize it in next Advent of Code. :thinking: