woolfred
Trending in Challenges
Other Trending Topics
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
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
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
With AI doing more of the implementation work, I’ve been wondering how much coding I should deliberately keep doing myself.
My main conc...
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
- #hex
- #security
- #metaprogramming










Showing Posts 1 to 10- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
woolfred
Here is my first attempt, which uses specific reduces for the task at hand: advent-of-code/elixir/lib/aoc22/day01.ex at b4357a22f3a53bb46e4a98852eef4049ab1b1ec6 · woolfred/advent-of-code · GitHub
Afterwards I refactored it a bit, which makes it less efficient for Part 1, but favours readability:
https://github.com/woolfred/advent-of-code/blob/master/elixir/lib/aoc22/day01.ex
mudasobwa
Isn’t this code losing the latest elf?
woolfred
Good catch! This would be the case if the last elf wouldn’t end with an empty line like the others.
But luckily this is the case and therefore the elf is also added to the elves list.
Edit:
From the specs:
So @mudasobwa you are right and if the input generator would be working like this, there shouldn’t be a empty line after the last elf.
egze
There is a leaderboard from last year that we can reuse. (shared with users of Erlang Forums ) /cc @bjorng
https://adventofcode.com/2022/leaderboard/private/view/370884
The entry code is:
370884-a6a71927Arzar
Here is my attempt
It took me longer than expected, because I though Stream or Enum already have a function that split a list by token, so I spend a long time looking for it. In the end I settled on chunk_by + reject,
kwando
I used
Stream.chunk_everypesnk
I used a very naive approach, I believe using chunk can turn out to be a better solution
Part 1
Part 2
weeksseth
Mine is similar to @pesnk. Code and blog
Menkir
Quickly in IEX
jazzyer
Pretty quick one here: