Re: Current API doc (for HEAD)

2009-08-07 Thread Tom Faulhaber
Tom, are you amenable? Yup, happy to. Where should it go? I'm generating real html now, not wiki-text (for a bunch of reasons, among them the ability to download a tree and use your browser offline, old version support, etc.), so the current system wouldn't post back to clojure.org very

Re: Transient Data Structures

2009-08-07 Thread Patrick Sullivan
Testing Transient w/Hashmaps (Thanks Cristophe!) and it seems like the object won't store more then 8 keys. At first I thought it was my frequency function that was rolling it up, but then I simply tried creating a transient object and manually assoc! ing a bunch of items into it. After the 8th

Re: a better reductions?

2009-08-07 Thread Lauri Pesonen
Hi Stuart, 2009/8/6 Stuart Halloway stuart.hallo...@gmail.com: On the plus side, it appears to be faster (as collections grow large), and it doesn't cheat by introducing an atom. On the minus side it isn't as pretty as the one in contrib. While maybe not as pretty as the one in contrib,

Re: Package manager proposal

2009-08-07 Thread Lauri Pesonen
2009/8/6 James Reeves weavejes...@googlemail.com: On Aug 6, 8:31 pm, Howard Lewis Ship hls...@gmail.com wrote: I'm cringing at the sight of XML here. XML is frequently overused, but it is a good format for representing dense, structured data. For example: repository name=third-party  

Re: a better reductions?

2009-08-07 Thread Daniel Lyons
On Aug 7, 2009, at 2:59 AM, Lauri Pesonen wrote: While maybe not as pretty as the one in contrib, it's not a monster either. Shouldn't we aim for efficiency rather than elegance in library routines (within reason)? I think the user will appreciate the speedy version more than the pretty

Re: Package manager proposal

2009-08-07 Thread Howard Lewis Ship
Ruby and Gem is such great terminology, can we come up with something half as cool? Want something short (3 - 4 letters) suitable as a file extension perhaps. Brainstorming some ideas: cap: Clojure Archive Package cpa: Clojure Package Archive ca: Clojure Archive car: Clojure Archive

Re: Package manager proposal

2009-08-07 Thread Meikel Brandmeyer
Hi, On Aug 7, 11:45 am, Howard Lewis Ship hls...@gmail.com wrote: car: Clojure Archive  (half-assed pun on Lisp's car, plus you can imagine the icon!) The other half of the pun's ass is on Java's jar. ;) .cljp: clojure package .clja: clojure archive Playing with Clojure's source extension

Re: Package manager proposal

2009-08-07 Thread Antony Blakey
On 07/08/2009, at 7:15 PM, Howard Lewis Ship wrote: Ruby and Gem is such great terminology, can we come up with something half as cool? Closure and Resolution, are a pair of parallel hononymic puns. Or Clojure/Seal - you close the package and seal it. Antony Blakey - CTO,

Re: Clojure performance tests and clojure a little slower than Java

2009-08-07 Thread John Harrop
On Thu, Aug 6, 2009 at 6:57 PM, Andy Fingerhut andy_finger...@alum.wustl.edu wrote: You are correct. I've updated that file: http://github.com/jafingerhut/clojure-benchmarks/blob/bb9755bdeeccae84a9b09fbf34e45f6d45d4b627/RESULTS Could you post the Mandelbrot code you use? Because I know

Re: Current API doc (for HEAD)

2009-08-07 Thread Daniel
On Fri, Aug 7, 2009 at 1:41 PM, Tom Faulhabertomfaulha...@gmail.com wrote: Tom, are you amenable? Yup, happy to. Where should it go? I'm generating real html now, not wiki-text (for a bunch of reasons, among them the ability to download a tree and use your browser offline, old version

Re: Package manager proposal

2009-08-07 Thread Sean Devlin
.car +1 (jar pun) On Aug 7, 5:45 am, Howard Lewis Ship hls...@gmail.com wrote: Ruby and Gem is such great terminology, can we come up with something half as cool? Want something short (3 - 4 letters) suitable as a file extension perhaps. Brainstorming some ideas: cap: Clojure Archive

Re: Package manager proposal

2009-08-07 Thread Justin Johnson
car: Clojure Archive (half-assed pun on Lisp's car, plus you can imagine the icon!) +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

Re: Transient Data Structures

2009-08-07 Thread Christophe Grand
Hi Patrick ! Can you post some code. here is what I get: user= (- {} transient (assoc! :a 1) (assoc! :b 2) (assoc! :c 3) (assoc! :d 4) (assoc! :e 5) (assoc! :f 6) (assoc! :g 7) (assoc! :h 8) (assoc! :i 9) persistent!) {:a 1, :c 3, :b 2, :f 6, :g 7, :d 4, :e 5, :i 9, :h 8} user= (persistent!

Re: a better reductions?

2009-08-07 Thread Sean Devlin
I have to revise my last recommendation. The signature of the second call should be [f val coll] in order to match reduce. Admittedly, this is a tiny detail. Sean On Aug 6, 4:28 pm, Sean Devlin francoisdev...@gmail.com wrote: One more thought.  I'd change the signature of the second call

Re: Transient Data Structures

2009-08-07 Thread tmountain
This is awesome. I'm curious if support for maps is planned in addition to vectors? A lot of my code makes heavy use of maps, and it would be great to get a performance boost. Travis On Aug 3, 5:25 pm, Rich Hickey richhic...@gmail.com wrote: I've been doing some work on Transient Data

Re: Transient Data Structures

2009-08-07 Thread tmountain
Oops, only saw the first page of this thread (still getting used to Google Groups). I apologize for missing this one. And special thanks to Christophe Grand, who (quickly!) applied the same technique to the hash maps and contributed that yesterday. So now, in the master branch, vectors and hash

Re: Transient Data Structures

2009-08-07 Thread Patrick Sullivan
Err assoc! obviously ;-) (Sorry for the double post, didn't want to confuse Cristophe). On Aug 7, 8:15 am, Patrick Sullivan wizardofwestma...@gmail.com wrote: I don't have the EXACT code handy to c/p (at work now) but I did something like the following. (apologies for doing it such an

Re: Transient Data Structures

2009-08-07 Thread John Newman
(def transhashmap (transient {}) (assoc transhashmap a 1) (assoc transhashmap b 2) etc Isn't that what Rich was talking about, about not bashing in place? On Fri, Aug 7, 2009 at 6:45 PM, Patrick Sullivan wizardofwestma...@gmail.com wrote: I don't have the EXACT code handy to c/p (at

Re: Transient Data Structures

2009-08-07 Thread AlexK
On 7 Aug., 10:07, Patrick Sullivan wizardofwestma...@gmail.com wrote: Am I doing something silly here or is this a bug? You probably are using conj! for the side-effect, but after growing the hashmap to size 8 conj! returns a different map. user (def foo (transient {1 1 2 2 3 3 4 4 5 5 6 6

Re: Transient Data Structures

2009-08-07 Thread Patrick Sullivan
Ah hah, yeah I'm dumb, thanks to you and AlexK for catching my silliness. Funny how when I'm using normal clojure persistant structs I don't think about doing it the right way twice, but when doing it as a transient I slip into old imperative habits *headslap* ~Patrick On Aug 7, 8:20 am, John

Re: Package manager proposal

2009-08-07 Thread Christopher Wilson
+1 on .car here too. Plus, I imagine the icon to be a 1950's-era muscle car; a nod to Lisp's age. On Fri, Aug 7, 2009 at 8:13 AM, Justin Johnsonjus...@honesthacker.com wrote: car: Clojure Archive  (half-assed pun on Lisp's car, plus you can imagine the icon!) +1 -- Chris Wilson

Re: Clojure as a First Language

2009-08-07 Thread John Newman
Thanks for all the responses, both on the list and off. Many good counter-arguments were given, but I think the most compelling one was the issue of Java-interop. Without a doubt, at least some knowledge of Java is necessary to really do much of anything interesting. It's unfortunate that such a

Re: a better reductions?

2009-08-07 Thread Mark Engelberg
I believe that if you're going for speed, another trick is to use if-let to bind a name to (seq coll) and reuse the new name, rather than coll, when applying first and rest later in the function. --~--~-~--~~~---~--~~ You received this message because you are

with-out-str assumes Unix line ends

2009-08-07 Thread Nathan Kitchen
Anne's recent attempt to start a new thread for this question seems not to have worked. I'd hate for her and ataggart to be frustrated by further back-and-forth over the identity of the thread he started, so I'm starting a new thread for her question. === begin content from Anne === Sorry for

Re: enhancement request: a simple way to read a file

2009-08-07 Thread Vagif Verdi
Try contrib library duck-streams. --~--~-~--~~~---~--~~ 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

Re: a better reductions?

2009-08-07 Thread Vagif Verdi
On Aug 7, 1:23 am, Daniel Lyons fus...@storytotell.org wrote: This is the difference between FreeBSD and NetBSD. I agree, but I also   find it useful to crack open core and contrib to see coding examples   and to understand algorithms. I'd suggest to include into library for teaching

combining methods

2009-08-07 Thread Andy Chambers
Hey All, Does clojure have an equivalent of either CLOS's `call-next-method' or java's super? For example, given the multi-method, and the interfaces ICDISCElement and IODMDef, where IODMDef extends ICDISCElement (defmulti validate class) (defmethod validate ICDISCElement [elem]

Re: enhancement request: a simple way to read a file

2009-08-07 Thread Albert Cardona
Vagif Verdi wrote: Try contrib library duck-streams. I know duck-streams rather well. You missed the point, Vagif. Albert -- Albert Cardona http://albert.rierol.net --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google

Re: Package manager proposal

2009-08-07 Thread meb
I like the name Clojure Archive. On another note, I always wondered why xml was such a requirement for Java dependency management. Couldn't we design some sort of url schema, that you could just pass to a package importer in the program. First time you run, it could fetch the packages or

Re: Clojure performance tests and clojure a little slower than Java

2009-08-07 Thread Andy Fingerhut
On Aug 6, 6:49 pm, John Harrop jharrop...@gmail.com wrote: On Thu, Aug 6, 2009 at 6:57 PM, Andy Fingerhut andy_finger...@alum.wustl.edu wrote: You are correct.  I've updated that file: http://github.com/jafingerhut/clojure-benchmarks/blob/bb9755bdeeccae8... Could you post the

Re: enhancement request: a simple way to read a file

2009-08-07 Thread Daniel Lyons
On Aug 7, 2009, at 12:19 PM, Albert Cardona wrote: Currently, one must resort to incantations like: (with-open [stream (java.io.BufferedReader. (java.io.FileReader. /home/albert/test.xml))] (doseq [line (line-seq stream)] (println line)))

Re: Package manager proposal

2009-08-07 Thread James Reeves
On Aug 7, 1:51 pm, Sean Devlin francoisdev...@gmail.com wrote: .car +1 (jar pun) I'll go against the crowd and say I don't like this name. It seems confusing to have a car symbol in your source code that has an entirely different purpose to its traditional binding. - James

Re: Package manager proposal

2009-08-07 Thread James Reeves
On Aug 7, 10:17 am, Lauri Pesonen lauri.peso...@iki.fi wrote: Surely we can do better with s-expressions: (:repository third-party [(:package Compojure /compojure.xml)]) Not very forward compatible, though. Perhaps we should sidestep the whole question about the format of package metadata.

zipping together two lists

2009-08-07 Thread tsuraan
Most languages I've used define a zip method, where you can take two lists and get a list of the pairs of elements in those lists. So, (zip '(1 2 3) '(4 5 6)) would give ([1 4] [2 5] [3 6]). Does clojure have a core function like that? I've been poking around, but all I'm finding is zipmap,

Re: zipping together two lists

2009-08-07 Thread Daniel Lyons
On Aug 7, 2009, at 3:04 PM, tsuraan wrote: Most languages I've used define a zip method, where you can take two lists and get a list of the pairs of elements in those lists. So, (zip '(1 2 3) '(4 5 6)) would give ([1 4] [2 5] [3 6]). Does clojure have a core function like that? I've

Re: zipping together two lists

2009-08-07 Thread tsuraan
map can do this. user (map vector '(1 2 3) '(4 5 6)) ([1 4] [2 5] [3 6]) Yeah, that works pretty well. Thanks! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to

Re: Clojure as a First Language

2009-08-07 Thread Tchalvak
As a Noob to clojure, one thing that scares me is the comment-to-code ratio. I mean, the meaning that can be packed into clojure can be immense, which is great, but it seems like that means that a lack of commenting is all the more dire of a problem. The best commented clojure code that I've

Re: zipping together two lists

2009-08-07 Thread Brian Hurt
On Fri, Aug 7, 2009 at 5:04 PM, tsuraan tsur...@gmail.com wrote: Most languages I've used define a zip method, where you can take two lists and get a list of the pairs of elements in those lists. So, (zip '(1 2 3) '(4 5 6)) would give ([1 4] [2 5] [3 6]). Does clojure have a core function

Re: Package manager proposal

2009-08-07 Thread John Newman
I like this idea too, because if you end up wanting to port this package manager to CLR, Parrot, or JS, you're less tied down to the package formats of specific platforms. Heck, even if Clojure was ported to Ruby (not that there'd be any point to do that), you could wrap the Gems framework. On

Re: Clojure performance tests and clojure a little slower than Java

2009-08-07 Thread John Harrop
Your core loop seems to be: (loop [zr (double 0.0) zi (double 0.0) zr2 (double 0.0) zi2 (double 0.0) iterations-remaining iterations-remaining] (if (and (not (neg? iterations-remaining)) ( (+ zr2 zi2) limit-square)) (let [new-zi (double (+

Re: binding and bundles of variables

2009-08-07 Thread samppi
Great, thanks. Is clojure.lang.Var/pushThreadBindings a public, supported part of the API? Can I use it without fear of suddenly dropped support? On Aug 6, 10:56 pm, Meikel Brandmeyer m...@kotka.de wrote: Hi, On Aug 7, 7:12 am, samppi rbysam...@gmail.com wrote: So is this possible without

Re: Test a random function

2009-08-07 Thread Stuart Sierra
Generally, if you're testing something that is supposed to be truly random (like shuffle and rand-elt), you do a large sample and make sure the distribution of results is truly (close to) uniform. -SS On Aug 7, 9:17 pm, Sean Devlin francoisdev...@gmail.com wrote: Ok, I need some help.  I'm

Re: combining methods

2009-08-07 Thread Stuart Sierra
There isn't an equivalent right now. The simplest workaround is to factor out the common code into an ordinary function, and call it from your multimethods. -SS On Aug 7, 2:55 pm, Andy Chambers achambers.h...@googlemail.com wrote: Hey All, Does clojure have an equivalent of either CLOS's

Re: Test a random function

2009-08-07 Thread Sean Devlin
The problem is how do you define close to uniform? All I remember my signals noise classes is that this really hard, and Zed Shaw's rant has convinced me that in order to do this right it takes time. I'm going to punt on the issue for now. Quick, is there a statistician in the house? Sean

Re: Test a random function

2009-08-07 Thread Andy Fingerhut
On Aug 7, 6:17 pm, Sean Devlin francoisdev...@gmail.com wrote: Ok, I need some help.  I'm writing some tests for c.c.seq-utils, and I ran into a problem defining a test for both shuffle and rand-elt. Does anyone here have any experience writing tests for random functions?  Am I going to need

Re: Clojure performance tests and clojure a little slower than Java

2009-08-07 Thread Andy Fingerhut
On Aug 7, 5:14 pm, John Harrop jharrop...@gmail.com wrote: Your core loop seems to be: (loop [zr (double 0.0)          zi (double 0.0)          zr2 (double 0.0)          zi2 (double 0.0)          iterations-remaining iterations-remaining]     (if (and (not (neg? iterations-remaining))    

Re: Clojure as a First Language

2009-08-07 Thread Luc Prefontaine
A bit of history (or archaeology ?) We are now back to the old times were we used to struggle about comments in the code. When I started coding, code was self-understandable according to the legend, especially assembly code. If you could not understand the code without comments, you did not even

seq-utils testing reveals potential flatten bugs

2009-08-07 Thread Sean Devlin
See Assembla ticket 13 in for clojure contrib to view the diff containing the test cases I just finished writing tests for the following functions in seq- utils: flatten separate includes? indexed group-by partition-by frequencies reductions rotations partition-all shuffle (invariants) rand-elt