Fork me on GitHub
#announcements
<
2018-09-30
>
wilkerlucio19:09:47

Pathom updated docs (thanks to @tony.kay) are live, many sections got a lot of improvement! A highlight to the new GraphQL integration docs: https://wilkerlucio.github.io/pathom/DevelopersGuide.html#GraphQL

👍 12
🚀 16
👏 16
danielcompton22:09:55

Clojurists Together has finished our latest survey and have a list of focus areas for our next funding round: https://www.clojuriststogether.org/news/q4-2018-survey-results. Encourage the projects that you depend on to apply for funding. If you have any questions about applying, please get in touch here or via any of the other places you can find me 🙂. Applications close 9th October

🙌 16
clj 28
beta103620:10:08

I've seen this in the code, and wanted to know the reasons for it being this way. I was surprised that keywords can take sets, and even more surprised that they can only take IPersistentSet or ITransientSet whereas java.util.Map is supported.

beta103620:10:18

Is there an idiomatic use for applying a keyword to a set?

seancorfield20:10:15

@U4844LY6A (Clojure) sets are associative on their keys -- like a map whose values are the same as their keys -- so you can call "get" on them. Java sets don't have that associative lookup -- only a "contains" operation. That would be my understanding of why you can lookup keywords in (Clojure) sets but not Java sets.

seancorfield20:10:40

(and arrays are associative on their indices -- so, again, it makes sense to allow lookup "get" on those)

seancorfield20:10:20

Does that make sense?

beta103620:10:15

Having get on maps, sets and arrays makes sense to me.

beta103620:10:50

It would make more sense to me if keyword application either supported java sets or not supported any sets at all. And of course supporting keyword application on vectors makes no sense at all.

beta103620:10:22

The fact that java sets don't have a get operation seems like a weak excuse for not supporting them.

beta103620:10:11

But I'm not complaining, since I don't have any use for applying keywords to sets at the moment. 🙂

seancorfield21:10:49

Clojure is based on abstractions. map, set, and vector are associative in Clojure, hence should all support get. Java's Map is associative, Java's Set is not.

seancorfield21:10:53

Re: keyword on vector -- vectors are associative on their index so, no, Clojure does not support keyword lookup on them. (kw coll) is "the same" as (coll kw) which is "the same" as (get coll kw) and for vectors (coll ix) is the shorthand.