This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
- # announcements (7)
- # babashka (44)
- # beginners (162)
- # cider (22)
- # clara (11)
- # clj-kondo (14)
- # cljsrn (8)
- # clojure (91)
- # clojure-dev (24)
- # clojure-europe (6)
- # clojure-france (4)
- # clojure-italy (11)
- # clojure-nl (4)
- # clojure-spec (11)
- # clojure-uk (14)
- # clojurescript (92)
- # community-development (1)
- # core-logic (1)
- # crux (8)
- # cryogen (1)
- # cursive (6)
- # data-science (3)
- # datahike (3)
- # datomic (32)
- # degree9 (3)
- # dirac (3)
- # emacs (9)
- # eql (1)
- # events (1)
- # find-my-lib (1)
- # fulcro (67)
- # graphql (13)
- # helix (9)
- # jobs (1)
- # jobs-discuss (92)
- # leiningen (31)
- # malli (8)
- # meander (3)
- # news-and-articles (1)
- # off-topic (46)
- # pathom (2)
- # practicalli (1)
- # re-frame (52)
- # reitit (12)
- # shadow-cljs (40)
- # spacemacs (10)
- # sql (4)
Is there a shortcut for getting a value from a string indexed map? ("key" m) doesn't work like keyword indexed map. Is it only
(get m "key")?
its simply what should happen if a keyword is in the first position
(:foo ...) It could either throw an error as not a function, or it look up
Need to collab with a team that has never seen clojure. Best resource to get them started so they can at least read and understand the code? (versus developing new features)
if you post this on reddit, i bet you will get some answers. i think yogthos is active there and he has lots of experience ramping up new-to-clojure coworkers
channels auto complete for me. i can hit
cmd-k lein and it shows me the matching channels
How would I do what it looks like I intend the following macro to do?
That errors with an "Unable to resolve symbol" on the
(defmacro pprint [& args] `(do (map #(println % ": " ~%) '~args)))
What do you mean about having
~'% in both places? How would that print 2 different things?
Also, without the
'~args, it expands to
(arg1 arg2) and blows up because it tries to call the function
arg1 rather than treating it like a list of data to iterate over.
I thought this would be closer, but it still doesn't work. It expands to something that looks correct.
(defmacro pprint [& args] `(do (run! #(println % ": " (eval %)) '~args))) (let [a 1 b 2] (macroexpand `(pprint a b))) ;; => (do ;; (clojure.core/run! ;; (fn* ;; [p1__31102__31103__auto__] ;; (clojure.core/println ;; p1__31102__31103__auto__ ;; ": " ;; (clojure.core/eval p1__31102__31103__auto__))) ;; '(ezmonic.moniq/a ezmonic.moniq/b))) (let [a 1 b 2] (pprint a b)) ;; => 1. Caused by java.lang.RuntimeException ;; Unable to resolve symbol: a in this context
at compile time you can capture the local names of the symbols (~args), and you want to emit code with those (unqualified) symbols and that then evaluates those symbols at runtime
It looks to me like the repl does not call
print-method to print records. Could this be the case? Is that a bug?
there no special exclusion of anything like that so I doubt that is the actual story
(peek (map identity (range 20))) That raises. Can't peek into a lazy seq, right? Why does
(peek (doall (map identity (range 20)))) also fail for the same reason? What am I missing about doall?
peek works on instances of IPersistentStack, which are lists, vectors, and queues (not seqs)
doall will force evaluation, but it won’t convert a seq into something besides a seq
Ah. I see. I thought the problem was that the lazy thing wasn't realized. Not that realizing a lazy seq still gave you a seq and peek didn'k work on seqs.
reading that back, I meant that question with a 😀 not sure if that came across!