Fork me on GitHub

Does clj-kondo warn when some know lazy construct is being created but not forced to be realized in the lexical scope of with-redefs?


After more thinking, doing so would require analysis through dynamic scopes, because things outside of core can both create lazy stuff and force it to be realized (without telling us so). So maybe it is out of scope for clj-kondo. Maybe a job for a more involved static analysis tool.


@jaihindhreddy Same trouble with try, with-open and binding


Clj-kondo could in theory warn about (try (map ...)) because it can know about a set of functions that are lazy like map. Maybe eastwood already has this? I'll ask in their channel.


@borkdude Sorry, I had to fix another error I made (def i.s.o. defn) first... From the Clojure for the Brave and True book, chapter 6:

(ns the-divine-cheese-code.core
(require 'the-divine-cheese-code.visualization.svg)
(refer 'the-divine-cheese-code.visualization.svg)

(def heists [{:location "Cologne, Germany"
              :cheese-name "Archbishop Hildebold's Cheese Pretzel"
              :lat 50.95
              :lng 6.97}
             {:location "Zurich, Switzerland"
              :cheese-name "The Standard Emmental"
              :lat 47.37
              :lng 8.55}
             {:location "Marseille, France"
              :cheese-name "Le Fromage de Cosquer"
              :lat 43.30
              :lng 5.37}
             {:location "Zurich, Switzerland"
              :cheese-name "The Lesser Emmental"
              :lat 47.37
              :lng 8.55}
             {:location "Vatican City"
              :cheese-name "The Cheese of Turin"
              :lat 41.90
              :lng 12.45}])

(defn -main
  [& args]
  (println (points heists)))
clj-kondo complains about 'points' in the prinln form. lein run gives expected output, though.


and the corresponding namespace:

(ns the-divine-cheese-code.visualization.svg)

(defn latlng->point
  "Convert lat/lng map to comma-separated string"
  (str (:lat latlng) "," (:lng latlng)))

(defn points
  (clojure.string/join " " (map latlng->point locations)))


@roger429 clj-kondo doesn't support (refer ...). To be honest I've never used this myself in 10 years of Clojure. Just use (require '[the-divine... :refer [points]])


So maybe I should add support for it, I'll make a ticket for it


(require ['the-divine-cheese-code.visualization.svg :refer [points]])
still has squiggles under points.


you need to put the quote in front of the vector


Thank you! I'm not the eagle-eyed reader at the moment that Daniel Higginbotham assumes his readers to be:blush:


no problem 🙂


I almost recruited a Calva user the other day. He liked the help I got with unused and misused stuff. I’m pretty sure he was ready to install VS Code. Then I told him it was clj-kondo doing the magic and that he could use it in Emacs as well. 😃

🙃 8

very much enjoying the ability to use clj-kondo in various editors :thumbsup: am a big fan of tooling that can be shared in a variety of environments.