Re: Package manager proposal

2009-08-04 Thread James Reeves
On Aug 4, 5:40 am, Phil Hagelberg wrote: > Maven actually supports dependency resolution. While I don't like Maven > much for most things, its dependency resolution mechanism and repository > format is quite good. Regarding Maven and Ivy, their dependency resolution appears to be somewhat differ

Re: Question about pmap

2009-08-04 Thread Johann Kraus
> My guess would be you're seeing the overhead for pmap since the > (inc 0.1) computation is so cheap.  From the docs for pmap: >   "Only useful for computationally intensive functions where the time of >   f dominates the coordination overhead." I don't think so, as the cheap computation (inc 0.

Re: Package manager proposal

2009-08-04 Thread Krešimir Šojat
> Please correct me if I'm wrong, but both Maven and Ivy appear to be > designed to resolve dependencies during build time. Ivy can be used as set of Ant tasks, stand-alone command line tool or as a library. If used as a library there is nothing stopping you to resolve your dependencies at runti

Re: Package manager proposal

2009-08-04 Thread James Reeves
On Aug 4, 10:57 am, Krešimir Šojat wrote: > Ivy can be used as set of Ant tasks, stand-alone command line tool or > as a library. If used as a library there is nothing stopping you to > resolve your dependencies at runtime. Could you give me an example of how you'd use Ivy in a standalone capaci

Re: Transient Data Structures

2009-08-04 Thread Garth Sheldon-Coulson
Holy smokes. This is great. It's been said before and it'll be said again: Rich really knows what he's doing. This will make number crunching in Clojure even more attractive. Question: Suppose I want to write code that will run on 1.0 but take advantage of transients if available. Is there a more

Re: Transient Data Structures

2009-08-04 Thread Garth Sheldon-Coulson
On second thought, I see that my code snippet wouldn't work. The following analogous code throws an exception. (if (resolve 'foo) (foo 1) 1) I also see that I can't use try-catch to catch symbol resolution exceptions. Does this mean I have to test for the Clojure version before runtime? In an an

Re: Minor macro help

2009-08-04 Thread John Harrop
Very clever, Meikel. --~--~-~--~~~---~--~~ 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 moderated - please be patient wit

Re: Memfn: what does it mean?

2009-08-04 Thread John Harrop
On Tue, Aug 4, 2009 at 2:22 AM, Meikel Brandmeyer wrote: > > Hi, > > On Aug 3, 10:10 pm, John Harrop wrote: > > > (defn and-ns > > "A non-short-circuiting \"and\" usable in reduce etc." > > ([] true) > > ([a] a) > > ([a b] (and a b)) > > ([a b & more] (reduce and-ns (and a b) more))) >

transient quicksort

2009-08-04 Thread Jonas
Hi I'm playing with the new transient/persistent! features in Clojure. I have implemented quicksort as described on wikipedia (http:// en.wikipedia.org/wiki/Quicksort#Algorithm). Here is the code: (defn swap-index! [v i j] (let [tmp (v i)] (assoc! v i (v j)) (assoc! v j tmp))) (defn p

Re: Newbie question on using Java Libraries

2009-08-04 Thread Adie
On Aug 3, 6:19 pm, Meikel Brandmeyer wrote: > Hi, > > On Aug 3, 10:16 am, Adie wrote: > > > for e.g > > (import '(javax.persistence Persistence) > > gives a > > java.lang.ClassNotFoundException: javax.persistence.Persistence > > (NO_SOURCE_FILE:0) error > > > How will i import javax.persistenc

Re: Package manager proposal

2009-08-04 Thread Piyush Ranjan
Coming from Ruby land and having used other languages before, I feel rubygems is quiet a good solution to this problem. Having something like this in Clojure would be terrific for a person like me who is just starting up. > > > $ clod install foo > > => installing... done. > > $ clj > > user=> (us

Re: Package manager proposal

2009-08-04 Thread Meikel Brandmeyer
Hi, On Aug 4, 1:21 pm, James Reeves wrote: > Could you give me an example of how you'd use Ivy in a standalone > capacity? I was unable to find an example of Ivy being used in the > same way one would use Rubygems or Apt. You can do "java -jar ivy.jar --help" to see the options you have, when

Re: Package manager proposal

2009-08-04 Thread Meikel Brandmeyer
Hi to myself, On Aug 4, 1:45 pm, Meikel Brandmeyer wrote: > You can have separate servers for ivy.xmls and artifacts. However the > problem is that this is configured on a per repository basis. So one > can't > have to two ivy.xmls in the same repository with different artifact > patterns. > At

Re: Package manager proposal

2009-08-04 Thread Krešimir Šojat
On 4 kol, 13:21, James Reeves wrote: > Could you give me an example of how you'd use Ivy in a standalone > capacity? I was unable to find an example of Ivy being used in the > same way one would use Rubygems or Apt. In your project you would create standard ivy.xml and ivysettings.xml files as

Re: Transient Data Structures

2009-08-04 Thread Laurent PETIT
Looks very interesting ! One question: wouldn't seem more natural to have transient named transient! and persistent! named persistent ? I see a call to transient as "Enter the mutable world", so it seems to me (transient! []) conveys more this meaning than (transient []). I see a call to persist

Re: Memfn: what does it mean?

2009-08-04 Thread Rich Hickey
On Tue, Aug 4, 2009 at 2:22 AM, Meikel Brandmeyer wrote: > > Hi, > > On Aug 3, 10:10 pm, John Harrop wrote: > >> (defn and-ns >>   "A non-short-circuiting \"and\" usable in reduce etc." >>   ([] true) >>   ([a] a) >>   ([a b] (and a b)) >>   ([a b & more] (reduce and-ns (and a b) more))) > > Don'

Re: transient quicksort

2009-08-04 Thread Albert Cardona
Jonas wrote: > Can you give any hints on how I can make the transient sort faster? I > would like to get as close as possible to the native Java speed. My guess is that you need primitive type hints. For example: (let [pivot-value (v pivot-index)] could be: (let [pivot-value (int

Re: Transient Data Structures

2009-08-04 Thread Rich Hickey
On Tue, Aug 4, 2009 at 7:54 AM, Laurent PETIT wrote: > Looks very interesting ! > > One question: wouldn't seem more natural to have transient named transient! > and persistent! named persistent ? > > I see a call to transient as "Enter the mutable world", so it seems to me > (transient! []) conve

Re: transient quicksort

2009-08-04 Thread Jonas Enlund
I get ~8% performance boost by turning swap-index! into a macro: (defmacro swap-index! [v i j] `(let [tmp# (~v ~i)] (assoc! ~v ~i (~v ~j)) (assoc! ~v ~j tmp#))) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Grou

Re: Transient Data Structures

2009-08-04 Thread Laurent PETIT
ok... 2009/8/4 Rich Hickey > > On Tue, Aug 4, 2009 at 7:54 AM, Laurent PETIT > wrote: > > Looks very interesting ! > > > > One question: wouldn't seem more natural to have transient named > transient! > > and persistent! named persistent ? > > > > I see a call to transient as "Enter the mutable

Re: Package manager proposal

2009-08-04 Thread James Reeves
On Aug 4, 12:51 pm, Krešimir Šojat wrote: > In your project you would create standard ivy.xml and ivysettings.xml > files as described on Ivy site. Download Ivy (and Ant jars if you will > create or use Packagers). After that you can retrieve your > dependencies from command line As Piyush menti

Re: Transient Data Structures

2009-08-04 Thread Sean Devlin
Rich, First of all, thank you for informing the community about this before you push it into Clojure 1.1/2.0. Developers are people, and it takes time for us to adjust to change. Advance warning helps a lot. As for the changes themselves, I don't know yet. Now, I've only thought about this br

Re: transient quicksort

2009-08-04 Thread Jonas Enlund
On Tue, Aug 4, 2009 at 3:55 PM, Albert Cardona wrote: > > Jonas wrote: >>  Can you give any hints on how I can make the transient sort faster? I >>  would like to get as close as possible to the native Java speed. > > > My guess is that you need primitive type hints. For example: > >     (let [piv

Re: Package manager proposal

2009-08-04 Thread Lauri Pesonen
2009/8/4 James Reeves : > > On Aug 4, 12:51 pm, Krešimir Šojat wrote: >> In your project you would create standard ivy.xml and ivysettings.xml >> files as described on Ivy site. Download Ivy (and Ant jars if you will >> create or use Packagers). After that you can retrieve your >> dependencies fr

Re: Package manager proposal

2009-08-04 Thread Sean Devlin
James, Just go for it. You've certainly proved you can design a library. Deliver something that works for you, and tell us if you think it's ready. If it's better than other stuff (which I suspect it will be), the community will start using it. If not, back to the drawing board. Sean On Aug 4

Re: Package manager proposal

2009-08-04 Thread Meikel Brandmeyer
Hi, On Aug 4, 3:38 pm, Lauri Pesonen wrote: > (Note: I've been writing Ant macros for the past few weeks and > I'm starting to develop a very serious case of XML allergy.) You might want to take a look at Gradle[1]. It exchanges XML for Groovy, which might be an advantage or not. It uses Ivy u

Calling all children of the 80s

2009-08-04 Thread Sean Devlin
Okay, I saw this and it *screams* Clojure http://julian.togelius.com/mariocompetition2009/ It's a AI competition for playing Super Mario. The goal is to deliver a solution on the JVM. For me, this is an excuse for working through Norvig's classic text. I'd be interested in what other people co

Re: Transient Data Structures

2009-08-04 Thread harrison clarke
you can't really use this as regular old mutable data. if you store it somewhere, and then you change it, the original will break. i don't really see how you could use this in a non-functional way and still have it work at all. like, you probably won't actually be let-binding them very often. see

Re: transient quicksort

2009-08-04 Thread Mark Addleman
I haven't tried the code, so caveat emptor: If you convert partition to a macro *AND* use type-hints, I suspect you'll see a win. The issue here is the primitive boxing that must occur when when calling a function. It's my hope that when a macro is used with the appropriate type hints, the Cloj

Re: Package manager proposal

2009-08-04 Thread John Newman
Meikel said, > > I think, "clojure context" is underestimating things. The high > integration > of external Java libraries makes it necessary that such dependencies > can be handled in the same way. > > On the other hand, will this package system be able to stradle and accommodate future platforms

Improving Clojure's primitive handling (warning: not thought through)

2009-08-04 Thread Mark Addleman
I think there may be a somewhat straightforward solution to improving Clojure's performance when passing primitives between functions. Here's my understanding of the problem: The IFn interface is a series of invoke method signatures that take a number of java.lang.Objects as parameters and return

Improving Clojure's primitive handling (warning: not thought through)

2009-08-04 Thread Mark Addleman
I think there may be a somewhat straightforward solution to improving Clojure's performance when passing primitives between functions. Here's my understanding of the problem: The IFn interface is a series of invoke method signatures that take a number of java.lang.Objects as parameters and return

Re: Improving Clojure's primitive handling (warning: not thought through)

2009-08-04 Thread Mark Addleman
Whoops, submitted that a bit too soon. I guess only couple of things to add: (1) The cost of obtaining the primitive array and returning it to the cache is likely no worse than operations on an ArrayList, so those should be very cheap. (2) The cost of coercing the primitive to a java.lang.Num

Re: Package manager proposal

2009-08-04 Thread Phil Hagelberg
James Reeves writes: > On Aug 4, 12:51 pm, Krešimir Šojat wrote: >> In your project you would create standard ivy.xml and ivysettings.xml >> files as described on Ivy site. Download Ivy (and Ant jars if you will >> create or use Packagers). After that you can retrieve your >> dependencies from

Re: Improving Clojure's primitive handling (warning: not thought through)

2009-08-04 Thread Mark Addleman
Actually, you probably wouldn't want to use an array. Instead, cache could be made up of IPrimitiveHolder objects: public interface IPrimitiveHolder { public java.lang.Object toBoxedObject(); public int toChar(); public int toByte(); public int toInt(); ... } On Aug 4, 8:06 am,

Re: Improving Clojure's primitive handling (warning: not thought through)

2009-08-04 Thread Boris Mizhen - 迷阵
You are suggesting creating mutable boxed numbers with an object pool. You might want to do this with a custom classes, not a one-element array, because you want to be able to tell if this is your hack or just someone is passing a one-element array ... > Once the threadlocal cache is of sufficie

Re: Improving Clojure's primitive handling (warning: not thought through)

2009-08-04 Thread Boris Mizhen - 迷阵
> You might want to do this with a custom classes, not a one-element > array, because you want to be able to tell if this is your hack or > just someone is passing a one-element array ... Crossed in the air :) Another question - at what point do the objects return to the pool? It seems to me tha

Re: Improving Clojure's primitive handling (warning: not thought through)

2009-08-04 Thread Mark Addleman
On Aug 4, 8:12 am, Boris Mizhen - 迷阵 wrote: > You are suggesting creating mutable boxed numbers with an object pool. > > You might want to do this with a custom classes, not a one-element > array, because you want to be able to tell if this is your hack or > just someone is passing a one-elemen

Re: Improving Clojure's primitive handling (warning: not thought through)

2009-08-04 Thread Rich Hickey
On Tue, Aug 4, 2009 at 11:02 AM, Mark Addleman wrote: > > I think there may be a somewhat straightforward solution to improving > Clojure's performance when passing primitives between functions. > Here's my understanding of the problem:  The IFn interface is a series > of invoke method signatures

Re: Improving Clojure's primitive handling (warning: not thought through)

2009-08-04 Thread Boris Mizhen - 迷阵
>> I don't think this is true if you take closures into account. > > I hadn't thought about closures.  I can see how closures can increase > the number of primitive holder objects but I don't see that they > inviolate the approach.  It's possible that closures would explode the > size of the objec

Re: Improving Clojure's primitive handling (warning: not thought through)

2009-08-04 Thread Mark Addleman
On Aug 4, 8:21 am, Rich Hickey wrote: > On Tue, Aug 4, 2009 at 11:02 AM, Mark Addleman > wrote: > > > I think there may be a somewhat straightforward solution to improving > > Clojure's performance when passing primitives between functions. > > Here's my understanding of the problem:  The IFn

Re: Improving Clojure's primitive handling (warning: not thought through)

2009-08-04 Thread Boris Mizhen - 迷阵
> Second, the caching is a barrier to escape analysis. Since rather than > seeing a freshly-boxed integer 42, which can be optimized away, the > compiler sees a branch into cache lookup code that returns something > the compiler cannot know, thus it can't get rid of the lookup. Rich, please pardon

Re: Transient Data Structures

2009-08-04 Thread Boris Mizhen - 迷阵
> As a second point, I don't like the introduction of assoc!, conj!, > etc.  It just strikes me as another bug to have (oh, right, I need > assoc! not assoc...). At least you will get a very clear error, I think it's possible to get a compile time error if you are dealing with a local. It will be

Re: Transient Data Structures

2009-08-04 Thread Howard Lewis Ship
These aren't criticisms, just trying to understand this better. So assoc! etc. return a new instance of the transient? Or do they return the same transient? If they return a new instance, what exactly is the advantage (though, obviously there is one, from the transcript). If they return the sa

Re: Transient Data Structures

2009-08-04 Thread Rich Hickey
On Aug 4, 12:35 pm, Howard Lewis Ship wrote: > These aren't criticisms, just trying to understand this better. > > So assoc! etc. return a new instance of the transient? They return the next value of the transient. > Or do they > return the same transient? I'm not promising that they do. >

Re: Transient Data Structures

2009-08-04 Thread Howard Lewis Ship
On Tue, Aug 4, 2009 at 10:03 AM, Rich Hickey wrote: > > > > On Aug 4, 12:35 pm, Howard Lewis Ship wrote: >> These aren't criticisms, just trying to understand this better. >> >> So assoc! etc. return a new instance of the transient? > > They return the next value of the transient. > >> Or do they

Re: Improving Clojure's primitive handling (warning: not thought through)

2009-08-04 Thread Rich Hickey
On Aug 4, 11:27 am, Boris Mizhen - 迷阵 wrote: > > Second, the caching is a barrier to escape analysis. Since rather than > > seeing a freshly-boxed integer 42, which can be optimized away, the > > compiler sees a branch into cache lookup code that returns something > > the compiler cannot know,

Re: Transient Data Structures

2009-08-04 Thread Rich Hickey
On Tue, Aug 4, 2009 at 1:06 PM, Howard Lewis Ship wrote: > > On Tue, Aug 4, 2009 at 10:03 AM, Rich Hickey wrote: >> >> >> >> On Aug 4, 12:35 pm, Howard Lewis Ship wrote: >>> These aren't criticisms, just trying to understand this better. >>> >>> So assoc! etc. return a new instance of the transie

Re: Transient Data Structures

2009-08-04 Thread John Newman
I'm a noob, so this is probably a dumb question but, how does this work with closures? Can transients be closed over? Like, (defn make-transient-counter [init-val] > (let [acounter (transient [init-val])] > (fn [add-val] (assoc! acounter 0 (+ add-val (nth acounter 0)) > Is that possib

Re: Transient Data Structures

2009-08-04 Thread Rich Hickey
On Tue, Aug 4, 2009 at 1:32 PM, John Newman wrote: > > I'm a noob, so this is probably a dumb question but, how does this work with > closures?  Can transients be closed over? > > Like, > >> (defn make-transient-counter [init-val] >>   (let [acounter (transient [init-val])] >>     (fn [add-val] (a

Re: transient quicksort

2009-08-04 Thread Jarkko Oranen
On Aug 4, 11:08 am, Jonas wrote: > Hi > > I'm playing with the new transient/persistent! features in Clojure. I > have implemented quicksort as described on wikipedia (http:// > en.wikipedia.org/wiki/Quicksort#Algorithm). Here is the code: > > (defn swap-index! [v i j] >   (let [tmp (v i)] >    

Re: Improving Clojure's primitive handling (warning: not thought through)

2009-08-04 Thread Fredrik Ohrstrom
As Rich says, a cache would probably destroy the performance. The current prerequisite to optimizing away boxed parameters, is that the JVM can inline the function call and the JVM usually inlines a lot! It can even inline code that C++ cannot, i.e. code that is virtual. It avoids code bloat by on

pmap uses more parallelism than intended due to use of "eager" map?

2009-08-04 Thread Andy Fingerhut
I was looking into the question raised in the "Question about pmap" thread, and noticed that on my Mac and on a Linux virtual machine, a recent git version of clojure (about 1 week old) seems to use more parallelism in 'pmap' than its source code in core.clj would imply is the intent. The code th

Re: Transient Data Structures

2009-08-04 Thread John Harrop
On Tue, Aug 4, 2009 at 1:39 PM, Rich Hickey wrote: > > On Tue, Aug 4, 2009 at 1:32 PM, John Newman wrote: > > > > I'm a noob, so this is probably a dumb question but, how does this work > with > > closures? Can transients be closed over? > > > > Like, > > > >> (defn make-transient-counter [init-v

Re: Question about pmap

2009-08-04 Thread Andy Fingerhut
Johann: Could it be that your CPU has a single floating-point unit shared by 4 cores on a single die, and thus only 2 floating-point units total for all 8 of your cores? If so, then that fact, plus the fact that each core has its own separate ALU for integer operations, would seem to explain the

Re: Transient Data Structures

2009-08-04 Thread Rich Hickey
On Aug 4, 4:31 pm, John Harrop wrote: > On Tue, Aug 4, 2009 at 1:39 PM, Rich Hickey wrote: > > > On Tue, Aug 4, 2009 at 1:32 PM, John Newman wrote: > > > > I'm a noob, so this is probably a dumb question but, how does this work > > with > > > closures?  Can transients be closed over? > > > > L

Re: pmap uses more parallelism than intended due to use of "eager" map?

2009-08-04 Thread Andy Fingerhut
Ugh. A couple minutes of more careful searching and I had the answer. It isn't because the map used by pmap is eager, it is because it optimizes for input collections that are chunked. It seems worth considering modifying pmap to either: (1) use a lazy version of map, with no optimization for

Reflection warning: reference to field getClass can't be resolved.

2009-08-04 Thread Vagif Verdi
When reflection warning is on, i get 2 warnings on every my file: reference to field getClass can't be resolved. reference to field getClassLoader can't be resolved. Is this something i should be worried about ? --~--~-~--~~~---~--~~ You received this message bec

Re: Newbie question about peepcode server "Address already in use error"

2009-08-04 Thread Leotis buchanan
Thanks On Mon, Aug 3, 2009 at 6:03 PM, Phil Hagelberg wrote: > Leotis buchanan writes: > > > I located the process, using nstat, and then I killed it,This worked, > > however this also killed my slime connection, which is bad, how can I > > release the address without killing the slime connecti