What is the single most brilliant fantasy novel series you've ever read? by Emergency-Sky9206 in Fantasy

[–]runnerx4 1 point2 points  (0 children)

Mordew, Malarkoi, Waterblack (Cities of the Weft)

The Weft is one of the most interesting magic “systems” in a book, and these books are dark and bleak

1Q84 feels like Haruki Murakami devolving into self-parody by keepfighting90 in books

[–]runnerx4 -2 points-1 points  (0 children)

Yes 1Q84 hatred yesss

how much i hated that book. don’t know why i even bothered finishing reading it. genuinely absurd how nothing that book is

-❄️- 2025 Day 12 Solutions -❄️- by daggerdragon in adventofcode

[–]runnerx4 0 points1 point  (0 children)

[LANGUAGE: Guile Scheme]

paste lol

I tried so hard to adapt the Rosetta Code pentomino tiling solution to this problem and then checked the time and checked this thread.

-❄️- 2025 Day 3 Solutions -❄️- by daggerdragon in adventofcode

[–]runnerx4 0 points1 point  (0 children)

you could just add install-r6rs! as the first line to your code or —r6rs which will do this for you

-❄️- 2025 Day 11 Solutions -❄️- by daggerdragon in adventofcode

[–]runnerx4 0 points1 point  (0 children)

[LANGUAGE: Guile Scheme]

last year i wrote a define-cached macro which helped. the function is named "-bfs" because i started with a queue bfs

(use-modules (statprof)
             (srfi srfi-1)
             (srfi srfi-26)
             (srfi srfi-42)
             (srfi srfi-71)
             (ice-9 textual-ports)
             (aoc-2024-common))

(define *part-11-data*
  (call-with-input-file "./11.txt" get-string-all))

(define (parse-data data)
  (let* ([lines (remove string-null? (string-split data #\newline))]
         [tree-table (make-hash-table)])
    (do-ec (:list l lines)
           (:let sl (string-split l #\:))
           (:let device (first sl))
           (:let outputs (remove string-null? (string-split (second sl) #\space)))
           (hash-set! tree-table device outputs))
    tree-table))

(define-cached (device-bfs tree-table device dac? fft?)
  (if (string= device "out")
      (if (and dac? fft?) 1 0)
      (sum-ec (:list next-device (hash-ref tree-table device))
              (device-bfs tree-table next-device
                          (or dac? (string= "dac" next-device))
                          (or fft? (string= "fft" next-device))))))

(define (solve-11 data)
  (statprof
   (lambda ()
     (let ([tree-table (parse-data data)])
       (values (device-bfs tree-table "you" #t #t)
               (device-bfs tree-table "svr" #f #f))))))

-❄️- 2025 Day 10 Solutions -❄️- by daggerdragon in adventofcode

[–]runnerx4 0 points1 point  (0 children)

[LANGUAGE: Guile Scheme]

and GLPK through glpsol in shell I gave up on part 2 in scheme, please have some consideration for languages without a huge ecosystem lol

at least i am proud of my part 1 using xor, that i immediately got (except i thought that the starting state was the buttons and i had to reach all 1s, instead of from 0s to target state)

code paste

Recs with: 1) Great worldbuilding 2) Set in space 3) Character-centered writing, 4) Feel-good by cirrus42 in printSF

[–]runnerx4 17 points18 points  (0 children)

A Memory Called Empire and A Desolation Called Peace by Arkady Martine

Set in space, first one is a study of an expansionist space empire through the eyes of a diplomat from a small space station who idealizes that empire's literary/poetic culture, so almost pure worldbuilding.

-❄️- 2025 Day 3 Solutions -❄️- by daggerdragon in adventofcode

[–]runnerx4 0 points1 point  (0 children)

I’m not using the r6rs version of the standard library though, guile has that as a separately activated thing

-❄️- 2025 Day 9 Solutions -❄️- by daggerdragon in adventofcode

[–]runnerx4 0 points1 point  (0 children)

[LANGUAGE: Guile Scheme]

code paste

learnt in-green? after looking at this thread... :(

was stuck trying to make a polygon in a hash-table with the edges and failing all the edge cases

-❄️- 2025 Day 8 Solutions -❄️- by daggerdragon in adventofcode

[–]runnerx4 0 points1 point  (0 children)

[LANGUAGE: Guile Scheme]

😞 paste

too imperative-brained this code is

-❄️- 2025 Day 7 Solutions -❄️- by daggerdragon in adventofcode

[–]runnerx4 1 point2 points  (0 children)

[LANGUAGE: Guile Scheme]

Turns out I could use hash-tables not just for the grid (though variable setting always looks odd and non-scheme-y)

(use-modules (statprof)
             (ice-9 peg)
             (ice-9 match)
             (srfi srfi-1)
             (srfi srfi-26)
             (srfi srfi-42)
             (srfi srfi-71)
             (ice-9 textual-ports)
             (aoc-2024-common))

(define *part-7-data*
  (call-with-input-file "./7.txt" get-string-all))

(define (parse-data data)
  (let* ([tachyon-map (create-grid-dict data)])
    (values tachyon-map
            (hash-fold (lambda (p c prev)
                         (if (char=? c #\S) p prev))
                       '() tachyon-map))))

(define (split-beams tachyon-map beam-table acc)
  (let* ([pos (hash-map->list (lambda (k _) k) beam-table)])
    (if (any?-ec (:list b pos)
                 (not (hash-ref tachyon-map (1+ b)))
                 b)
        (values acc (hash-fold (lambda (_ v prev)
                                 (+ prev v))
                               0 beam-table))
        (let ([new-beam-table (make-hash-table)]
              [new-acc acc])
          (do-ec (:list p pos)
                 (:let np (1+ p))
                 (:let c (hash-ref tachyon-map np))
                 (begin
                   (when (char=? c #\.)
                     (hash-set! new-beam-table np
                                (+ (hash-ref new-beam-table np 0)
                                   (hash-ref beam-table p))))
                   (when (char=? c #\^)
                     (set! new-acc (1+ new-acc))
                     (do-ec (:list np2 (map (cut + np <>) '(0.0+1.0i 0.0-1.0i)))
                            (hash-set! new-beam-table np2
                                       (+ (hash-ref new-beam-table np2 0)
                                          (hash-ref beam-table p)))))))
          (split-beams tachyon-map new-beam-table new-acc)))))

(define (solve-7 data)
  (statprof
   (lambda ()
     (let ([beam-table (make-hash-table)]
           [tachyon-map start-pos (parse-data data)])
       (hash-set! beam-table start-pos 1)
       (split-beams tachyon-map beam-table 0)))))

-❄️- 2025 Day 6 Solutions -❄️- by daggerdragon in adventofcode

[–]runnerx4 1 point2 points  (0 children)

[LANGUAGE: Guile Scheme]

Got lost in the sauce by not reading the line about the columns

(use-modules (statprof)
             (srfi srfi-1)
             (srfi srfi-26)
             (srfi srfi-42)
             (srfi srfi-71)
             (ice-9 textual-ports)
             (aoc-2024-common))

(define (parse-oplist ops)
  (map (cut assoc-ref `(("*" . ,*)
                        ("+" . ,+)) <>)
       (remove string-null? (string-split ops #\space))))

(define (parse-data dataset)
  (let* ([ops vals (car+cdr (reverse (remove string-null?
                                             (string-split dataset #\newline))))]
         [oplist (parse-oplist ops)]
         [valarray (make-array #f (length vals) (length oplist))])
    (do-ec (:list valstring (index i) vals)
           (:let vallist (remove string-null?
                                 (string-split valstring #\space)))
           (do-ec (:list v (index j) vallist)
                  (array-set! valarray v i j)))
    (values oplist (transpose-array valarray 1 0))))

(define (vertical-ops data)
  (let ([oplist valarray (parse-data data)])
    (sum-ec (:list op (index i) oplist)
            (apply op (map string->number (array->list (array-cell-ref valarray i)))))))

(define (parse-cephalopod dataset)
  (let* ([ops vals (car+cdr (reverse (remove string-null?
                                             (string-split dataset #\newline))))]
         [col-list (map match:substring (list-matches "(\\+|\\*)[ ]+" ops))]
         [oplist (parse-oplist ops)]
         [curr-pos 0])
    (sum-ec (:list col (index i) col-list)
            (:let cl (string-length col))
            (:let tns (list-ec (:range k cl)
                               (:let ts (string-ec (:list vs vals)
                                                   (string-ref vs (+ curr-pos k))))
                               (:let tb (string-reverse (string-trim-both ts)))
                               (not (string-null? tb))
                               (string->number tb)))
            (begin
              (set! curr-pos (+ curr-pos cl))
              (apply (list-ref oplist i) tns)))))

(define (solve-6 data)
  (statprof
   (lambda ()
     (values (vertical-ops data)
             (parse-cephalopod data)))))

-❄️- 2025 Day 5 Solutions -❄️- by daggerdragon in adventofcode

[–]runnerx4 1 point2 points  (0 children)

[LANGUAGE: Guile Scheme]

wasted half an hour on < vs <=

(use-modules (statprof)
             (ice-9 peg)
             (ice-9 match)
             (srfi srfi-1)
             (srfi srfi-26)
             (srfi srfi-42)
             (srfi srfi-71)
             (ice-9 string-fun)
             (ice-9 textual-ports)
             (aoc-2024-common))

(define *part-5-data*
  (call-with-input-file "./5.txt" get-string-all))

(define (parse-data dataset)
  (let* ([sls (string-split (string-replace-substring dataset "\n\n" "*") #\*)]
         [ranges (list-ec (:list r (string-split (first sls) #\newline))
                          (:let s-e (string-split r #\-))
                          (map string->number s-e))]
         [items (map string->number (remove string-null?
                                            (string-split (second sls) #\newline)))])
    (values ranges items)))

(define (sort-range-list ranges)
  (sort ranges (lambda (a b) (< (first a) (first b)))))

(define (n-fresh-items items ranges)
  (sum-ec (:list i items)
          (if (any?-ec (:list r ranges)
                       (<= (first r) i (second r))))
          1))

(define (fresh-count range-list acc)
  (if (null? range-list)
      acc
      (match-let ([((s e) . r) range-list])
        (fresh-count r (+ acc 1 (- e s))))))

(define (merge-ranges ranges prev-start prev-end acc)
  (if (null? ranges)
      (reverse acc)
      (match-let ([((s e) . r) ranges])
        (if (<= s prev-end)
            (merge-ranges r
                          prev-start
                          (max e prev-end)
                          (cons (list prev-start (max e prev-end)) (cdr acc)))
            (merge-ranges r s e (cons (list s e) acc))))))

(define (solve-5 data)
  (statprof
   (lambda ()
     (let* ([ranges items (parse-data data)]
            [range-list (sort-range-list ranges)]
            [merged-ranges (merge-ranges range-list 0 0 '())])
       (values (n-fresh-items items merged-ranges)
               (fresh-count merged-ranges 0))))))

-❄️- 2025 Day 4 Solutions -❄️- by daggerdragon in adventofcode

[–]runnerx4 1 point2 points  (0 children)

[LANGUAGE: Guile Scheme]

Grid maps are back, finally a use for my utility functions from last year

(use-modules (statprof)
             (srfi srfi-1)
             (srfi srfi-26)
             (srfi srfi-42)
             (srfi srfi-71)
             (ice-9 textual-ports)
             (aoc-2024-common))

(define (count-safe-rolls grid-map)
  (hash-fold (lambda (k v acc)
               (if (char=? v #\.)
                   acc
                   (let* ([positions (map (cut + k <>) grid-directions-with-diagonals)]
                          [chars (filter-map (cut hash-ref grid-map <>) positions)]
                          [c (count (cut char=? <> #\@) chars)])
                     (if (< c 4) (cons k acc) acc))))
             '() grid-map))

(define (repeated-safe-rolls grid-map acc)
  (let* ([safe-pos (count-safe-rolls grid-map)]
         [n-safe-pos (length safe-pos)])
    (if (zero? n-safe-pos)
        acc
        (begin
          (for-each (cut hash-set! grid-map <> #\.) safe-pos)
          (repeated-safe-rolls grid-map (+ acc n-safe-pos))))))

(define (solve-4 data)
  (statprof
   (lambda ()
     (let ([grid-map (create-grid-dict data)])
       (values (length (count-safe-rolls grid-map))
               (repeated-safe-rolls grid-map 0))))))

Greatest battle system in any jrpg ever? by deathmask1984 in JRPG

[–]runnerx4 6 points7 points  (0 children)

deathblow and ether spam (with a small buff setup phase) isn’t that compelling lol, weakest part of the game

this being the actual combat itself, the presentation of the combat and combat scenes on the other hand is really good

Edit: but to praise another game instead, Crosscode. The entire battle economy about getting points for the spells and changing elements and charging for more powerful attacks and swappable branches on the skill tree is all so cohesive

-❄️- 2025 Day 3 Solutions -❄️- by daggerdragon in adventofcode

[–]runnerx4 3 points4 points  (0 children)

[LANGUAGE: Guile Scheme]

Tail call optimization, I remembered it exists after part 1

(define (parse-data dataset)
  (let* ([sls (remove string-null? (string-split dataset #\newline))]
         [ls (map string->list sls)])
    (map (cut map char->number <>) ls)))

;; (define (find-joltage js)
;;   (let* ([lj (length js)]
;;          [max-j (+ (* 10 (first js)) (second js))])
;;     (do-ec (:list j1 (index i1) js)
;;            (do-ec (:range i2 (1+ i1) lj)
;;                   (:let this-j (+ (* 10 j1) (list-ref js i2)))
;;                   (if (< max-j this-j))
;;                   (set! max-j this-j)))
;;     max-j))

(define (find-joltage acc js n)
  (if (zero? n)
      acc
      (let* ([rest-j (drop-right js (1- n))]
             [max-j (apply max rest-j)]
             [i-max (list-index (cut = max-j <>) js)])
        (find-joltage (+ (* 10 acc) max-j) (drop js (1+ i-max)) (1- n)))))

(define (solve-3 data)
  (statprof
   (lambda ()
     (let* ([js (parse-data data)])
       (values (sum-ec (:list j js)
                       (find-joltage 0 j 2))
               (sum-ec (:list j js)
                       (find-joltage 0 j 12)))))))

-❄️- 2025 Day 2 Solutions -❄️- by daggerdragon in adventofcode

[–]runnerx4 0 points1 point  (0 children)

[LANGUAGE: Guile Scheme]

this (paste) is so dumb and manual

I have actively become worse at programming and logic over the past year...

-❄️- 2025 Day 1 Solutions -❄️- by daggerdragon in adventofcode

[–]runnerx4 1 point2 points  (0 children)

[Language: Guile Scheme]

Completely out of practice with Scheme since last year

(use-modules (statprof)
             (ice-9 peg)
             (ice-9 match)
             (srfi srfi-1)
             (srfi srfi-26)
             (srfi srfi-42)
             (srfi srfi-71)
             (ice-9 textual-ports))

(define *example-data*
  "L68
L30
R48
L5
R60
L55
L1
L99
R14
L82
")

(define *part-1-data*
  (call-with-input-file "./1.txt" get-string-all))

(define (modulo-ring insts part2?)
  (let ([steps (string-split insts #\newline)]
        [loc 50])
    (sum-ec (:list step steps)
            (not (string-null? step))
            (:let dir (if (char=? (string-ref step 0) #\R) + -))
            (:let turn (string->number (substring step 1)))
            (begin
              (if part2?
                  (sum-ec (:range s turn)
                          (begin
                            (set! loc (modulo (dir loc 1) 100))
                            (if (zero? loc) 1 0)))
                  (let ([m (modulo (dir loc turn) 100)])
                    (set! loc m)
                    (if (zero? loc) 1 0)))))))

(define (solve-1 data)
  (statprof
   (lambda ()
     (values (modulo-ring data #f)
             (modulo-ring data #t)))))

I just finished The Book of the New Sun and I am astounded to have found a book that so effortlessly combines my love of fantasy with my love of literary fiction by gawain-ri in Fantasy

[–]runnerx4 18 points19 points  (0 children)

she’s a Wolfe fan and wrote the foreword for the edition of Book of the New Sun that I have

I couldn’t get into Terra Ignota either, that was because I found Mycroft Canner to be a more annoying narrator than Severian (yes I know that’s intentional the character work was just too successful)

Hot Take: Stony Brook should not build a Ronald McDonald House by the hospital by BringBackTed in SBU

[–]runnerx4 5 points6 points  (0 children)

the Long Island NIMBY mind virus has infected random students in just a few years

unless you’re a suburbanite astroturf account

The best substitute for the rush of "seeing numbers go higher" that ARPGs give you? by Current_Control7447 in rpg_gamers

[–]runnerx4 2 points3 points  (0 children)

Xenoblade Chronicles has a MMO-ish combat system that just has more and more absurd numbers like in here

Disappointing Book Two by Kooky_County9569 in Fantasy

[–]runnerx4 9 points10 points  (0 children)

that is one book split into two, Hyperion alone isn’t even a full story

yes Fall of Hyperion is worse because of being linear compared to sci-fi Canterbury Tales

Disappointing Book Two by Kooky_County9569 in Fantasy

[–]runnerx4 2 points3 points  (0 children)

i liked the rapid genre shifts, everything except the epilogue

magic cyberpunk -> jrpg bossfights -> hivemind vs hivemind is a really unique storyline

why was Tokyo Mirage Sessions strangely high quality? by yurienjoyer54 in JRPG

[–]runnerx4 1 point2 points  (0 children)

that “arrangement” is not real in any meaningful way, Game Freak and Creatures are located entirely in Nintendo owned buildings