Tootfinder

Opt-in global Mastodon full text search. Join the index!

@jamesthebard@social.linux.pizza
2025-12-07 18:18:30
Content warning: Advent of Code Solution - Day 7 (Nim)

I'm so glad I'm writing the solutions in both #nim and Python because I tend to find ways to improve the Python solution with the Nim one and vice versa. Today was one of those days. The biggest thing I learned though is that solving these damned puzzles exhausted will never lead to good things quality-wise.
Solution:

@jamesthebard@social.linux.pizza
2025-12-03 05:29:04
Content warning: Advent of Code - Day 2 (Nim)

This solve felt more like #nim and less like me writing Python. More uses of `map` and `apply`, using `if/then` as a proper ternary, integer -> string conversions, etc. Also the `sugar` module makes me a happy person.
The day 2 solution in Nim:

@jamesthebard@social.linux.pizza
2025-12-05 18:55:16
Content warning: Advent of Code Solution - Day 5 (Nim)

This took waaaay too long because I kept overlooking a glaring mistake at the range reduction algorithm, but once I saw it things went much more smoothly.
The #nim solution actually optimizes the range reduction step and comes in under a millisecond to execute which was nice.
Solution:

@jamesthebard@social.linux.pizza
2025-11-17 05:10:07

Today I learned about the true power of macros...and holy crap, they are awesome. Started back on the Z80 emulator and wondered if there was a way to reference procs in Nim using strings. Did some searching and came across someone who did something very similar and it never crossed my mind to even try this.
#nim

A simple macro to assign procedures to a lookup table so they can be referenced via string.
@jamesthebard@social.linux.pizza
2025-12-03 17:29:12
Content warning: Advent of Code - Day 3 (Nim)

The #nim solution looks very similar to the Python one, but that works out well enough as the method works great on both. Didn't check to see if Nim had a `for/else` construction, but a friend threatened me with death if I tried.
Solution:

@jamesthebard@social.linux.pizza
2025-12-08 04:02:00

A quick comparison using `hyperfine` for some benchmarking on the #adventofcode 2025 Day 1 solution. Not too shabby for any of the solutions, and its interesting to compare them.
#rust #nim

A screenshot of the README.md for the AoC repo showing benchmarks comparing the solutions in different languages.