- cross-posted to:
- lobsters@lemmy.bestiver.se
- cross-posted to:
- lobsters@lemmy.bestiver.se
Alright, show me I’m not the only one in this community, and show off some solutions!
Here’s my Day 1 solution in Factor (minus imports):
spoiler
: get-input ( -- left-list right-list )
"aoc-2024.01" "input.txt" vocab-file-lines
[ split-words harvest ] map unzip
[ [ string>number ] map ] bi@ ;
: part1 ( -- n )
get-input
[ sort ] bi@
[ - abs ] 2map-sum ;
: part2 ( -- n )
get-input
histogram
'[ dup _ at 0 or * ] map-sum ;
Sadly, Factor doesn’t get highlighted properly here, so here it is again as an image:
spoiler
I probably won’t last the week, but what solutions I do have will be up on GitHub.
Some more Factor solutions for the first 3 days (so far) from soweli Niko, on Codeberg.