This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-02-19
Channels
- # announcements (1)
- # aws (9)
- # beginners (136)
- # boot (4)
- # cider (11)
- # clara (36)
- # clojure (337)
- # clojure-europe (5)
- # clojure-italy (3)
- # clojure-nl (2)
- # clojure-spec (9)
- # clojure-uk (112)
- # clojured (7)
- # clojurescript (93)
- # core-async (2)
- # cursive (30)
- # datomic (6)
- # duct (4)
- # emacs (2)
- # figwheel (1)
- # figwheel-main (7)
- # fulcro (153)
- # kaocha (1)
- # off-topic (12)
- # om-next (1)
- # pedestal (58)
- # planck (6)
- # re-frame (15)
- # reitit (11)
- # shadow-cljs (113)
- # spacemacs (1)
- # specter (3)
- # vim (8)
If I want to use a goofy looking keyboard, it'll be my Model F (which hopefully isn't vapourware)
I really like keyboards which are vertical, I have thought about setting up extreme tilting for my ergodox
Dumb clojure question of the day.
(->> some-coll
(sort-by :year)
(sort-by :type))
If you have a collection of things and you want them sorted by say year, then type, is this the best way to do it? It work’s but it seems like there must be a better way to do it. Any thoughts?Er potentially, but the output should look something like
[ {:type A :year 2014}
{:type A :year 2016}
{:type B :year 2013}
{:type B :year 2017}]
but if the list is long, you’d probably want to implement your own comparator so that you don’t have to (partially) sort the list twice
ok cool, so my question has evolved into, using comparator’s to sort a collection of items. Thanks I’ll do a google and try again 😄
wow nice i didn’t even know about that haha. I should really check the clojure docs more 😅
@guy fwiw, you can compare vectors, so I think this would work: (sort-by (juxt :type :year) coll)
user=> (sort-by (juxt :type :year) [{:type "B" :year 2017} {:type "B" :year 2013} {:type "A" :year 2016} {:type "A" :year 2014}])
({:type "A", :year 2014} {:type "A", :year 2016} {:type "B", :year 2013} {:type "B", :year 2017})
>for what it's worth
@guy, +1 to @U09LZR36F's solution. As an aside, I extended the initial collection to have a bit more of a mixed example:
(def m
[{:type "A", :year 2014}
{:type "A", :year 2012}
{:type "B", :year 2017}
{:type "B", :year 2013}
{:type "A", :year 2019}
{:type "B", :year 2016}])
I think your initial approach of sorting by :year and then :type was correct:
user=> (clojure.pprint/pprint (->> m (sort-by :year) (sort-by :type)))
({:type "A", :year 2012}
{:type "A", :year 2014}
{:type "A", :year 2019}
{:type "B", :year 2013}
{:type "B", :year 2016}
{:type "B", :year 2017})
Compared to doing it by :type and then :year
user=> (clojure.pprint/pprint (->> m (sort-by :type) (sort-by :year)))
({:type "A", :year 2012}
{:type "B", :year 2013}
{:type "A", :year 2014}
{:type "B", :year 2016}
{:type "B", :year 2017}
{:type "A", :year 2019})
And using Dominic's solution 🙂
user=> (clojure.pprint/pprint (sort-by (juxt :type :year) m))
({:type "A", :year 2012}
{:type "A", :year 2014}
{:type "A", :year 2019}
{:type "B", :year 2013}
{:type "B", :year 2016}
{:type "B", :year 2017})
I think its more passing a function that returns a vector, which is then used for the sorting
or something
morning
ahoy hoy!
I'm enjoying Star Trek Discovery season 2 and am happy that The Expanse seasons 2&3 are now on Amazon Prime.
We've just finished watching Lucifer S3, which will now migrate the other way to Netflix
i tried lucifer - found it quite disappointing and didn't get beyond S1
It's not particularly clever, and has got a bit samey by the end of S3, but it's something we can watch together and poke fun at
Whereas The Punisher and Daredevil we actually paid proper attention to and thought were good 😉
aha, i'll check those out then 🙂
Missed a good Haskell talk at LambdaLounge last night @alex.lynham 🙂
@otfrom I’m super worried that there’s no way the expanse can catch up with the books before it gets cancelled
@carr0t yeah was gutted, helped to organise it and all
Watchlist: Currently on Goliath on Prime but did the full five series of Luther, the Russian Doll (which I loved)
I've almost finished Russian Doll but I need to put any other series on hold.... got a 40 min conference talk and two blogs to write to deadlines!
on my lunch break I finished my newest most garish emacs theme hack https://github.com/the-frey/emacs/blob/cyberpunk_overhaul/README.md
(there’s a screenshot on the actual GH page)
Cult classic 😄
Cult classic 😄
Cult classic 😄
Cult classic 😄
Cult classic 😄
Cult classic 😄
Cult classic 😄
Cult classic 😄
@U05390U2P :thinking_face:
more that we're all older animals 😉
Female Russian (ish. Russian sounding name, American sounding accent) software engineer with a penchant for drugs and partying keeps dying and resetting to the same point in time, waking up in the bathroom at her birthday party with memory of the future events up to her death
anyone got any reccs for elementary clojure learning resources ?
I found this one to be super useful too http://iloveponies.github.io/120-hour-epic-sax-marathon/
This ClojureBridge workshop is a bit more up to date https://clojurebridgelondon.github.io/workshop/
I’ll be adding more content soon. If you want some video content, take a look at my YouTube playlist https://www.youtube.com/playlist?list=PLy9I_IfUBzKJSgctCJaRYcnF6kZdiZ5ku
clojure for the brave and true isn’t bad
although it depends on the goal
I ended up doing that web apps workshop for (mainly) python folks and had a lot more success
yeah, it's for ilayda - she's learning to program!
which workshop is that
that blog has a dump of all the gists and links you need
nice - that looks spot on
there’s an interactive repl with clojure basics and a heroku ready repo with a ring app in it
takes about 2hrs to get through
Anyone watching The Umbrella Academy? We're about five or six eps in and loving it.