This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-12-04
Channels
- # adventofcode (154)
- # announcements (1)
- # babashka (8)
- # beginners (28)
- # bristol-clojurians (3)
- # calva (131)
- # cider (43)
- # clj-kondo (14)
- # clojure (135)
- # clojure-europe (1)
- # clojure-italy (7)
- # clojure-madison (1)
- # clojure-nl (6)
- # clojure-spec (8)
- # clojure-uk (90)
- # clojurescript (47)
- # core-async (9)
- # cryogen (4)
- # cursive (12)
- # datomic (9)
- # emacs (7)
- # fulcro (5)
- # graalvm (56)
- # joker (4)
- # juxt (1)
- # leiningen (6)
- # off-topic (62)
- # pathom (4)
- # pedestal (2)
- # reagent (2)
- # reitit (5)
- # ring (2)
- # schema (4)
- # shadow-cljs (133)
- # sql (38)
- # tools-deps (10)
- # vim (28)
((apply comp (repeat 5 inc)) 1)
=> 6
Maybe something like this?
user=> ((apply comp (repeat 5 inc)) 1)
6
read my mind!
Wow, that seems creepy 🙂
yess!
Do you have any recommendations on tutorials on how to debug Clojure? I've tried VSCode with Calva and Cursive, but I just can't figure out how they should be used when developing a non-trivial project. I can evaluate some simple expressions, but when I bring in a real project with multiple files and databases, I don't know where to start.
https://www.youtube.com/watch?v=FihU5JxmnBg&t=1s Was sent this by a coworker the week before I started my first Clojure job!
Interesting, but very general. I need to learn more about the tooling before I can benefit from that. At the moment I can't even evaluate my code in REPL unless it's a very trivial one file program.
@ULGNZ8B9S This might help you more https://binged.it/2LoXZvN (it's another talk by Stu)
There's also this one on REPL-Driven Development by Stu https://vimeo.com/223309989
Getting that basic tight feedback loop with evaluating code from your editor -- and not typing into the REPL itself! -- is key to getting going with Clojure and, in particular, debugging code that doesn't work.
Why does the first one set data
to nil, and the second one work?
(def data (-> "output.json"
slurp
json/read-str :key-fn keyword))
(def data (json/read-str (slurp "output.json") :key-fn keyword))
because :key-fn and keyword are not provided as args to read-str in the first one
clojure is not white-space aware
(def data (keyword (:key-fn (json/read-str (slurp "output.json")))))
is what the first expression macroexpands to...
I should have wrapped it up in parens, and then it would get called as the first argument
You can use macroexpand-1
and macroexpand
to understand what macros do.
Also, use read-string
when you encounter some reader syntax you don't understand. For example 'a
is just syntax sugar for (quote a)
. You can discover that by just running (read-string "'a")
.
right