This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-03-05
Channels
- # aleph (90)
- # announcements (4)
- # aws (2)
- # beginners (61)
- # calva (2)
- # cljs-dev (8)
- # cljsrn (12)
- # clojars (4)
- # clojure (42)
- # clojure-europe (1)
- # clojure-finland (1)
- # clojure-greece (2)
- # clojure-houston (1)
- # clojure-italy (3)
- # clojure-nl (30)
- # clojure-spec (41)
- # clojure-uk (87)
- # clojurescript (44)
- # cursive (12)
- # data-science (11)
- # datomic (24)
- # defnpodcast (1)
- # fulcro (18)
- # hyperfiddle (1)
- # jobs (2)
- # juxt (11)
- # kaocha (3)
- # london-clojurians (5)
- # mount (2)
- # nrepl (2)
- # off-topic (9)
- # onyx (25)
- # other-languages (1)
- # parinfer (3)
- # pathom (5)
- # pedestal (3)
- # portkey (1)
- # re-frame (21)
- # reagent (24)
- # remote-jobs (7)
- # schema (2)
- # shadow-cljs (59)
- # spacemacs (5)
- # specter (7)
- # sql (9)
- # tools-deps (13)
Hey, uh, I can't figure out how to comment on any issue on the Clojure JIRA. I've commented on issues before, so I'm thinking that maybe somehow my commenting permissions have been disabled? I can still create issues, though. Who should I ask about this?
yeah permissions were restricted due to spam. Just reach out to alex miller tomorrow and he can get you settled. It's 2am in his time zone so he's not likely to be up right now
I expect there are thread-safety issues with mutable updates
if you really want a mutable data structure, then Java has got plenty of them; use one of those
and makes it a bit more obvious that you are going contrary to Clojure convention
Has anyone used cheshire
to lazy load json content from a particular nested node? For example, I have a json file like {"package": "354", "misc-info": {..}, "entries": [{...lots of data...}]}
and I need to lazy-parse precisely the "entries"
part of json file. I'm not sure cheshire's parsed-seq
is suitable here. Is there a way to achieve that?
This seems a strange behavior with the or
(deftest destructuring
(let [foo1 (fn [{:keys [bar] :or {bar 2} bar {}}]
bar)
foo2 (fn [{:keys [] :or {bar 2} bar {}}]
bar)]
(is (= (foo1 {{} 1}) (foo2 {{} 1})))))
(destructuring)
FAIL in (destructuring) (form-init5648150256962006264.clj:6)
expected: (= (foo1 {{} 1}) (foo2 {{} 1}))
actual: (not (= 2 1))
:or never creates values from thin air
so if you don't put the local in :keys, the :or default isn't used
And :keys
has precedence over “regular” destructuring?
no, it's all "regular" destructuring
if you've made it ambiguous where a destructured symbol comes from, then you are in the land of undefined behavior
generally, destructuring maps are array maps, thus retain order, thus last one wins
but it's possible to use those maps in contexts (like macros) that go through an extra step that potentially destroys that order
if you want to see how destructuring will expand, use the (intentionally undocumented) destructure
function:
(destructure '[foo1 (fn [{:keys [bar] :or {bar 2} bar {}}]
bar)
foo2 (fn [{:keys [] :or {bar 2} bar {}}]
bar)])
;;=> [foo1 (fn [{:keys [bar], :or {bar 2}, bar {}}] bar) foo2 (fn [{:keys [], :or {bar 2}, bar {}}] bar)]
I guess that didn't help much
(deftest destructuring
(let [foo1 (fn [{:keys [bar] bar {}}]
bar)
foo2 (fn [{bar {} :keys [bar]}]
bar)]
(is (= nil (foo1 {{} 1})))
(is (= nil (foo2 {{} 1})))))
Does not seem to be order based:keys
wins in both cases
well, I wouldn't rely on that. I suspect it's an artifact of implementation we would not commit to
I will come back to: if you make it ambiguous, it's undefined
Yeah, we stumbled on it with a misplaced }
: {:keys [a b c d e] :or {a {} b 44 c d "Not found!"} e {}}
and wondered how the compiler treats that
A linter to detect the same symbol bound multiple times in the same destructuring is in order
https://github.com/jonase/eastwood would be a good place for that
we're using Lacinia for our GraphQL service. I need EDN -> GraphQL query, not GraphQL SDL
it looks like pathom might be what I want. I specifically would like to avoid having to write a bunch of custom parsing stuff
most of the examples are using fulcro, though, and I have no need for client-side stuff for my use case
@lilactown I think fulcro has some examples of doing this, but I think you're right that you'll be porting things from cljs examples unfortunately. I only looked into this briefly though.