Fork me on GitHub
#clojure
<
2019-03-05
>
miikka07:03:07

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?

dpsutton08:03:49

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

miikka08:03:34

Ah, okay, thanks

pedroiago09:03:34

anyone knows the reasoning why (seq (transient [])) throws an exception?

borkdude10:03:46

because transient does not implement the seq abstraction, probably for good reasons

pedroiago11:03:23

that's right, I can't see how this could lead to trouble...

borkdude11:03:02

if you want a seq, why not first call persistent! on it?

pedroiago11:03:31

I am trying not, so that it can be done outside of the scope I need seq

pedroiago11:03:58

I guess my idea of transient must be wrong, perhaps it is more local than my goal

borkdude11:03:34

you should never expose transients outside of a public API

Ben Hammond17:03:17

I expect there are thread-safety issues with mutable updates

Ben Hammond17:03:09

if you really want a mutable data structure, then Java has got plenty of them; use one of those

👍 5
Ben Hammond17:03:46

and makes it a bit more obvious that you are going contrary to Clojure convention

Twice10:03:42

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?

youvere14:03:59

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))

Alex Miller (Clojure team)14:03:21

:or never creates values from thin air

Alex Miller (Clojure team)14:03:38

so if you don't put the local in :keys, the :or default isn't used

jsabeaudry14:03:47

And :keys has precedence over “regular” destructuring?

Alex Miller (Clojure team)14:03:13

no, it's all "regular" destructuring

Alex Miller (Clojure team)14:03:38

if you've made it ambiguous where a destructured symbol comes from, then you are in the land of undefined behavior

Alex Miller (Clojure team)14:03:56

generally, destructuring maps are array maps, thus retain order, thus last one wins

Alex Miller (Clojure team)14:03:34

but it's possible to use those maps in contexts (like macros) that go through an extra step that potentially destroys that order

Alex Miller (Clojure team)14:03:36

if you want to see how destructuring will expand, use the (intentionally undocumented) destructure function:

👍 5
Alex Miller (Clojure team)14:03:38

(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)]

Alex Miller (Clojure team)14:03:27

I guess that didn't help much

jsabeaudry14:03:46

(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

jsabeaudry14:03:06

:keys wins in both cases

Alex Miller (Clojure team)14:03:03

well, I wouldn't rely on that. I suspect it's an artifact of implementation we would not commit to

Alex Miller (Clojure team)14:03:46

I will come back to: if you make it ambiguous, it's undefined

jsabeaudry14:03:47

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

jsabeaudry14:03:51

A linter to detect the same symbol bound multiple times in the same destructuring is in order

🏎️ 10
lilactown17:03:40

are there any libraries for EQL <-> GraphQL parsing?

rodsenra20:03:24

Do you know lacinia?

lilactown21:03:03

we're using Lacinia for our GraphQL service. I need EDN -> GraphQL query, not GraphQL SDL

lilactown17:03:46

I'm mainly interested in EQL -> GraphQL

lilactown17:03:50

it looks like pathom might be what I want. I specifically would like to avoid having to write a bunch of custom parsing stuff

lilactown17:03:56

most of the examples are using fulcro, though, and I have no need for client-side stuff for my use case

dominicm18:03:36

@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.

timvisher19:03:01

Is there a way to print components of the merged project from leiningen? I basically want to (get project :java-cmd) as lein would see it with all profiles activated and merged on the merged profiles.

timvisher19:03:34

Ah duh. lein pprint can do it natively. facepalm

timvisher19:03:46

$ lein pprint :java-cmd
"/var/lib/jdk/openjdk-7-jdk/bin/java"