This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-12-08
Channels
- # adventofcode (55)
- # announcements (21)
- # babashka (20)
- # beginners (89)
- # calva (21)
- # cider (16)
- # circleci (11)
- # clara (8)
- # clj-kondo (6)
- # clojure (31)
- # clojure-australia (3)
- # clojure-europe (17)
- # clojure-nl (5)
- # clojure-uk (10)
- # clojurescript (25)
- # community-development (4)
- # conjure (12)
- # cryogen (28)
- # cursive (21)
- # datomic (7)
- # deps-new (1)
- # depstar (45)
- # emacs (5)
- # fulcro (46)
- # instaparse (5)
- # jobs (5)
- # jobs-discuss (23)
- # kaocha (12)
- # lambdaisland (2)
- # leiningen (1)
- # meander (10)
- # mid-cities-meetup (1)
- # reagent (5)
- # reitit (5)
- # remote-jobs (45)
- # reveal (9)
- # sql (6)
- # tools-deps (103)
- # uncomplicate (1)
- # xtdb (1)
@pez the error only happens when using jack-in from Calva though, the alias works just fine on the command line on the same machine and setup. So something between Calva and tools.deps maybe? I will test with more aliases as I have many that have kebab case and haven't experience this issue before.
@brandon.ringe The line of code you refer to has not changed in 14 months, so doubt there does not seem to be a difference in tools.deps.alpha library versions, unless you are using an unreleased version or using it directly from source. I am using Clojure CLI tools version "1.10.1.727" on Java 11 / Ubuntu 20.10
Update: the error only occurs when using jack-in from Calva with calva.replConnectSequences
so for now I will just suggest people copy any kebab-named aliases from practicalli/clojure-deps-edn into the project deps.edn file and avoid custom repl connect sequences
Unless there is another way to use user-level aliases with Calva jack-in without adding a custom replConnectSequences config?
Oh I see. Is it actually not loading the alias, or just a warning? I'll defer to @pez on the above question. If you create an issue we can track this for later.
I'll do a bit more testing and report an issue as detailed as I can. It certainly feels like an edge case that I'd like to understand clearly before creating an issue.
I've written (and executed) a few infinite loops recently. How can I get calva to stop executing?
I've had to kill vscode, which doesnt seem like it should be necessary. Even just killing the repl woudl work
Yes it was advent of code đ
Step 2 of day 8 nearly drove me crazy. But then decided to brute force it. Will go to bed defeated tonight, but at least I have collected the gold stars.
oh you (tryin a be) fancy
I just brute forced it. god bless clj being really good at making a bunch of "clones" of a map cheaply and easily
I wasnât consciously trying to make anything fancy. It just appeared to me as a tree problem and I went that way, never to return. Then when it was getting late here I gave up, made as many programs as there were input lines and modified them all. đ
Interrupting infinit loops was a big part of what I was doing, btw. Turns out that if you print from an infinit loop you still have to reload the VS Code window, because it queues up so many printings that it never stops with that.
Oh. I read in the input. then just did something like
(map (fn [instructions]
(for [i (range (count instructions))]
// get line i; flip jmp <=> nop
// replace line i with the new line i)))
then ran all of those.
And yeah, I noticed the infinite printing issue ^^
We are both cloning the program, I just do it a bit more explicitly. Hereâs the whole thing:
(defn parse [input]
(->> (clojure.string/split-lines input)
(map #(clojure.string/split % #" "))
(mapv (fn [[op arg]] [op (Integer/parseInt arg)]))))
(defn run [program]
(let [length (count program)]
(reduce (fn [cpu _]
(let [{:keys [pc pcs]} cpu]
(if (< pc length)
(let [[op arg] (nth program pc)]
(if (pcs pc)
(reduced cpu)
(cond-> cpu
(= op "acc") (update :acc #(+ % arg))
(#{"acc" "nop"} op) (update :pc inc)
(= op "jmp") (update :pc #(+ % arg))
:always (update :pcs conj pc))))
(reduced cpu))))
{:acc 0
:pc 0
:length (count program)
:pcs #{}}
(range))))
(comment
(def input (util/fetch-input 8))
; step 1
(->> input
(parse)
(run)
:acc)
; step 2
(->> input
(parse)
(#(repeat (count %) %))
(keep-indexed (fn [i program]
(let [[op arg] (program i)]
(assoc program i [(cond
(= "nop" op) "jmp"
(= "jmp" op) "nop"
:else op)
arg]))))
(map run)
(filter #(= (:pc %) (:length %)))
(first)
:acc))
ah thanks!