What is Nostr?
Clemens Brunner /
npub1zg3…qjc0
2024-12-02 10:06:44

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.
Author Public Key
npub1zg3833s0dcctfqt992gktdt6yn0jl4pw0yr02fq38u59a4dc0rwq6lqjc0