Re: Critiques of "my-flatten" which uses CPS

2014-07-18 Thread Mark Phillips
Thanks - useful idioms to know about! On Friday, 18 July 2014 16:18:33 UTC+9:30, puzzler wrote: > > Yeah, you've answered your own question. In practice, I doubt the > difference is measurable. > > Another common idiom you see in Clojure code is: > (defn f [xs] > (if-let [s (seq xs)] > ...

unexpected behavior of clojure.core/empty

2014-07-18 Thread Brian Craft
=> (empty [:foo 5]) [] => (first (mapv identity {:foo 5})) [:foo 5] => (empty (first (mapv identity {:foo 5}))) nil What just happened there? Is this expected? In the second and third cases the type of the vector is clojure.lang.MapEntry, which I expect is the root of the behavior, but this seem

Re: unexpected behavior of clojure.core/empty

2014-07-18 Thread Bob Hutchison
On Jul 18, 2014, at 5:45 AM, Brian Craft wrote: > => (empty [:foo 5]) > [] > => (first (mapv identity {:foo 5})) > [:foo 5] > => (empty (first (mapv identity {:foo 5}))) > nil => (class (first (mapv identity {:foo 5}))) clojure.lang.MapEntry => (class (first (mapv (fn [[k v]] [k v]) {:foo 5})))

Re: unexpected behavior of clojure.core/empty

2014-07-18 Thread Mike Fikes
My guess: Perhaps this is a bug, or alternatively, a known issue that won't be addressed because to do so would be a breaking change. There is an old demo of Clojure given by Rich where MapEntry's were printed using some sort of un-readable notation #<:foo 5>. But clearly MapEntry's have been r

Re: unexpected behavior of clojure.core/empty

2014-07-18 Thread Neel Upadhyaya
While MapEntry is displayed as a vector it isn't actually a collection (which is a mistake I sometimes make also), so empty behaves as expected. On Friday, 18 July 2014 10:45:19 UTC+1, Brian Craft wrote: > > => (empty [:foo 5]) > [] > => (first (mapv identity {:foo 5})) > [:foo 5] > => (empty (fi

Re: Calculating the number of timestamps logged within a specific time period

2014-07-18 Thread John Gabriele
On Thursday, July 17, 2014 8:49:12 AM UTC-4, empt...@gmail.com wrote: > > Hi, > > I have a list of epoch times which map to HTTP requests. > > '(1405060202611 > 1405060201157 > 1405060201361 > 1405060201261 > 1405060200391 > 1405060201458 > 1405060201705 > 1405060201058 > 1405060205062 > 14050602

Re: Calculating the number of timestamps logged within a specific time period

2014-07-18 Thread Mike Fikes
You could use frequencies: user=> (frequencies (map #(quot % 1000) epochs)) {1405060202 1, 1405060201 8, 1405060200 1, 1405060205 1} -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note t

Rxtx Serial Dependency issues with ARM processor

2014-07-18 Thread Samuel Nelson
We are trying to include a serial port handler package in our project. We tried to use the rxtx22 1.0.6 clojar... this works on laptops but not on the smaller computer with an ARM processor. we tried following the instructions here: (except we are using the localrepo plugin for lein to manage

Re: Rxtx Serial Dependency issues with ARM processor

2014-07-18 Thread Jozef Wagner
Hi, AFAIK RXTX is obsolete, you may have more luck with JSSC [1]. Including it in your Clojure project is easy, just add [org.scream3r/jssc "2.8.0"] While it's not perfect, its pretty solid from my experience. There is a support for ARM, but I've been using it only in x86-64 Linux. [1] https://g

Re: unexpected behavior of clojure.core/empty

2014-07-18 Thread Brian Craft
hm, looks even more broken in the context of these examples. On Friday, July 18, 2014 5:04:34 AM UTC-7, Mike Fikes wrote: > > My guess: Perhaps this is a bug, or alternatively, a known issue that > won't be addressed because to do so would be a breaking change. > > There is an old demo of Clojure