minion's recent activity
-
Comment on Anyone interested in trying out Kagi? in ~tech
-
Comment on Anyone interested in trying out Kagi? in ~tech
-
Comment on Day 3: Mull It Over in ~comp.advent_of_code
minion Ahh, I quite like the approach here of parsing out all of the valid functions in a single regex and then looping through functions ... it seems more elegant than the string manipulation I did on...Ahh, I quite like the approach here of parsing out all of the valid functions in a single regex and then looping through functions ... it seems more elegant than the string manipulation I did on part 2 (and possibly scales better if this does turn out to be another intcode computer thing?)
-
Comment on Day 3: Mull It Over in ~comp.advent_of_code
minion I, like many of you, used regex for this, however had to take a quick detour to get "quicklisp" - what appears to be a package manager for common lisp libraries - as common lisp doesn't have a...I, like many of you, used regex for this, however had to take a quick detour to get "quicklisp" - what appears to be a package manager for common lisp libraries - as common lisp doesn't have a regex library builtin.
That said, part 1 was fairly simple once I'd done that, with the slight convolution that as there was no function to both get capture groups and get multiple matches at the same time I resorted to two passes with the same regex.
Part 2 gave me more trouble, until I remembered that (loop) existed and things are mutable and I could just bang out something to get the active parts of the string in much the same way as I could python. I also looked at a pure regex solution and a range-based solution but this turned out to be a relatively easy implementation by comparison. I pity my friend who is writing this in nix for what I am certain must be a horrible recursive function.
My code
(require 'uiop) ; Please install quicklisp on your own time from https://common-lisp-libraries.readthedocs.io/quicklisp/ (ql:quickload "cl-ppcre") (defun mul-instructions (str) (ppcre:all-matches-as-strings "mul\\(([0-9]+),([0-9]+)\\)" str)) (defun get-enabled-portion (str) (let ( (disables (ppcre:all-matches "don't\\(\\)" str)) (enables (ppcre:all-matches "do\\(\\)" str)) (result "") (enabled t)) (progn (loop for index from 0 for c in (coerce str 'list) do (progn (when (equal (first disables) index) (setq enabled nil) (pop disables)) (when (equal (first enables) index) (setq enabled t) (pop enables)) (when enabled (setq result (concatenate 'string result (list c)))))) result))) (defun numbers-to-multiply (instruction) (ppcre:register-groups-bind ((#'parse-integer num1 num2)) ("mul\\(([0-9]+),([0-9]+)\\)" instruction :sharedp t) (list num1 num2))) (defun all-multiplications (str) (mapcar #'numbers-to-multiply (mul-instructions str))) (defun part1 (filename) (let* ( (str (uiop:read-file-string filename)) (multiplications (all-multiplications str)) (multiplied (mapcar (lambda (nums) (reduce #'* nums)) multiplications)) (total (reduce #'+ multiplied))) total)) (defun part2 (filename) (let* ( (str (uiop:read-file-string filename)) (active (get-enabled-portion str)) (multiplications (all-multiplications active)) (multiplied (mapcar (lambda (nums) (reduce #'* nums)) multiplications)) (total (reduce #'+ multiplied))) total))
-
Comment on Day 2: Red-Nosed Reports in ~comp.advent_of_code
minion Back again writing lisp! The code for today is definitely worse than on day 1, and I spent a silly amount of time trying to over engineer a problem dampener to blow a fuse at the first sign of an...Back again writing lisp!
The code for today is definitely worse than on day 1, and I spent a silly amount of time trying to over engineer a problem dampener to blow a fuse at the first sign of an error rather than doing the naive solution.
That said, I spent a lot less time tripping over the language today, although I did get confused about some finer points of loops and appending to lists
My code
(require 'uiop) (defun contentful-file-lines (filename) (let* ( (content (uiop:read-file-lines filename)) (lines-without-empties (remove-if (lambda (str) (string= "" str)) content))) lines-without-empties)) (defun space-split (str) (uiop:split-string str :separator " ")) (defun to-integers (strings) (mapcar #'parse-integer strings)) (defun lists-to-integers (lists) (mapcar #'to-integers lists)) (defun reports (filename) (let* ( (lines (contentful-file-lines filename)) (digits (mapcar #'space-split lines)) (reports (lists-to-integers digits))) reports)) (defun difference-safe (cur prev increasing) (list (and (and (> (abs (- prev cur)) 0) (< (abs (- prev cur)) 4)) (equal increasing (> 0 (- cur prev)))) cur increasing)) ; I tried something clever here to automatically do the problem damper ; I faced trouble with removing the first item and also changing the direction of the list after removing the second item (defun safe (report) (first (reduce (lambda (prev digit) (if (first prev) (difference-safe digit (second prev) (third prev)) (list nil))) (cdr report) :initial-value (list t (first report) (> 0 (- (second report) (first report))))))) (defun part1 (filename) (let* ( (reports (reports filename)) (report-safeties (mapcar (lambda (report) (safe report)) reports)) (total (reduce (lambda (c safe) (+ c (if safe 1 0))) report-safeties :initial-value 0))) total)) (defun any (booleans) (reduce (lambda (i1 i2) (or i1 i2)) booleans :initial-value nil)) (defun sublists (items) (let ( (before '())) (loop :for i :on items :collect (concatenate 'list (reverse before) (cdr i)) :do (push (first i) before)))) (defun safe-with-dampener (report) (any (mapcar #'safe (append (list report) (sublists report))))) (defun part2 (filename) (let* ( (reports (reports filename)) (report-safeties (mapcar (lambda (report) (safe-with-dampener report)) reports)) (total (reduce (lambda (c safe) (+ c (if safe 1 0))) report-safeties :initial-value 0))) total))
-
Comment on Day 1: Historian Hysteria in ~comp.advent_of_code
minion I wanted to learn lisp, so I decided "hey, why not do Advent of Code in it" Day 1 started with me grasping at straws, trying to make anything work at all, and ended with me having some fun,...I wanted to learn lisp, so I decided "hey, why not do Advent of Code in it"
Day 1 started with me grasping at straws, trying to make anything work at all, and ended with me having some fun, getting into a bit of a flow and writing some lisp
My solution
(require 'uiop) (defun contentful-file-lines (filename) (let* ( (content (uiop:read-file-lines filename)) (lines-without-empties (remove-if (lambda (str) (string= "" str)) content))) lines-without-empties)) (defun space-split (str) (uiop:split-string str :separator " ")) (defun file-lists (filename) (let* ( (lines (contentful-file-lines filename)) (split-lines (mapcar #'space-split lines)) (lists (apply #'mapcar #'list split-lines))) lists)) (defun lr-lists (filename) (let ((lists (file-lists filename))) (list (first lists) (first (last lists))))) (defun to-integers (strings) (mapcar #'parse-integer strings)) (defun lists-to-integers (lists) (mapcar #'to-integers lists)) (defun numerical-lr-lists (filename) (lists-to-integers (lr-lists filename))) (defun sort-lists (lists) (mapcar (lambda (l) (sort l #'<)) lists)) (defun sorted-lr-lists (filename) (sort-lists (numerical-lr-lists filename))) (defun list-differences (lists) (apply #'mapcar (lambda (i1 i2) (abs (- i1 i2))) lists)) (defun sum (numbers) (reduce #'+ numbers)) (defun part1 (filename) (let* ( (lr (sorted-lr-lists filename)) (differences (list-differences lr)) (total (sum differences))) total)) (defun digit-counts (integers) (let ((counts (make-hash-table))) (progn (loop for digit in integers do (if (gethash digit counts) (setf (gethash digit counts) (+ (gethash digit counts) 1)) (setf (gethash digit counts) 1)))) counts)) (defun score-list (lr) (let* ( (counts (digit-counts (second lr))) (scores (mapcar (lambda (num) (* (gethash num counts 0) num)) (first lr)))) scores)) (defun part2 (filename) (let* ( (lr (numerical-lr-lists filename)) (scores (score-list lr)) (total (sum scores))) total))
-
Comment on Kobo for a casual reader in ~books
minion I love my Kobo ... for all of the reasons that you've given as features that you don't care about. For me, those features are defining qualities on which it is better than Kindle. It sounds like...I love my Kobo ... for all of the reasons that you've given as features that you don't care about. For me, those features are defining qualities on which it is better than Kindle. It sounds like you don't need the things that make Kobo great. I would suggest sticking with your Kindle.
-
Comment on Best way to voice call and screenshare with audio on Linux? in ~comp
minion Not original commenter but no, it doesn't. To get around this I usually use helvum or similar tools to patch my audio into my mic. It's not ideal but it works ... of course Discord then applies...Not original commenter but no, it doesn't. To get around this I usually use
helvum
or similar tools to patch my audio into my mic. It's not ideal but it works ... of course Discord then applies things like noise cancellation to your mic audio which also needs to be turned off ... as I said, not ideal -
Comment on Do you have any game sub-genres that you have a name for, but aren't big enough to be "official" sub-genres? in ~games
minion I have not played Sanctum or Dungeon defenders, but from your description I immediately thought of Mindustry. It bills itself as "a sandbox tower defense game". While there are enemies during the...I have not played Sanctum or Dungeon defenders, but from your description I immediately thought of Mindustry. It bills itself as "a sandbox tower defense game". While there are enemies during the waves very little else changes: you can still build, collect resources, and attack the enemies.
-
Comment on What are some significant numbers or juxtapositions of numbers and quantities you often notices? in ~talk
minion The username I've used everywhere for half my life is "Minion3665". I don't know where the 3665 came from, probably it was randomly added after "Minion" was taken, but for years I've noticed and...The username I've used everywhere for half my life is "Minion3665".
I don't know where the 3665 came from, probably it was randomly added after "Minion" was taken, but for years I've noticed and used the number 3665 everywhere.
Whenever I see it I have this immediate thought of "oh, that's me!" before I see what it's actually about.
Nowadays I tend to use only "minion" if it's available, but I still always notice the number 3665.
That looks like what happens if you turn on the new "debug translations" feature ... It's weird that that'd be on without you manually turning it on though.
Still, nonetheless, as a first step you could make sure your interface language (second from the top) and this debug setting (at the bottom) are correct in the general settings page.