yooncon
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:
Most Liked
scivi
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.
FlyingNoodle
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.
FlyingNoodle
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.
Popular in Announcing
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance









