Fork me on GitHub
#clojure-uk
<
2017-10-23
>
thomas07:10:48

moin moin morning

guy07:10:52

morning!

thomas08:10:57

aarrrrrgghhh looks like the new leiningen has problems with our project.clj.... 😡

thomas08:10:36

it worked before I went on holiday.... now it has stopped working and it is the only thing that has changed. most annoying.

guy08:10:47

ooh whats the new leiningen?

guy08:10:51

new release?

danm08:10:51

Fix for the Java 9 issues?

danm08:10:40

I only use lein in terms of boot boot.lein/generate so that Cursive can understand my projects

thomas08:10:41

2.8 is the new lein... I went back to 2.7.1 for the moment.

Rachel Westmacott08:10:15

@nomiskatz found the video for that talk - looks super interesting. as does rewrite-clj As I don’t feel like rummaging for source code right now, I’m settling for a pprint.

seancorfield16:10:36

@thomas I've seen several people report problems with Leiningen 2.8.0 and have to downgrade to 2.7.1 -- what sort of things are you seeing?

otfrom16:10:18

I had to upgrade my java version (even within Java 1.8)

seancorfield17:10:40

Hmm, yeah, I seem to recall seeing a commit on Leiningen that referenced a specific version of Java 8 as a minimum. Don't remember what functionality that was related to...

seancorfield17:10:36

...cgroups memory limit, I think.

seancorfield17:10:58

Looks like 2.8.1 is out already with a fix for that?

otfrom20:10:44

tfw you think you've re-written something from core or something cgrand wrote

otfrom20:10:45

user> (defn partition-by-seq
  "Takes a seq giving the template for expected key values (say
  timestamps in a series with a regular period, a predicate pred to
  compare the template value with the data values to take or drop in
  order to create partitions."
  [template pred data]
  (lazy-seq
   (when (seq template)
     (let [tprime (first template)
           predprime (partial pred tprime)]
       (cons [tprime (take-while predprime data)]
             (partition-by-seq (drop 1 template) pred (drop-while predprime data)))))))

#'user/partition-by-seq
user> (partition-by-seq [0 2 4 6 8]
                        (fn [x y] (<= y x))
                        [0 2 3 4 7 9])
([0 (0)] [2 (2)] [4 (3 4)] [6 ()] [8 (7)])

otfrom20:10:51

There are times where I need to combine time series that need to have the same period so I'd use this with a period-seq from clj-time or similar and a more complicated pred function to work on a map with a timestamp and a value in a map

otfrom20:10:04

If you think of the output as a seq of vector tuples where the first is millis since the epoc and the second is the seq of all the things that happen in that time period (or not).

otfrom20:10:29

would love it if someone told me the obvious thing I'm missing or otherwise commented on it. 🙂

otfrom21:10:28

it is all a lazy-seq atm. I think it should be possible to do as a transducer, but I've not thought my way around it yet.