Re: [ANN] clj-uuid: thread-safe, performant unique identifiers

2015-02-17 Thread danle...@gmail.com
Adding a UUIDNameBytes protocol is an excellent idea. That is definitely something I will look at doing. Thanks! -- 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 that posts from new

Use core.async executor with aleph

2015-02-17 Thread Robin Heggelund Hansen
>From what I can see, aleph allows me to set a executor to handle client requests. I'm already using core.async pretty heavily. Is there any reason why I shouldn't pass core.async's executor to aleph? I see I can also make every client request start on aleph's dispatch thread. Considering absol

Re: datomic <-> datascript transfers

2015-02-17 Thread henry w
For anyone else looking at this option, here is some code which is doing the work on the cljs side. https://gist.github.com/henryw-erudine/73cbcdea1eda150e78da The server code is straightforward so not included. -- You received this message because you are subscribed to the Google Groups "Clo

Re: [ANN] clj-uuid: thread-safe, performant unique identifiers

2015-02-17 Thread Steven Deobald
It's always a pleasure to see someone fill these gaps. :) Thanks Dan. Steven Deobald -- ⌀ -- nilenso.com On Tue, Feb 17, 2015 at 6:55 AM, danle...@gmail.com wrote: > Hello Clojurians, > > I've just been polishing my modest library, clj-uuid < > http://danlentz.github.io/clj-uuid/> and would lik

Performant flattening of nested data structures

2015-02-17 Thread Mark Watson
I want to flatten a map of nested maps/vecs Currently I'm using the fn's: (defn- flatten-keys* [a ks m] (cond (map? m) (reduce into (map (fn [[k v]] (flatten-keys* a (if-not (empty? ks) (str ks

Re: Performant flattening of nested data structures

2015-02-17 Thread Mark Watson
A slightly cleaner version: (defn- flatten-keys* [a ks m] (cond ;; Is a map? (map? m) (reduce into (map (fn [[k v]] (flatten-keys* a (str ks "." (name k)) v)) (seq m))) ;; Is an arr/vec/seq? (and (sequent

[ANN] Sweet Liberty: Set Your Data Free with Clojure and REST

2015-02-17 Thread Bill Piel
Blog post: https://blog.rjmetrics.com/2015/02/15/sweet-liberty-set-your-data-free-with-clojure-and-rest/ Sweet-Liberty is a library for building database-backed RESTful services using Clojure. You can think of it as a means to build and configure components that translate between REST and SQL.

Continuously Integrating Leiningen Projects

2015-02-17 Thread Rick Moynihan
Hi all, At work, we use Jenkins to continuously integrate our Clojure projects which are factored into both applications and a small number of supporting libraries; all of which use Leiningen as their project build tool. Leiningen builds each project, and runs its tests; and then if they pass it

Re: Continuously Integrating Leiningen Projects

2015-02-17 Thread Michael Blume
What we do at Climate is avoid SNAPSHOT builds. Every build gets a version string with timestamp and git commit. If an upstream library is changed, it's up to downstream maintainers to update their dependency on it. If you update a dependency and your build fails, you a) don't update your dependenc

Re: Continuously Integrating Leiningen Projects

2015-02-17 Thread Michael Blume
Related -- we run lein ancient as part of a lot of our builds so that we can easily pick up dependencies with newer available versions. On Tue Feb 17 2015 at 11:13:44 AM Michael Blume wrote: > What we do at Climate is avoid SNAPSHOT builds. Every build gets a version > string with timestamp and

Re: Performant flattening of nested data structures

2015-02-17 Thread Ivan L
i wasn't able to squeeze that much more out of it, informally maybe around 10% as it gets larger. (defn- flx ([obj] (flx obj ["$"] {})) ([obj curr res] (cond (map? obj) (reduce #(flx (%2 obj) (conj curr (str "." (name %2))) %1) res (keys obj))

Removing the 5th, 10th, 15th ... element of a list

2015-02-17 Thread Cecil Westerhof
What is the best way to remove all elements which position (counting from 1) is a multiply of five out of a list? So the list: (1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21) ​becomes: (1 2 3 4 6 7 8 9 11 12 13 14 16 17 18 19 21)​ -- Cecil Westerhof -- You received this message

Re: Removing the 5th, 10th, 15th ... element of a list

2015-02-17 Thread Ivan L
this works => (filter #(not= (mod % 5) 0) (range 22)) (1 2 3 4 6 7 8 9 11 12 13 14 16 17 18 19 21) On Tuesday, February 17, 2015 at 2:21:20 PM UTC-5, Cecil Westerhof wrote: > > What is the best way to remove all elements which position (counting from > 1) is a multiply of five out of a list? >

Re: Removing the 5th, 10th, 15th ... element of a list

2015-02-17 Thread Timothy Baldridge
True, that works, but he wants to remove based on element position, not element value. Timothy On Tue, Feb 17, 2015 at 12:28 PM, Ivan L wrote: > this works > > => (filter #(not= (mod % 5) 0) (range 22)) > (1 2 3 4 6 7 8 9 11 12 13 14 16 17 18 19 21) > > > On Tuesday, February 17, 2015 at 2:21:2

Re: Removing the 5th, 10th, 15th ... element of a list

2015-02-17 Thread Timothy Baldridge
Tweak as needed: (keep-indexed (fn [i v] (if (= 0 (mod i 5)) nil v)) (range 30)) On Tue, Feb 17, 2015 at 12:21 PM, Cecil Westerhof wrote: > What is the best way to remove all elements which position (counting from >

Re: Removing the 5th, 10th, 15th ... element of a list

2015-02-17 Thread Cecil Westerhof
2015-02-17 20:26 GMT+01:00 Timothy Baldridge : > Tweak as needed: > > (keep-indexed > (fn [i v] > (if (= 0 (mod i 5)) > nil > v)) > (range 30)) > ​I made the following: ​ ​(defn indexed-sieve [index this-list]

Re: Removing the 5th, 10th, 15th ... element of a list

2015-02-17 Thread Colin Yates
Style police would point out zero? and when-not :). On 17 Feb 2015 20:40, "Cecil Westerhof" wrote: > 2015-02-17 20:26 GMT+01:00 Timothy Baldridge : > >> Tweak as needed: >> >> (keep-indexed >> (fn [i v] >> (if (= 0 (mod i 5)) >> nil >>

Re: Removing the 5th, 10th, 15th ... element of a list

2015-02-17 Thread Timothy Baldridge
Clearly the answer is a program that runs every snippet posted to this mailing list through kibit (https://github.com/jonase/kibit). On Tue, Feb 17, 2015 at 1:49 PM, Colin Yates wrote: > Style police would point out zero? and when-not :). > On 17 Feb 2015 20:40, "Cecil Westerhof" wrote: > >> 20

Re: Removing the 5th, 10th, 15th ... element of a list

2015-02-17 Thread Colin Yates
+1 And don't forget Eastwood as well :). On a more serious note, I found http://blog.mattgauger.com/blog/2014/09/15/clojure-code-quality-tools/ has some other great tips related to this. On 17 Feb 2015 20:51, "Timothy Baldridge" wrote: > Clearly the answer is a program that runs every snippet p

Re: Performant flattening of nested data structures

2015-02-17 Thread Francis Avila
This is probably easier if you do it in two passes: one to assemble the get-in path down to a value, and another to stringify that path. (def input {:name {:first "Rich" :last "Hickey"} :number [1 415 123 4567]}) ;=> #'user/input (def expected {"$.number[0]" 1, "$.number[1]" 415, "$.number[2]" 1

Re: Removing the 5th, 10th, 15th ... element of a list

2015-02-17 Thread Colin Jones
Sounds almost like a mirror image of `clojure.core/take-nth`, so something like this is kind of fun: (defn drop-nth [n coll] (lazy-seq (when-let [s (seq coll)] (concat (take (dec n) s) (drop-nth n (drop n s)) On Tuesday, February 17, 2015 at 1:21:20 PM UTC-6, Cecil Westerhof

Lucky numbers

2015-02-17 Thread Cecil Westerhof
I programmed Lucky Numbers in Clojure: (defn indexed-sieve [index this-list] (keep-indexed (fn [i v] (if (= 0 (mod (inc i) index)) nil v)) this-list)) (defn lucky-numbers [max-value] (let [current-list(atom (indexed-sieve

Re: Summer of Code 2015

2015-02-17 Thread Daniel Lee
Great! Looking forward to applying for it. On Friday, February 13, 2015 at 9:41:58 AM UTC-8, Ambrose Bonnaire-Sergeant wrote: > > We're planning to apply. > > On Fri, Feb 13, 2015 at 12:10 PM, Rinu Boney > wrote: > >> Hi all, >> >> I was wondering if the Clojure community is applying to Goo

Re: Lucky numbers

2015-02-17 Thread Steve Miner
> On Feb 17, 2015, at 4:39 PM, Colin Jones wrote: > > Sounds almost like a mirror image of `clojure.core/take-nth`, so something > like this is kind of fun: > > (defn drop-nth [n coll] > (lazy-seq > (when-let [s (seq coll)] > (concat (take (dec n) s) (drop-nth n (drop n s))

Re: Performant flattening of nested data structures

2015-02-17 Thread Fluid Dynamics
You've probably gotten nearly all of the performance you're going to get out of it without resorting to mutability, perhaps by threading a StringBuilder instance through the whole affair, or at least accumulating not a string (via a sequence of "str" calls) but a coll and doing a big "apply str

Re: Removing the 5th, 10th, 15th ... element of a list

2015-02-17 Thread Fluid Dynamics
On Tuesday, February 17, 2015 at 2:21:20 PM UTC-5, Cecil Westerhof wrote: > > What is the best way to remove all elements which position (counting from > 1) is a multiply of five out of a list? > > So the list: > (1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21) > ​becomes: > (1 2 3

Re: Removing the 5th, 10th, 15th ... element of a list

2015-02-17 Thread Ben Wolfson
why not (mapcat next)? On Tue, Feb 17, 2015 at 3:45 PM, Fluid Dynamics wrote: > On Tuesday, February 17, 2015 at 2:21:20 PM UTC-5, Cecil Westerhof wrote: >> >> What is the best way to remove all elements which position (counting from >> 1) is a multiply of five out of a list? >> >> So the list:

Re: Lucky numbers

2015-02-17 Thread Cecil Westerhof
2015-02-18 0:28 GMT+01:00 Steve Miner : > > > On Feb 17, 2015, at 4:39 PM, Colin Jones wrote: > > > > Sounds almost like a mirror image of `clojure.core/take-nth`, so > something like this is kind of fun: > > > > (defn drop-nth [n coll] > > (lazy-seq > > (when-let [s (seq coll)] > > (

Re: Continuously Integrating Leiningen Projects

2015-02-17 Thread Rick Moynihan
Avoiding SNAPSHOT builds certainly solves the problem, but I was hoping to continue to either fully automate the process or use SNAPSHOTs between official releases library while integrating. For example right now I have four private projects on our CI server that depend on a common library I am al

Re: Continuously Integrating Leiningen Projects

2015-02-17 Thread Rick Moynihan
Thanks for the tip, I had used lein-ancient in the past and it seems to have come along a bit since then. How is it that you have this configured? Do you run lein ancient upgrade before each build that you want to check its dependencies? I tried this locally and I can't find a way to tell lein

Re: Removing the 5th, 10th, 15th ... element of a list

2015-02-17 Thread Fluid Dynamics
On Tuesday, February 17, 2015 at 6:47:59 PM UTC-5, Ben wrote: > > why not (mapcat next)? > Yeah, that should work too, though conceptually trimming each part and then reflattening the partition are two separate steps of the computation. :) > The correct answer, obviously, is > > (->> s > (co

Re: Removing the 5th, 10th, 15th ... element of a list

2015-02-17 Thread Udayakumar Rayala
Then probably (apply concat) is better than (mapcat identity) isnt it? What is (cons ::sentinel)? Why do you need it here? On Wed, Feb 18, 2015 at 5:58 AM, Fluid Dynamics wrote: > On Tuesday, February 17, 2015 at 6:47:59 PM UTC-5, Ben wrote: >> >> why not (mapcat next)? >> > > Yeah, that should

Re: Removing the 5th, 10th, 15th ... element of a list

2015-02-17 Thread Fluid Dynamics
On Tuesday, February 17, 2015 at 10:24:29 PM UTC-5, Udayakumar Rayala wrote: > > Then probably (apply concat) is better than (mapcat identity) isnt it? > > What is (cons ::sentinel)? Why do you need it here? > It'll drop the wrong elements otherwise: => (->> (range 1 22) (partition 5 5 nil)

Re: Removing the 5th, 10th, 15th ... element of a list

2015-02-17 Thread Udayakumar Rayala
Ah ok. Got it. On Wed, Feb 18, 2015 at 9:13 AM, Fluid Dynamics wrote: > On Tuesday, February 17, 2015 at 10:24:29 PM UTC-5, Udayakumar Rayala > wrote: >> >> Then probably (apply concat) is better than (mapcat identity) isnt it? >> >> What is (cons ::sentinel)? Why do you need it here? >> > > It'

Re: Lucky numbers

2015-02-17 Thread Udayakumar Rayala
Do you want the check if your initial code is working correctly? Because when I ran it, this is the output with 100 numbers: (1 3 7 9 13 15 21 25 31 33 37 43 49 51 63 67 69 73 75 79 87 93 99) I have modified it like this. I have highlighted what I have changed.: (defn indexed-sieve [index this-l

Re: [ANN] Clojure 1.7.0-alpha5 now available

2015-02-17 Thread Colin Fleming
I added a comment in CLJ-979, I believe I have a case which is broken by the change in delegation order, if I'm correct in my understanding of what

Re: Continuously Integrating Leiningen Projects

2015-02-17 Thread Michael Blume
We use a Leiningen plugin to set the version dynamically https://github.com/technomancy/leiningen/blob/master/doc/PLUGINS.md -- if you skip down to "project middleware" you'll see how to create the kind of plugin I'm talking about. Within the middleware function, we update the :version key in the

Re: Lucky numbers

2015-02-17 Thread Cecil Westerhof
2015-02-18 5:06 GMT+01:00 Udayakumar Rayala : > Do you want the check if your initial code is working correctly? Because > when I ran it, this is the output with 100 numbers: > > (1 3 7 9 13 15 21 25 31 33 37 43 49 51 63 67 69 73 75 79 87 93 99) > ​That is the correct output: http://en.wikipe

Using 1_000_000_000

2015-02-17 Thread Cecil Westerhof
In Java I can use: 1_000_000_000 This makes code a lot more readable. But it seems this is not possible in Clojure. Am I overlooking something? -- Cecil Westerhof -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email