Skip Navigation

Happy Advent of Code 2024 Everyone!

Advent of Code 2024

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):

 
    
: 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:

I probably won't last the week, but what solutions I do have will be up on GitHub.

Comments

7

Comments

7