ealmz
Hey y’all. Long time reader of the forum. I’m new to Elixir and I’m hoping writing technical blog posts will help me solidify my understanding.
I was wondering if anyone could take a look at a draft I wrote here: https://github.com/ealmz/elixir_from_first_principles/blob/master/reduce.md
It’s basically my current understanding of how reduce in Elixir works. I’m aware that there are many gaps in my knowledge but I’d love to hear what you think, especially strong critical feedback of how to make this post better.
What I think I’m missing:
- How Elixir’s reduce method compares to those in other languages
- Why reduce is important? In other words, what are the alternative ways to solve for the problem
reduceaddresses if not in this way. - Core CS concepts I’m unaware of.
What are your thoughts on that list or what else do you think I should address to really get at the core of what this function is doing?
Trending in Chat/Questions
Other Trending Topics
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
Hi there! We created Gust: A task orchestrator inspired by Airflow.
For those who have never heard about Aiflow, it’s a Python-based wor...
New
Hi everyone!
The first release candidate for the Expert language server project is now available!
We’ve published a press release detai...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixirconf-us
- #ai
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #metaprogramming
- #hex
- #security










Showing Posts 1 to 3- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
hauleth
Reduce (also know as left fold) is a way to “loop” in FP. It is defined as (in general case, not exactly in Elixir):
This is very basic operation, as from there you can define all other operations:
In other words -
reduceis another way to represent TCO-recursive function.NobbZ
Some things in your post:
Enum.reduce/2will use the head of the input as initial accumulator, while reducing over the tail. The head is not included in the reduction, but in your post you suggest it were.Those are the 2 points that I stumbled over.
ealmz
TCO was the rabbit hole I was looking for. Thanks!