Very happy with my final solution for today's Advent of Code problem. I used the parseq parser combinator library to chew through the input and get a clean series of multiplied numbers, and :do/:don-t symbols.

https://github.com/coderfrog256/AdventOfCode/blob/main/2024/lisp/Day3.lisp

My first solution was to throw regexes at it, which worked but was not quite as clean.

Next up I'll be looking into how best to write this in Clojure, the loop with mutable state is definitely out! :p

#adventofcode #lisp #parseq #parsing #programming

AdventOfCode/2024/lisp/Day3.lisp at main · coderfrog256/AdventOfCode

Advent Of Code Snippets and Solutions. Contribute to coderfrog256/AdventOfCode development by creating an account on GitHub.

GitHub

I start trying #parseq.

(defpackage #:apertium-stream-parser (:use #:cl #:parseq)) (in-package :apertium-stream-parser) (defrule stream () (char "a-z")) (trace-rule 'stream :recursive t) (parseq 'stream "a" :parse-error t)
Soapbox