Re: Why is a non-transient `into` faster than the built-in one?

2012-11-03 Thread Herwig Hochleitner
On my repl into is consistently faster. What versions of clojure, java and the OS are you running? -- 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 members are moder

Re: Why is a non-transient `into` faster than the built-in one?

2012-11-03 Thread Satoru Logic
I restart the repl and run the two versions, still `into` is slower: > > > user=> (time (do (into #{} (range 1e6)) nil)) > "Elapsed time: 4913.818 msecs" > nil > user=> (time (do (naive-into #{} (range 1e6)) nil)) > "Elapsed time: 5599.32 msecs" > nil > user=> > user=> (time (do (naive-into #{} (

Re: impossible to create classes for non-closure environment

2012-11-03 Thread Stephen Compall
On Sat, 2012-11-03 at 13:57 -0700, Vladimir Tsichevski wrote: > In one of my purely Java project I have to create hundreds of java classes > with repeatable structure, so the task is an excellent candidate for > automation. I hoped I will be able to create these classes with the latest > closure

Re: Why is a non-transient `into` faster than the built-in one?

2012-11-03 Thread Herwig Hochleitner
On my machine the version with into fluctuates around 200ms, whereas the version with naive-into fluctuates around 300ms. Have you tried running the examples multiple times to give the jit time to warm up? -- You received this message because you are subscribed to the Google Groups "Clojure" grou

Why is a non-transient `into` faster than the built-in one?

2012-11-03 Thread Satoru Logic
Hi, all. I am following an example demonstrating that `transient` can help optimize mass updates to data structures: First, a function is defined, which doesn't use transient collection: (defn naive-into > [coll source] > (reduce conj coll source)) This is supposed to run slower than the

Re: Proposal/request: Give clojure.core/conj a unary implementation

2012-11-03 Thread CGAT
That's a good point Alan, and I should have mentioned into. But this came up for me in a situation relevant to Ben's' point. I was adding or removing a computed sequence of elements of a set based on some other input and was using either conj or disj depending on that input, with apply. It worked

Re: Proposal/request: Give clojure.core/conj a unary implementation

2012-11-03 Thread Ben Wolfson
There might be a reason to write (apply f coll seqable) in a situation in which f might be conj, though. On Sat, Nov 3, 2012 at 4:25 PM, Alan Malloy wrote: > There is never a reason to write (apply conj ...). Instead, use `into`, > which does the same thing but faster and with fewer characters. >

Re: Proposal/request: Give clojure.core/conj a unary implementation

2012-11-03 Thread Alan Malloy
There is never a reason to write (apply conj ...). Instead, use `into`, which does the same thing but faster and with fewer characters. On Saturday, November 3, 2012 3:27:24 PM UTC-7, CGAT wrote: > > It would be nice if clojure.core/conj had a unary implementation > >([coll] coll) > > Th

Proposal/request: Give clojure.core/conj a unary implementation

2012-11-03 Thread CGAT
It would be nice if clojure.core/conj had a unary implementation ([coll] coll) The motivating use case is when one is conjoining sequences of items to a collection all at once: (apply conj coll seqable) such as (apply conj #{1 2 3} [2 4 6 8 10]). Currently (1.4.0), this will rais

impossible to create classes for non-closure environment

2012-11-03 Thread Vladimir Tsichevski
Hi closure developers. In one of my purely Java project I have to create hundreds of java classes with repeatable structure, so the task is an excellent candidate for automation. I hoped I will be able to create these classes with the latest closure, using the 'deftype' construct. I learned cu

Re: Easy way to implement IFn in java?

2012-11-03 Thread JvJ
Thanks! Works like a charm. On Friday, 2 November 2012 19:58:19 UTC-4, AtKaaZ wrote: > > looks like you can use AFn() in your example > ie. > static IFn assoc = new AFn(){ > @Override > public Object invoke(Object m, Object k, Object v) { > return RT.assoc(m, k, v); > } > };

Re: Problem installing Noir with Lein

2012-11-03 Thread Manuel Paccagnella
As I understand it, lein-noir was a plugin needed for Leiningen 1.x. But since Leiningen 2 you can create new projects using remote templates without having to install anything. See lein help new: If two arguments are passed, the first should be the name of a template, > and the second is used