Fork me on GitHub

@bhauman I needed a reducible tree-seq for Planck (to avoid head-holding in its file-seq implementation), and came up with this

(defn reducible-tree-seq
  [branch? children root]
    (take-while seq)
    (map first)
    (iterate (fn [[node & queue]]
               (cond-> queue
                 (branch? node) (into (reverse (children node)))))
Dropping it into your day 24 solution (replacing tree-seq with reducible-tree-seq) appears to drop the runtime in half (probably simply because it is not lazy). I also tried a variant
(transduce (map #(nth % 2)) max 0
  (reducible-tree-seq branch? children [index 0 0 0]))
with similar results. Strictly speaking, since it returns an eduction, it doesn’t directly implement the reducing protocols, but if you feed it to transduce you effectively get what you want.


@mfikes very cool and super interesting how simple the implementation is


Has anyone though of doing adventofcode directly in emacs using elisp + a text buffer? 😉


I got Shenzhen I/O and am playing it with my son. It's a pretty good game (teaching him assembly without him really realizing it.) 🙂


I blogged about my experience with Clojure and Advent of Code:


I would be very interested in the spacemacs/CIDER demo video. I like spacemacs, but i am not yet into REPL-driven development.


me too, i'm using the repl but i have a feeling i'm missing out on a lot of the experience


posted to Hacker News


@orestis Thanks for the writeup. What did you mean with apropos-like functionality? I suppose you didn’t mean clojure.core/apropos?


I mean similar to the apropos Linux command where you search a command by your intention, and you get a list of suggestions.