Fork me on GitHub

Hello, im struggling with -> and ->> can you help me: do we need to use -> or ->> in this example, and how would do this 🙂

(defn set-p [im i j]
  (set-pixel (+ i (first offset)) (+ j (last offset))
    (apply color (map (fn [c] (+ c 10)) (rgba (get-pixel im i j))))))


(defn set-p [im i j] (->> (get-pixel im i j) rgba (map (fn [c] (+ c 10))) (apply color) (set-pixel (+ i (first offset)) (+ j (last offset)))))


wow, thank you very much. It is working :0


You might want to see if your editor can be made to do the refactoring for you. Then you can toggle backward and forward. NB automated refactoring might give you a thread starting with just j as the first form, which can be passed to (get-pixed im i) in a thread-last but is obviously not as clear.

Gabriel Kovacs17:06:14

Hi! I am going through the "Web development with Clojure" book. I am using VsCode and I also have clj-kondo. Kondo complains about the following code: (defn handler [request-map] {:status 200 :headers {"Content-Type" "text/html"} :body (str "<html><body> your IP is: " (:remote-addr request-map) "</body></html>")}) I get a Mismatched bracket: found an opening { and a closing ) .... Is there something I can configure in Kondo to make it go away ? Thx!


can you post a screenshot? I copied that code and not seeing the same error


also you can use triple backticks to post code formatted text

(defn handler [request-map]
    {:status 200 :headers {"Content-Type" "text/html"}
     :body (str "<html><body> your IP is: "
                (:remote-addr request-map)


did you copy this from somewhere?


and can you evaluate this at the repl?


i'm wondering if you copied it and maybe there are some weird { characters that aren't what yo uthink they are

Gabriel Kovacs17:06:00

I typed it and I also copied it and the result was the same. I had no error when evaluating it. That is why I assumed that it's a configuration issue.


weird. then sounds like a bug of vscode


there's a #vscode and #calva channel that can give you some more specialized help

Gabriel Kovacs17:06:23

Thx for the Info!

Michaël Salihi18:06:06

Did you use clojure-lsp?

Gabriel Kovacs18:06:55

Not that I am aware of


Can you maybe post the while file as an attachment here? There may be something weird in your file

Gabriel Kovacs18:06:22

This is the file:

Gabriel Kovacs18:06:45

For completeness: I am using VsCodium Version. 1.68.1

Gabriel Kovacs18:06:03

It's not such a big issue, for me at least. I just got confused 😄


Does the error persist when you restart it? And can you maybe try VSCode too, just to check?

Gabriel Kovacs18:06:57

Restarting VsCodium solved the problem.

Gabriel Kovacs18:06:25

Sorry for the inconvenience.

❤️ 1
Michaël Salihi18:06:28

Yes for me, it's editor side issue. If you run clj-kondo --lint src via cli directly, you shouldn't have theses errors.

Michaël Salihi18:06:27

Our messages crossed, perfect if it's solved. 🙂

😁 1
Gabriel Kovacs18:06:33

Ok, good to know.


no inconvenience at all. glad you got it resolved

👍 1
❤️ 1
Michaël Salihi18:06:03

FYI Seems Calva use clojure-lsp under the hood and clojure-lsp use is proper clj-kondo version. Myself I'm not using VSCode but Emacs with clojure-lsp and I experience sometimes these sort of lint errors when modifying function & co. I have to manually refresh the file/buffer to get the "real" linter information.

Gabriel Kovacs18:06:29

Thx for the Info! Now that I know this, I will just restart if something is fishy 🙂.


You probably should not use the clj-kondo extension since you are using clojure-lsp and get clj-kondo linting that way.

👍 1
Gabriel Kovacs17:06:56

Does it make sense to look into Luminus or should I skip it and go for Kit?

👂 1

For understanding the overall concepts of a server-side or 'full-stack' application in Clojure, it won't make a lot of difference However, Clojure projects and libraries have been moving to a more data centric implementation It's the implementation of these concept, the config and libraries used that to me are the difference between kit and Luminus. I would suggest Kit because it has more of this data centric approach. Reitit is a really nice way of defining routes (and can use ring handlers & middleware server side),and Integrant (although a bit of a learning curve) is very useful when a system has multiple components (http server, logging, dn connection, routing, etc. If you want the very basics, then take a look at

Gabriel Kovacs14:06:29

Tank very much for the information! I appreciate you taking the time to explain the difference 🙂.

👍 1

Is there a way to do something like partition-by but where it creates a new group whenever the value is true, rather than when it changes? I've written a reduce version, but I assume I'm missing a trick with partition-by or another function

(->> [1 3 2 4 1 2 3]
        (fn [acc n]
          (if (odd? n)
            (conj acc [n])
             (dec (count acc))
             #((fnil conj []) % n))))
;; => [[1] [3 2 4] [1 2] [3]]

Martin Půda05:06:56

Try this:

(->> [1 3 2 4 1 2 3]
     (partition-by (let [v (atom 0)]
                     #(if (odd? %) 
                        (swap! v inc) 

=> ((1) (3 2 4) (1 2) (3))