This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-03-15
Channels
- # admin-announcements (25)
- # beginners (21)
- # boot (487)
- # cider (8)
- # clara (2)
- # cljsrn (35)
- # clojure (44)
- # clojure-austin (6)
- # clojure-russia (211)
- # clojure-uk (25)
- # clojurescript (225)
- # core-matrix (1)
- # data-science (3)
- # datomic (23)
- # events (1)
- # hoplon (9)
- # immutant (14)
- # jobs (1)
- # jobs-discuss (5)
- # ldnclj (3)
- # lein-figwheel (2)
- # off-topic (2)
- # om (65)
- # onyx (65)
- # parinfer (3)
- # pedestal (4)
- # proton (1)
- # protorepl (1)
- # re-frame (16)
- # reagent (3)
- # ring-swagger (1)
- # specter (11)
- # untangled (1)
- # yada (8)
For instance if I have a sort list of timestamps and want to count how many timestamps have previously been recorded for the same date.
@puppybits: Often you don’t want to think about iterating over it, but rather transforming it into something that gives you what you want. In your case it sounds like you probably want partition-by
(https://clojuredocs.org/clojure.core/partition-by) or take-while
(https://clojuredocs.org/clojure.core/take-while).
Or if those aren’t what you’re looking for, can you say a bit more fully what you’re trying to do?
Not really, but take a look at group-by
using a function to get the date
It will return a map of date->[item], and from there you can count the items for each date
Or (frequencies (map date-of timestamps))
(where timestamps is your list of timestamps, and date-of is a function that takes a timestamp and returns the date part of it).
Yeah I was thinking about the 'group-by' & 'partition-by' it sounds like I need to separate it out first and then run the operation on an entire group.
Or reduce
...
peeps
I've just finished the clojure-koans and I'm really happy with it
I'd like to practice a bit more clojure, anyone recommend any resources?
I'm looking to implement a pet project rather than anything else
you could do the small problems here http://exercism.io/
but yes, a great way is it just dive in and work on a real project.
welcome @jsteve1212
oh jesus it’s @samueldev
we’ve got a high of 93*F in Austin today 😛
@mariogintili: You could try http://www.codewars.com/ (I haven't delved into it yet, but they do have Clojure listed on the homepage)