adventofcode

Happy Advent 2020! Please put answers in the pinned threads or create one if it does not exist yet. | https://github.com/adventofcode-clojurians/adventofcode-clojurians | Join the private leaderboard with code 217019-4a55b8eb
mfikes 2017-12-29T01:16:34.000079Z

@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]
  (eduction
    (take-while seq)
    (map first)
    (iterate (fn [[node & queue]]
               (cond-> queue
                 (branch? node) (into (reverse (children node)))))
      [root])))
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.

bhauman 2017-12-29T03:02:09.000029Z

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

borkdude 2017-12-29T10:42:59.000230Z

Has anyone though of doing adventofcode directly in emacs using elisp + a text buffer? ๐Ÿ˜‰

karlis 2017-12-29T11:49:26.000085Z

Someone published an elisp solution in reddit: https://www.reddit.com/r/adventofcode/comments/7h5n38/2017_day_2_part_1_2_emacs_lisp_still_resist_to/

mfikes 2017-12-29T15:16:05.000247Z

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.) ๐Ÿ™‚

๐Ÿ‘ 1
orestis 2017-12-29T17:59:58.000292Z

I blogged about my experience with Clojure and Advent of Code: https://orestis.gr/25-days-of-clojure/

๐Ÿ‘ 5
๐Ÿค˜ 2
bhauman 2017-12-29T18:41:22.000331Z

posted to Hacker News

spfeiffer 2017-12-29T19:06:49.000141Z

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

borkdude 2017-12-29T19:50:46.000168Z

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

ihabunek 2017-12-29T19:51:17.000051Z

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

orestis 2017-12-29T23:19:33.000011Z

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