This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2015-11-10
Channels
- # alda (28)
- # announcements (7)
- # beginners (79)
- # boot (62)
- # cider (11)
- # cljsjs (12)
- # cljsrn (8)
- # clojure (111)
- # clojure-art (2)
- # clojure-austin (5)
- # clojure-conj (3)
- # clojure-dev (54)
- # clojure-japan (12)
- # clojure-russia (30)
- # clojurescript (354)
- # clojurex (5)
- # cursive (9)
- # data-science (58)
- # datomic (19)
- # editors-rus (3)
- # emacs (7)
- # events (2)
- # hoplon (5)
- # ldnclj (6)
- # lein-figwheel (14)
- # luminus (1)
- # off-topic (10)
- # om (191)
- # onyx (59)
- # re-frame (30)
- # reagent (74)
- # robots (1)
- # yada (19)
I’m not sure how to let my macro know the user’s intended target version, I need something like a “global variable” for macro and I don’t want the user to pass it into every function call
@domkm: the nullary versions of and and or are driven by how they are often used in macroexpansion
IOW just as 0
is the identity for +
and 1
is the identity for *
, nil
is the identity for or
and true
for and
Is incoerceably a word?
What libraries should I look at to build a client/server where multiple clients will be displaying a page, and then from a ‘control’ page can tell one of the clients to display a different page? Based off searching I’m thinking maybe sente for communication between client and server?
Any ideas on a better way to put a list of objects into a map by a given key?
(let [items [{:id 1 :color :red}
{:id 2 :color :blue}]]
(into {} (map #(vector (:id %) %) items)))
=> {1 {:id 1, :color :red}, 2 {:id 2, :color :blue}}
It works, but I just wonder if there's another way.Did you see chouser and claggetts talk on this at c west a couple years ago?
@cfleming: https://www.youtube.com/watch?v=o75g9ZRoLaw - good examples in there iirc
@alexmiller: Yeah, I’ve watched that multiple times
what about the prismatic stuff?
or are they too complicated?
probably a couple others in test.check
@sashton: (group-by :id items) http://conj.io/store/v1/org.clojure/clojure/1.7.0/clj/clojure.core/group-by/
Quick syntax question … I’ve been bashing my head on destructuring function args, I’m currently using :
(fn [arg1 arg2] (let [[_ v] arg2 …
but I would ideally like to get rid of that let … but I just can’t seem to get it right 😢
Let’s see
@dm3 Brilliant! Does the trick … man that’s nice 😄
Hey! I’m using collection-check
to test a custom type but get failing tests like this one:
FAIL in (collection-check) (collection_check.clj:176)
set-like
expected: #{}
actual: #{}
diff: - #{}
+ #{}
What do I do with this? How can two empty sets be not equal?@martinklepsch: you need to implement equals
hashCode
and IEquiv
if I recall correctly
@dnolen: I have IHashEq
, I think IEquiv
is not a thing in Clojure?
@dm3: (.equals #{} #{})
and (= #{} #{})
are true though. Are there things that can affect .equals
that aren’t visible in a sets printed representation?
Also the strange thing is that my custom type has a different string representation than #{}
so the one shown in the test output can’t be mine (?)
@martinklepsch: ah yeah been a while, equals
@martinklepsch: doesn’t collection check test your stuff against the standard collections?
@dnolen: yes, thats how I understand it..
@martinklepsch: what does (.equals (make-your-set) #{})
do?
@martinklepsch: so equality is a binary op and the order may be flipped, you need to account for both cases
however Clojure’s implementations should be checking for the interface not concrete types
@dm3: it returns false. and I just noticed that for some reason my print-method
multimethod extension isn’t being ran, thus resulting in the same string rep
Let me figure out that, probably that will clear most of the confusion and then I can tackle proper equality
If I require a namespace it’s defmethod calls should get evaluated right?
but note there are some funnies around an existing REPL picking up changes to already defined protocols and such like...
@colin.yates: thanks. not worried about protocols atm
I have also experienced an existing REPL not picking up changes to a defmethod is what I meant (sorry - mind elsewhere). Does restarting the REPL help?
@colin.yates: I’m running tests from clean slate so everything is fresh every time.
not sure what the problem is then, but yes, requiring a namespace ‘activates’ the defmethods
in that namespace.
grasping at straws - I don’t know what effect a restrictive require
would have, where you only pull in some vars….
@colin.yates: I think I have a bunch of problems here and will need to figure out some of them before I can ask any more useful questions
he he - I am well aware of that phenomenon
You can't require
just "part" of a namespace. Regardless of how many symbols you :refer
, the whole file is loaded.
thanks @stuartsierra - so the straw disintegrates
@dnolen: that order flipping comment was helpful thanks. Turns out I didn’t implement java.util.Set and that’s checked when .equals
is called on Clojure sets
is there a flip function in the clojure standard library, and, if not, why? (by "flip function" I mean a function which essentially reverses the application of the arguments applied to some arbitrary function)
I've been using anonymous functions to wrap around functions whose order of application is not what I want, yet I'm wondering if there is a more idiomatic way of doing this... such as the flip function in Haskell
@wordsarewind: so you want something like (flip f c b a)
-> (f a b c)
?
@swizzard exactly
I wrote a quick function that does just that, though I wasn't sure if it wasn't idiomatic
yet using it in code... would that confused people?
without claiming to know the hearts and/or minds of rich et al., i suspect the answer to why there isn’t one in the stdlib involves argument destructuring
it's really helpful in a lot of places
yep, or with composition
also, if I’m trying to compose my own functions, and they can’t be chained nicely with the thread macro, I always step back and re-think my strategy. Most of the times leading me to refactor my functions so they do work that way.
true, true
though it's usually to deal with library functions
I’m guessing it is the same with Haskell, you think a lot about how the functions will compose and that informs as to the argument order
I like the look of as->, though
okay, well thanks
http://blog.cognitect.com/blog/2015/11/10/lets-make-clojure-org-better
^^ been working on this for a while! let me know if questions
http://www.spacjer.com/blog/2015/11/09/lesser-known-clojure-variants-of-threading-macro/
this is great @alexmiller and a step in the right direction ‘community’ wise.
Clojure 1.8.0-RC1 is now available https://groups.google.com/d/msg/clojure/9ZmaZI6NO1I/C_Qhu3zAAQAJ
We would really appreciate it if you could try it out on your internal project or libraries and report any issues you find! This is a candidate for release if no problems are found.
Hi. We just released first non-snapshot version of Kekkonen, a data-driven lib for building remote (CQRS) apis. More info at https://groups.google.com/forum/#!topic/clojure/jLx2igfIbHo
Just released an initial Clojure API client for PokitDok. We are a set of backend APIs for health transactions. Think Parse or AWS but for healthcare https://github.com/pokitdok/pokitdok-clojure
I know "Client APIs" aren't super idiomatic in clojure-land, so it's oriented around handling oauth negotiation and has a few extension points
If you know anyone in the Philly area that might be interested in a Clojurebridge event, send them a link! http://www.meetup.com/Clojadelphia/
Actually, this is a better link http://www.clojurebridge.org/events/2015-11-13-philadelphia
Whoa, https://github.com/ctford/traversy is magic. Solves a lot of questions I had on navigating maps and applying fns to portions thereof. 👏:skin-tone-2: to @rbxbx
Makes it really easy to me to build a DAG with loom and then annotate the graph with info from a bunch of config files, etc
I tried to spit a huge list of vectors into a file but every way I try either truncates the data or produces something like [email protected]
Sounds like you need to force realization of the lazy sequence with doall
?
Or perhaps use doseq
and write multiple pieces...