Advent of Code
Day 1 This question is about finding the first and last “digit” which could be written as number or word and computing the sum over all input lines. My attempt with julia: digits_lookup = Dict( "0" => 0, "1" => 1, "2" => 2, "3" => 3, "4" => 4, "5" => 5, "6" => 6, "7" => 7, "8" => 8, "9" => 9, "zero" => 0, "one" => 1, "two" => 2, "three" => 3, "four" => 4, "five" => 5, "six" => 6, "seven" => 7, "eight" => 8, "nine" => 9 ) function parse_number(line) out, digit = 0, 0 for i in eachindex(line) for (k, v) in digits_lookup if line[i:min(i+length(k)-1, length(line))] == k digit = v break end end out = out > 0 ?...