I’ve been diving deeper into problem-solving using Elixir and its functional programming paradigm. From string manipulations to complex algorithms, Elixir provides a unique way of thinking about solutions.
I’d like to start a discussion where we can:
Share interesting problems you’ve solved using Elixir.
Discuss idiomatic patterns for common challenges (e.g., recursion, data transformation).
Explore different ways to optimize solutions for performance and readability.
For example, I recently solved a problem involving:
Splitting a string into parts based on specific characters.
Performing transformations like mapping characters to values.
Just to piggy back the above, tehre’s also LeetCode which has support for Elixir solutions on many problems. It’s been fun to solve them in Elixir and other languages to see how the language influences the mindset.
What is the goal of that repo? I’ve took a look at a few problems and they are solved by skewing the language onto the imperative solution that was initially designed.
The repo is for learning purposes. I’m not really sure if my solutions work properly, but by tackling each problem, I will definitely learn something. Of course, if you see any implementation I did, it’s probably not the most optimized solution.
I am learning the language by solving data structure problems and would love to engage with others who are on a similar journey. I’m also interested in building new projects or contributing to open-source initiatives.
Engagement provided: I eye-balled your List_processing.ex and… using length and Enum.at are basically anti-patterns. They have O(n) complexity and should be avoided at all costs – which is possible most of the time. You could do the Exercism list exercises and you have mentors there; they can steer you in the right direction.
And why does your file have a capital letter in its name when f.ex. macOS makes no difference between List_processing.ex and list_processing.ex (or at least that used to be the case before, nowadays I am no longer sure) but Linux does make that difference – you are setting yourself up for a hard-to-track disaster. Just don’t. Always use lower-cased file names.
Thank you very much for the observation, that was exactly my comment, but oriented towards professionals in the domain (maybe in the not most constructive way).
It could be a constructive way to engage IMO, because many people latch onto appeals to authority and they want to emulate what they perceive to be a better / bigger talent than theirs. Sometimes they are even right.
…But I personally would find that argument unconvincing; to me the highest levels in any creative / engineering profession are characterized by the simple saying of:
Learn all the rules so you can break them.
That’s why I said that length and Enum.at are an anti-pattern… most of the time.
From my very limited interactions with language and/or high-profile library maintainers, they actually respect people who are not dazzled by their work and engage better with you when you attack their decision in an informed and critically thinking manner.
You’ve made great points! I agree that appealing to authority can motivate some people, but critical thinking is key. The saying “Learn all the rules so you can break them” really captures how mastery leads to innovation.
As for Enum.at and similar patterns, context is everything—they aren’t bad inherently, but often overused. And I completely agree about maintainers: respectful, informed critiques lead to the best discussions.
You can execute the logic without spawning processes here, but I want to experiment with concurrency. In this case, one process (thread) executes something, while another waits for it to complete quickly. For example, in the code provided, the is_tree function spawns a new process to check the left subtree and sends the result back. Meanwhile, the main process waits for the result and continues processing the right subtree if necessary.
I have used Elixir to read data from 4 different data sources and provide processed, summarized information in an output sink. Elixir helped immensely in building this pipeline.
The volume of data was medium (billions of rows)- SQL and files (Erlang External Term Format).
Used Flow to process data concurrently, Explorer to store intermediate information into CSV and then merged/joined/etc and Flow again to send them their merry ways. Ecto for the SQL bits.
Had good use of VegaLite to understand data and tweak concurrency level (didn’t need to but it was fun).
LiveBook was the environment all of them ran. This was my bread and butter for better part of last year.
Sorry for being rather abstract since it’s “work project” but the pattern is generic enough to give y’all ideas on how Elixir can help in solving problems.
And if you want smaller, isolated problems, then there’s always Advent of Code, and if you click on any posts here tagged advent-of-code or variations of it, you will surely find amazing people solving amazing problems and sharing their thought process. I know I was helped by it!