This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
- # adventofcode (84)
- # aleph (1)
- # announcements (2)
- # aws (27)
- # beginners (52)
- # braveandtrue (2)
- # calva (440)
- # cider (7)
- # clara (2)
- # cljdoc (26)
- # cljs-dev (70)
- # clojure (131)
- # clojure-berlin (4)
- # clojure-brasil (1)
- # clojure-europe (2)
- # clojure-greece (4)
- # clojure-hamburg (1)
- # clojure-italy (4)
- # clojure-losangeles (6)
- # clojure-nl (14)
- # clojure-spec (7)
- # clojure-uk (25)
- # clojurescript (26)
- # component (2)
- # cursive (13)
- # datomic (60)
- # dirac (59)
- # docker (1)
- # figwheel (1)
- # figwheel-main (2)
- # fulcro (12)
- # graphql (5)
- # juxt (33)
- # leiningen (19)
- # nrepl (1)
- # off-topic (37)
- # protorepl (2)
- # re-frame (18)
- # reagent (46)
- # remote-jobs (1)
- # ring-swagger (1)
- # shadow-cljs (88)
- # sql (10)
- # tools-deps (64)
- # vim (24)
gah finally got it after finding all my dumb bugs. felt like I wrote way too much code for this one
I’m considering using Planck or Lumo for scripting instead of bash, but I’m wondering if this would be problematic for some people. It’s not strictly necessary
Ah i just use the tools.deps built into cursive/intellij. Once I solved the problem in clojure from the repl I run the scripts in WSL ubuntu
@mrmcc3 would it be reasonable to assume just about every developer on Windows uses WSL?
day 13, quite fiddly - I had a bug that had trains going completely the wrong way at the junctions, but cleverly and annoyingly it managed to get the right answer on the test input.
My solution for Day 13 https://github.com/benfle/advent-of-code-2018/blob/master/day13.clj
@borkdude Planck does work under WSL. There is an upstream WebKit issue that has a workaround (not sure if that issue has been fixed and the fix widely deployed; I haven't looked at it in a while). https://github.com/planck-repl/planck/issues/746
@mfikes cool! I haven’t made my mind up about it yet, since I think most of the stuff works, but it would be more maintainer friendly if some bash was replaced with clojure. on the other hand, I’m forcing an extra installation step on advent-of-cljc users
btw, if you want to trigger recording of the scores for certain days, all you have to do now is create a PR to a branch named yyyy/dd/rescore, then I’ll accept it, and all the changed namespaces will be recorded. I did that here: https://github.com/borkdude/advent-of-cljc/tree/2018/01/rescore these changes won’t have to be applied to master, just being in a branch in my repo is enough
I just read day 13, seems fun. But I don't know if I'll have time to implement it today
But I'm not sure it's incorrect or how it could be wrong - it works on part 1 and on the extra sample input provided for part 2
I first saw this mutable approach here. Very similar solution I think: https://github.com/kolov/adventofcode2018/blob/master/day9-marbles/src/main/scala/example/Main.scala
I honestly don’t know how to do it efficiently w/o mutability. I’m sure there’s plenty of higher polynomial solutions.
Almost. You have to build a rotation fn in. But they’re structured so this operation is pretty efficient.
Yeah, I saw immediately that was an issue. Went off and thought about it for a while before starting.
Wouldn't surprise me if there was an even faster way to calculate it using some mathematical model.
Found the bug - now it works https://github.com/pesterhazy/advent2018/blob/master/src/advent/puzzle13.clj#L78
It's not that the puzzle description was unclear - but I still failed to grasp the rules for collision detection. Somehow I feel an imperative solution would have been more obvious
I made multiple mistakes of conception when choosing the pairs for collision comparison - which sadly worked for p1 but gave an incorrect answer for p2
It's not too bad w/ pure functional code, either; I usually end up with tagged results, e.g.
[:ok carts] or
This day was a big piece of work. Not hard. Just tiring and long. But fun 😄 Finally something that even I can manage
I've burned too much time on this problem... this code works on the sample input and a few others I created but chokes on the actual input - I can't find the bug.
A "concise" solution for day12: https://www.reddit.com/r/adventofcode/comments/a5eztl/2018_day_12_solutions/ebmfcqc/
Ahhh, APL; ever a source of delight and horror. To be fair, it's probably a fantastic fit for a number of these problems.
@pesterhazy Had the exact same problem - it worked for the example, but took three attempts at getting the collision detection exactly as described to make it work for the actual puzzle.
It made the recursion annoying, because you really can't solely update carts in-place, since each cart depends on the result of the cart before it. I ended up using straight loop-recur over reduce this time because of that.
Yes, that was my main bug too. A cart might have disappeared because of a collision. I solved it by checking that the cart was still around before trying to move it. So I could continue to reduce.
You know, you're right. Could've done it by just flagging the collided carts instead of removing them. Would've made some things easier.