Piotr_Klibert

joined 11 months ago
[–] Piotr_Klibert@alien.top 1 points 11 months ago

You could have just tried any of previous years of AOC. Just go to their webpage and start doing them.

I did just that, to see how "viable" Elisp would be. I solved this: https://adventofcode.com/2022/day/1

with:

(cl-labels
    ((split-to-numbers (lst)
       (--map (->> (s-split "\n" it) (-map #'string-to-number)) lst)))
  (skip-chars-forward " \t\n")
  (let* ((input (buffer-substring-no-properties (point) (point-max)))
         (subs (->> input s-trim (s-split "\n\n") split-to-numbers))
         (sorted (cl-sort (-map #'-sum subs) #'>)))
    (message "Winner: %s" (car sorted))))

and then with:

(save-excursion
  (calc-pop (calc-stack-size))
  (while (progn (skip-chars-forward " \t\n") (not (eobp)))
    (save-selected-window
      (calc-grab-region (point) (progn (forward-paragraph) (point)) nil)
      (calc-eval "VR+" 'macro)))
  (calc-pack (calc-stack-size))
  (calc-vector-max nil)
  (calc-top-n 1))

which turned out to be ~1000 times slower, but also worked.

So u/domsch1988, it's demonstrably doable in Elisp :)

[–] Piotr_Klibert@alien.top 1 points 11 months ago

Related (scrutinizes the same quote "y’all are going to send me emails linking to it otherwise"): https://danluu.com/keyboard-v-mouse/