Clemens Brunner on Nostr: Here's my #AdventOfCode Day 2 solution in #Julia: ...
Here's my #AdventOfCode Day 2 solution in #Julia:
https://github.com/cbrnr/aoc2024/blob/main/02.jl
I used the `InvertedIndices` module, which allowed me to elegantly exclude a single element from a vector. For example, to subset a vector `x` without the third item:
x[Not(3)]
(This is equivalent to x[-3] in #RStats.)
I also used the short-circuiting `&&` to make the function `is_valid()` appear less nested.
https://github.com/cbrnr/aoc2024/blob/main/02.jl
I used the `InvertedIndices` module, which allowed me to elegantly exclude a single element from a vector. For example, to subset a vector `x` without the third item:
x[Not(3)]
(This is equivalent to x[-3] in #RStats.)
I also used the short-circuiting `&&` to make the function `is_valid()` appear less nested.