Fork me on GitHub
#clojure-uk
<
2019-05-08
>
yogidevbear08:05:02

Morning πŸ™‚

yogidevbear09:05:43

If anyone happens to be near Horsham this evening, we'll be hosting our monthly meetup. The current plan is for @matttylr to demo of Clojure Pedestal's interceptors to demonstrate the use of first class functions and Clojure's data structures together. Check out https://www.meetup.com/Horsham-Functional-Programming/events/xcbwxqyzhblb/ for more info if you interested in joining us.

Olical10:05:38

So I'm planning on talking at London Clojurians over the next couple of months about prepls. Anyone have any good name suggestions? I'm hoping for something punny that would make people groan and maybe facepalm (propel, prepare?) I'll be focusing on what the prepl is, how it works, what we can use it for and what I've been doing with it (building prepl tooling over prepl tooling). I'll probably touch on what nREPL does for you and how it differs too (spoiler: nREPL does SO much more for you). I'll show integration with figwheel, Clojure and vanilla ClojureScript so it'll be a pretty wide tour of the landscape I hope.

Olical10:05:09

I think it'll mostly be demo rather than slide based, so that could go horribly. Worth seeing if only just for me trying to get xrandr to play ball πŸ˜„

Olical10:05:01

This is also a chance for anyone to shape the talk, let me know what you'd be interested in! (I'll also be demoing Conjure fairly heavily since it's prepl tooling, so that might be interesting for vim folks)

prnc11:05:07

repl, rebl, nrepl, prepl

prnc11:05:15

😜

Olical11:05:10

It's almost "lions and tigers and bears oh my"-esc.

rickmoynihan12:05:51

sounds like a good talk… I’d certainly like to see a recording of it πŸ™‚

yogidevbear15:05:37

Just in case anyone was thinking of popping in, we've had to cancel tonight's meetup due to lack of (any) attendees

tumbleweed 4
seancorfield16:05:57

I'd certainly attend that talk if I was in the area!

seancorfield16:05:10

Like Rick, I hope there's a recording of it πŸ™‚ Or maybe you could submit it to Conj and I could see it in the flesh over here? @olical

Olical08:05:22

This sounds extremely terrifying and I'd definitely need to come up with more content. I think Clojure eXchange in London is a big enough jump for me right now πŸ˜… and I haven't even applied there yet!

seancorfield16:05:47

@yogidevbear Sorry no one turned up 😞 I've had that happen as a user group organizer. And that was with an invited speaker, sometimes, too. There'd be just me, the speaker, and whoever was hosting the meetup (and sometimes no host showed up).

yogidevbear16:05:21

@seancorfield We had a meetup about 2 weeks ago so I don't feel too bad. We had two people that were hoping to attend, but one is at devoxx this week and the other is stuck in London.

yogidevbear16:05:49

We'll keep persisting on a regular monthly basis and see if it improves over summer

yogidevbear16:05:24

One limitation we've just hit is the 50 attendee group limit on http://meetup.com

yogidevbear16:05:14

@jr0cket out of interest, are you using YouTube live to broadcast you weekend online lessons?

practicalli-johnny17:05:01

Happy to have a chat about YouTube broadcasting and the two different user interfaces (just riding home now though)

yogidevbear17:05:49

I'd be really keen to hear about it. Maybe later in the week πŸ™‚

practicalli-johnny23:05:53

Early next week suits me. This week is full on... I have Sunday afternoon off, which is earliest I have time

yogidevbear17:05:14

Anyone listened to the David Nolen interview on https://clojurescriptpodcast.com/ ?

practicalli-johnny17:05:03

@yogidevbear yes. Will be using https://obsproject.com/ as a streaming client very soon. Creating separate channels on YouTube, as their UI is so hard to find anything & it allows people to subscribe to my Clojure and not my cycling in the rain videos 😁

practicalli-johnny17:05:54

I will be listening to that podcast soon, as I am supposed to be on it at some point 😁

yogidevbear17:05:06

Ooo exciting πŸ™‚

practicalli-johnny17:05:49

I am at Devoxx UK if anyone wants to do some Clojure 😁

maleghast17:05:42

@jr0cket - Devoxx UK ..??

practicalli-johnny23:05:26

Sorry, very busy this week

practicalli-johnny23:05:24

Devoxx is a conference, focusing on the JVM community (Java, Scala, Clojure, etc). Lots of interesting stuff about GraalVM this time around, will try out some more Clojure with GraalVM soon.

maleghast17:05:57

(I know I could Google it, I am looking for a conversation)

otfrom18:05:42

I'm having fun playing with cljplot, but I've made some ugly code

otfrom18:05:06

(t/deftest test-aggregate-by-domain
  (t/testing "Happy path"
    (t/is (= (sut/aggregate-by-domain :year
                                      (map :fruit) :fruit x/count
                                      [{:year 1 :fruit "apple"}
                                       {:year 1 :fruit "apple"}
                                       {:year 1 :fruit "pear"}
                                       {:year 2 :fruit "apple"}
                                       {:year 2 :fruit "pear"}
                                       {:year 2 :fruit "pear"}])
             {1 [2 1], 2 [1 2]}))))

otfrom18:05:17

is the test

otfrom18:05:42

(defn aggregate-by-domain [domain-key
                           sub-domain-xf sub-domain-key sub-domain-aggregate-xf
                           data]
  (let [sub-domain (into (sorted-set)
                         sub-domain-xf
                         data)]
    (->> (into (sorted-map)
               (x/by-key domain-key
                         (comp
                          (x/by-key sub-domain-key sub-domain-aggregate-xf)
                          (x/into (into (sorted-map)
                                        (map #(vector % 0)
                                             sub-domain)))))
               data)
         (reduce-kv (fn mapvals [a k v]
                      (assoc a k (mapv second v)))
                    (sorted-map)))))

otfrom18:05:44

is the code

otfrom18:05:09

the ordered output is what the plotting code is expecting

otfrom18:05:24

(defn grouped-column
  ([domain-key domain-name
    sub-domain-xf sub-domain-key sub-domain-name sub-domain-aggregate-xf
    range-name
    records]
   (let [domain (into (sorted-set)
                      sub-domain-xf
                      records)
         data (aggregate-by-domain domain-key
                                   sub-domain-xf
                                   sub-domain-key
                                   sub-domain-aggregate-xf
                                   records)
         palette (take (count domain) (color/palette-presets :green-orange-teal))
         legend-spec (mapv
                      (fn [d p]
                        [:rect d {:color p}])
                      domain palette)]
     (-> (plotb/series [:stack-vertical [:bar data {:palette palette}]])
         (plotb/preprocess-series)
         (plotb/update-scale :y :ticks 20)
         (plotb/update-scale :y :fmt "%,.0f")
         (plotb/add-axes :left)
         (plotb/add-axes :bottom)
         (plotb/add-label :bottom domain-name)
         (plotb/add-label :left range-name)
         (plotb/add-legend sub-domain-name legend-spec)
         (plotr/render-lattice {:width 800 :height 600})))))

otfrom18:05:52

that reduce-kv after using xforms bugs me. I had an uglier way of doing it before, but I feel like I should be able to do it all using xforms

otfrom18:05:31

this will all be public once I tidy it up. It is just one step beyond repl barf atm

otfrom18:05:57

it does make pretty pictures πŸ™‚

Ben Hammond09:05:59

that's alot of nested complexity can you write a (transduce clause that β€’ runs sub-domain-xf (presumably this is a filter?) β€’ creates a vector of keys (suitable for assoc-in) and their value β€’ write a variant of assoc-in that creates intermediary (sorted-map)s β€’ have a single reducing function that calls this assoc-in to return nested sorted maps

otfrom12:05:41

@U793EL04V yeah, I think you are right there. After sleeping on it I've thought of some better ways to break it down. I think the by-key stuff while cool might be a bit too much for me to wrap my head around at the moment