This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-04-24
Channels
- # architecture (7)
- # beginners (73)
- # boot (4)
- # cider (48)
- # cljsjs (7)
- # cljsrn (27)
- # clojure (206)
- # clojure-boston (2)
- # clojure-italy (21)
- # clojure-nl (8)
- # clojure-spec (7)
- # clojure-uk (94)
- # clojurescript (126)
- # clojutre (7)
- # core-async (3)
- # cursive (7)
- # data-science (1)
- # datascript (4)
- # datomic (6)
- # duct (1)
- # emacs (19)
- # figwheel (1)
- # fulcro (31)
- # graphql (13)
- # jobs (5)
- # jobs-discuss (42)
- # keechma (4)
- # leiningen (10)
- # luminus (3)
- # mount (2)
- # nyc (3)
- # off-topic (37)
- # om-next (3)
- # onyx (45)
- # pedestal (2)
- # re-frame (4)
- # reagent (2)
- # reitit (16)
- # shadow-cljs (118)
- # spacemacs (10)
- # tools-deps (8)
- # vim (20)
Morning
morning
guy from audi talking about wanting to give you a 25th hour in the day
I think when he finishes his data analytics platform he'll be surprised to find that insight #1 is that the day only had 24 hrs
which conf you at @alex.lynham?
the kafka summit
really interesting testing talk
there's definitely an intersection where clojure, schemas and generative testing meet for making good CI/test possible for streaming use cases
månmån
Oh ye of little faith 😉
>I'm sorry
@otfrom from my experience that makes very little difference for the British. (when sunny (wear-shorts))
every day is black jeans day imho
it ain't easy being
@alex.lynham surely you’re allowed a bit of grey for summer?
sometimes a very very dark green tshirt
but I only have black jeans
more a british racing green
or darker
I have a Clojure related question if anyone has time to help. Assuming I have a data structure like this:
(def data
#{{:foo "abc" :bar "zzz"}
{:foo "def" :bar "xyz"}
{:foo "xyz" :bar "zzz"}})
I want to check for the existence of an item where :foo
= abc
and where :bar
= zzz
.
My current solution looks like this:
(filter #(and (= (:foo %) "abc") (= (:bar %) "zzz")) data)
Is there a better / more idiomatic way of doing this?(you don’t need to filter the whole list, you can stop at the first item if you’re just confirming it’s there)
Good point
Is it possible to do something along these lines (some {:foo "abc" :bar "zzz"} data)
?
That returns nil so not correct
(first (filter #(= {:foo "abc" :bar "zzz"} (select-keys % [:foo :bar])) data))
could work
All good food for thought
Thanks 🙂
This seems to work. Feels a bit cleaner. (filter #(= {:foo "abc" :bar "zzz"} %) data)
I know that my data will always have only :foo and :bar so don't think I need the select-keys
If your data is exactly as described then (contains? data {:foo "abc" :bar "zzz"})
will be faster
Do you know how that would compare to @U0HJFE43U's suggestion of (some #{{:foo "abc" :bar "zzz"}} data)
?
if data
is actually a set and you only need to check one map contains?
will be faster
Actually, I'm look for a true/false result so ideally need some?
, not some
... :thinking_face:
Yeah, seeing this
I like your contains?
solution. Feels the most concise for what I'm trying to achieve
the some
version is good for checking a collection that is iterated over. contains?
is for quickly checking indexed data structures for presence of a key. it’s effectively O(1) whereas some is O(n).
The data isn't an indexed collection in this case, but I think @U050CJW4Q's suggestion conveys the intent better 👍.
Sets are functions so:
(data {:foo "abc" :bar "zzz"})
I blame the fact that I've been languishing in Go purgatory for 6 months and my brain cells have atrophied.
haha 🙂
You could also use a spec: https://clojuredocs.org/clojure.spec.alpha/map-of
So refining a bit... (first (filter #(= {:foo "abc" :bar "zzz"} %) data))
One could use a set containing the target map as a predicate:
(some #{{:foo "abc" :bar "zzz"}} data)
Ooo, that is even more concise than (some? (first (filter #(= {:foo "abc" :bar "zzz"} %) data)))
And a bit further to utilise some?
... (some? (first (filter #(= {:foo "abc" :bar "zzz"} %) data)))
Hi everyone. new to the channel. I am trying to sign up for tonight's london clojurians meetup but getting a dead link on meetup from the link shared on the google group.. https://www.meetup.com/London-Clojurians/events/kmskkpyxgbgc/
Looks like an issue with the London Clojurians group on meetup itself
>The page you're looking for doesn't exist >The link you followed may be broken, or the page may no longer exist.
@jr0cket Any idea who runs the London Clojurians group on http://meetup.com?
Yes, I should know as it's me 😀
I thought so, but didn't want to commit 😉
@fj.abanses looks like it's actually http://meetup.com having the issues
That shows the same error message
@yogidevbear ahh, makes sense. ha ha, the day i decide to make it to a meetup... 🙂
Maybe someone from ThoughtWorks is hanging around here that could help you out @fj.abanses
@yogidevbear thanks! i ll wait and see, otherwise will make it to the next one
I know there's a ClojureCircle meetup on 3 May at 6:30pm at Funding Circles offices. It'll be the first London-based Clojure meetup that I am going to be attending 🙂 Really looking forward to it
i ll try to make it.. it will be my first one too.. do you guys know of any more clojure(script) related dojo/pair programming meetups happening around? nice to meet you by the way..
@fj.abanses: I used to run some of the dojos at uSwitch and I'm 'co-organiser' on Meetup. Do you still get the message?
Hi @UA2R84M28, it seems fixed now! thanks
http://Meetup.com issue it seems, normal service renewed