
mafinar
Advent of Code 2023 - Day 1
Hello! Advent of Year 2023 is upon us and like past few years, I’ll be opening threads discussing each year’s problems.
Day 1 was today. This was a rather interesting challenge for a day 1. Not as easy as others and the puzzle came with some sneaky edge cases. But regular expressions ftw!
Also this is the first time I am using Scala (or any other language than Elixir) to solve it. While I did not know how to deal with lookahead
on Scala Regex (shame on me), I did quite a nifty trick. Then I went ahead and did Elixir too.
Scala Version
Elixir Version
advent_of_code/lib/2023/day_01.ex at master · code-shoily/advent_of_code (github.com)
There is an interesting difference - Scala one uses two regex patterns (one inverse of the other) while Elixir uses the simpler lookahead regex. I blame my lack of Scala library knowledge here.
See on around Day 2.
Popular Backend topics










Other popular topics









Latest in Chat
Latest (all)
Categories:
Popular Portals
- /elixir
- /rust
- /wasm
- /ruby
- /erlang
- /phoenix
- /keyboards
- /js
- /rails
- /python
- /security
- /go
- /swift
- /vim
- /clojure
- /java
- /haskell
- /emacs
- /svelte
- /onivim
- /typescript
- /crystal
- /c-plus-plus
- /tailwind
- /kotlin
- /gleam
- /react
- /flutter
- /elm
- /ocaml
- /vscode
- /opensuse
- /ash
- /centos
- /php
- /deepseek
- /zig
- /scala
- /html
- /debian
- /nixos
- /lisp
- /agda
- /react-native
- /sublime-text
- /textmate
- /kubuntu
- /arch-linux
- /revery
- /ubuntu
- /manjaro
- /spring
- /django
- /diversity
- /nodejs
- /lua
- /c
- /julia
- /slackware
- /neovim