(fieldrx (regex-compile ;; using a regex object here messes with emacs syntax highlighting
"([^,\"\']*(\"([^\"]|\\\\\")*\"|\'([^\']|\\\\\')*\'|)[^,\"\']*)+"))
I understand that here using the #/.../ regex literal object didn't look right in your Emacs, so you dynamically compiled from a string literal.But that now happens each time you call the function.
Lisp has your back here; we can hoist the compilation of the regex to load time using load-time:
(fieldrx (load-time (regex-compile "...RE...")))
load-time makes a difference in interpreted code, not just compiled files. Even in interpreted code, the regex-compile expression will be evaluated once only and then the cached value used: 1> (dotimes (i 5) (prinl "hi"))
"hi"
"hi"
"hi"
"hi"
"hi"
nil
2> (dotimes (i 5) (load-time (prinl "hi")))
"hi"
nilI'm happy to try to use it for Advent of Code 2024, but it would help if I could at least get oriented so I'm not going in totally cold (and thereby likely to fall off the wagon after 3 days because each one takes 2 hours in an unfamiliar language).
The data science use case is particularly interesting and not something I had considered here. Arrow bindings help immensely. Of course at work I'll probably never get a chance to use anything other than Python and R for many years to come; maybe Julia is the most exotic I think I'd ever be able to go, and that's only if I ever hit a performance bottleneck in Python that can't be remediated with Numba.
https://www.kylheku.com/cgit/advent/tree
That gives a flavor of how those kinds of problems can be approached.
The solutions are all self-contained; they don't share any AoC-specific library or anything, and were developed with a throwaway program mindset, where we just solve that problem and don't try to produce anything that is reusable other than by copy paste into the next program.