This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-09-22
Channels
- # announcements (2)
- # asami (123)
- # aws (17)
- # babashka (77)
- # babashka-sci-dev (23)
- # beginners (48)
- # biff (6)
- # calva (35)
- # cider (16)
- # clj-on-windows (1)
- # clj-yaml (19)
- # clojure (36)
- # clojure-europe (78)
- # clojure-nl (5)
- # clojure-norway (8)
- # clojure-poland (3)
- # clojure-uk (16)
- # clojurescript (17)
- # cursive (6)
- # datahike (3)
- # datalevin (26)
- # duct (7)
- # emacs (41)
- # events (2)
- # fulcro (7)
- # graphql (5)
- # honeysql (13)
- # juxt (3)
- # kaocha (7)
- # lsp (5)
- # malli (12)
- # off-topic (14)
- # pathom (3)
- # portal (1)
- # rdf (9)
- # reitit (3)
- # remote-jobs (2)
- # shadow-cljs (37)
- # spacemacs (5)
- # tools-build (1)
- # tools-deps (20)
- # xtdb (2)
How can I read tagged-literals in the REPL? E.g. I want to evaluate this expression in the REPL
{:my-date #clj-time/date-time "2022-09-21T23:32:07.810Z"}
Is the data-readers.clj automatically loaded?
Do I have to require a namespace from clj-time or is it suffcient that the JAR is in the class path?
You have to require it
I'm trying to remember the name of a software project in clojure where you could construct queries against your source code and find for example all the references to a specific namespace from a function's full call stack. Could anybody jog my memory here?
Grasp was the one I was trying to grasp from the jaws of forgetfulness, thank you!
Danggg good stuff!
Ah, if you want that kind of thing, I suppose there is also clj-kondo analysis output: https://github.com/clj-kondo/clj-kondo/blob/master/analysis/README.md
@UH13Y2FSA Yes, you can use #rewrite-clj for this
@U04V15CAJ I didn’t see that rewrite-clj had a pattern search, although kibit which builds on top of it does, although doesn’t expose the functionality directly, but might be the best to build on top of.
@UH13Y2FSA #lsp also builds on top of rewrite-clj + clj-kondo analysis and supports various refactorings
Why does hashing a function (via hasheq) ends up going through clojure.lang.Numbers.hasheq
? How is function hash calculated?
I don’t follow this question.
(hash (fn []))
will go through clojure.lang.Util.hasheq(Object o)
. That method goes through several if
blocks, before calling through to calling o.hashCode()
=> (let [a (fn [])] [(hash a) (.hashCode a)])
[745571392 745571392]
This returned the same number both times because both times it came from the underlying object .hashCode()
Also, clojure.lang.Numbers.hasheq
https://github.com/clojure/clojure/blob/5ffe3833508495ca7c635d47ad7a1c8b820eab76/src/jvm/clojure/lang/Numbers.java#L1151:
static int hasheq(Number x){
And because functions aren’t numbers this can’t get called.
So… I’m confused about the questionSorry, I should have clarified. I'm asking because reading the java code I see absolutely no reason to go through numbers hash, but when I profile I do see it, so something is playing tricks on me
Any idea why a transducer-returning arities weren't included for update-vals/update-keys? I didn't see any discussion of it on the ticket: https://clojure.atlassian.net/browse/CLJ-1959
How would you expect to use them? I’m not seeing how they would be transducers themselves
In a transducing pipeline in place of map+kvp-destructuring:
(comp
;; ...
(map (fn [[k v]]
[(f k) v]))
;; ...
)
=
> (comp
> ;; ...
> (update-keys f)
> ;; ...
> )