Fork me on GitHub
#clojure-uk
<
2018-04-24
>
alexlynham08:04:25

guy from audi talking about wanting to give you a 25th hour in the day

alexlynham08:04:58

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

acron08:04:27

which conf you at @alex.lynham?

alexlynham08:04:08

the kafka summit

otfrom08:04:41

I understand kafka streaming is so fast that you get relativistic problems

otfrom08:04:52

so it might be 25 hours to people outside

alexlynham08:04:22

really interesting testing talk

alexlynham08:04:07

there's definitely an intersection where clojure, schemas and generative testing meet for making good CI/test possible for streaming use cases

maleghast09:04:00

Morning All! 🙂

otfrom10:04:38

lovely and sunny in Dundee

thomas10:04:19

here in NL it us suddenly a lot colder... summer is over it seems

dominicm10:04:11

The UK's 3 days of summer are over, bring on autumn

yogidevbear10:04:40

Oh ye of little faith 😉

otfrom10:04:38

I didn't say it was warm in Dundee. Just sunny. 🙂

thomas10:04:00

@otfrom from my experience that makes very little difference for the British. (when sunny (wear-shorts))

alexlynham11:04:57

every day is black jeans day imho

alexlynham11:04:05

it ain't easy being metal

otfrom11:04:59

taps aff in Scotland

otfrom11:04:33

@alex.lynham Goth is dead (trendy again). As I saw on a poster in Leeds once.

😂 4
3Jane11:04:52

@alex.lynham surely you’re allowed a bit of grey for summer?

alexlynham11:04:50

sometimes a very very dark green tshirt

alexlynham11:04:29

but I only have black jeans

3Jane11:04:13

moss green you savage

3Jane11:04:26

need to upgrade your colour picker library

alexlynham11:04:20

more a british racing green

yogidevbear12:04:03

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?

3Jane12:04:13

some, maybe?

3Jane12:04:43

(you don’t need to filter the whole list, you can stop at the first item if you’re just confirming it’s there)

yogidevbear12:04:36

Is it possible to do something along these lines (some {:foo "abc" :bar "zzz"} data)?

yogidevbear12:04:44

That returns nil so not correct

3Jane12:04:48

this is making me think destructuring

minimal12:04:09

(first (filter #(= {:foo "abc" :bar "zzz"} (select-keys % [:foo :bar])) data)) could work

minimal12:04:40

but not sure if nicer or not

3Jane12:04:41

(some (fn [{foo :foo bar :bar}] (= [foo bar] ["abc" "zzz"])) data) ish (not at repl)

3Jane12:04:52

oh, select keys works too (couldn’t remember what the method was called)

yogidevbear12:04:04

All good food for thought

yogidevbear12:04:27

This seems to work. Feels a bit cleaner. (filter #(= {:foo "abc" :bar "zzz"} %) data)

yogidevbear12:04:59

I know that my data will always have only :foo and :bar so don't think I need the select-keys

👍 4
minimal12:04:32

If your data is exactly as described then (contains? data {:foo "abc" :bar "zzz"}) will be faster

yogidevbear12:04:46

Do you know how that would compare to @U0HJFE43U's suggestion of (some #{{:foo "abc" :bar "zzz"}} data)?

minimal12:04:24

if data is actually a set and you only need to check one map contains? will be faster

yogidevbear12:04:25

Actually, I'm look for a true/false result so ideally need some?, not some... :thinking_face:

minimal12:04:25

some? and some are quite different really.

yogidevbear12:04:37

Yeah, seeing this

yogidevbear12:04:03

I like your contains? solution. Feels the most concise for what I'm trying to achieve

minimal12:04:05

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

👍 4
rhinocratic12:04:12

The data isn't an indexed collection in this case, but I think @U050CJW4Q's suggestion conveys the intent better 👍.

👍 4
rickmoynihan13:04:01

Sets are functions so: (data {:foo "abc" :bar "zzz"})

rhinocratic13:04:25

Blimey - of course! Can't seem to find a facepalm emoji. :thinking_face:

4
😉 4
rhinocratic13:04:28

I blame the fact that I've been languishing in Go purgatory for 6 months and my brain cells have atrophied.

fmjrey14:04:49

maybe not as efficient, but spec can grow

yogidevbear12:04:17

So refining a bit... (first (filter #(= {:foo "abc" :bar "zzz"} %) data))

rhinocratic12:04:38

One could use a set containing the target map as a predicate:

(some #{{:foo "abc" :bar "zzz"}} data)

yogidevbear12:04:34

Ooo, that is even more concise than (some? (first (filter #(= {:foo "abc" :bar "zzz"} %) data)))

yogidevbear12:04:08

And a bit further to utilise some?... (some? (first (filter #(= {:foo "abc" :bar "zzz"} %) data)))

javi12:04:42

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/

yogidevbear12:04:57

Looks like an issue with the London Clojurians group on meetup itself

yogidevbear12:04:17

>The page you're looking for doesn't exist >The link you followed may be broken, or the page may no longer exist.

javi12:04:39

i get the same msg

4
yogidevbear12:04:50

@jr0cket Any idea who runs the London Clojurians group on http://meetup.com?

practicalli-johnny16:04:08

Yes, I should know as it's me 😀

yogidevbear16:04:32

I thought so, but didn't want to commit 😉

yogidevbear12:04:18

@fj.abanses looks like it's actually http://meetup.com having the issues

yogidevbear12:04:29

That shows the same error message

javi12:04:10

@yogidevbear ahh, makes sense. ha ha, the day i decide to make it to a meetup... 🙂

danm12:04:56

I disapprove of the water in this city...

yogidevbear12:04:29

Maybe someone from ThoughtWorks is hanging around here that could help you out @fj.abanses

javi12:04:28

@yogidevbear thanks! i ll wait and see, otherwise will make it to the next one

yogidevbear12:04:07

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

3Jane12:04:52

oooh! I’m going to that one too, be good to see people from slack irl 🙂

💯 4
javi13:04:57

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

javi14:04:11

meetup link is fixed now

Aleksander13:04:51

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

javi13:04:12

Hi @UA2R84M28, it seems fixed now! thanks

practicalli-johnny16:04:12

http://Meetup.com issue it seems, normal service renewed