Re: Trying to rewrite a loop as map/reduce

2009-12-16 Thread Laurent PETIT
Hello, 2009/12/15 DTH dth...@gmail.com On Dec 15, 9:05 pm, Laurent PETIT laurent.pe...@gmail.com wrote: The final step is to apply return-fn to the result: (return-fn (first (remove (comp not predicate-fn) (iterate recur-fn a0))) Damn,

Re: macro headaches

2009-12-16 Thread tristan
Thank you all for your replies doseq rather than my loop is the ideal situation for me, looks a lot nicer than my loop. I have to get used to avoiding loops when i can, and not calling object methods functions! thanks again everyone On 15 Dez., 22:18, Laurent PETIT laurent.pe...@gmail.com wrote:

Debugging Macros with the debug-repl

2009-12-16 Thread George Jahad
It can be tough debugging macros in Clojure. Here's a quick demo of using the debug-repl to do so: http://georgejahad.com/clojure/debug-repl-macros.html -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to

Re: Debugging Macros with the debug-repl

2009-12-16 Thread George Jahad
Forgot to mention that the debug-repl seems to work fine with slime, if you use the *inferior-lisp* buffer On Dec 16, 2:14 am, George Jahad cloj...@blackbirdsystems.net wrote: It can be tough debugging macros in Clojure.  Here's a quick demo of using the debug-repl to do

Disabling ContextClassLoader

2009-12-16 Thread Roman Roelofsen
It seems that Clojure heavily uses the ContextClassLoader to load classes and compile clj files. Is there a way to disable this behaviour and tell the Clojure runtime to always use the ClassLoader where the .clj or .class file originally came from? I found some flags in the RT class but I am not

Re: Trying to rewrite a loop as map/reduce

2009-12-16 Thread Timothy Pratley
On Dec 16, 6:00 am, samppi rbysam...@gmail.com wrote: I'm trying to rewrite a loop to use higher-level functions instead. ;; Here is my 'novelty' answer... just for fun! [not a serious answer] ;; (defn bounce [start pred iter] (trampoline (fn f [x] (if (pred x) x

How to efficiently compare related persistent collections (maps, sets)?

2009-12-16 Thread Dragan Djuric
Hi, Here's the example of what I meant in the topic title: Let's say we have a set s1 that have 3 elements: #{obj1, obj2, obj3} I add a few elements to it and get s2 #{obj1, obj2, obj3, obj4, obj5} It is important to notice that, because s2 has been created by modifying s1, it reuses its

Re: Funding Clojure 2010

2009-12-16 Thread Dave
I'm not using Clojure in any real way yet, but just funded. Why? Because I respect the effort, wish I could do the same thing, and would want people to support me if they loved what I was doing and/or found it useful or joyous. Dave -- You received this message because you are subscribed to

Pragmatic Studio course

2009-12-16 Thread Mike Hogye
I would really like to go to the Pragmatic Studio's 3-day Clojure course (https://pragmaticstudio.com/clojure). Taught by Stuart Halloway, and Rich himself, no less! ... But $1500 sounds like a lot. Can anybody help me convince myself that it's worth that much? -- You received this message

Re: How to efficiently compare related persistent collections (maps, sets)?

2009-12-16 Thread Sean Devlin
Set equality requires the complete traversal of the set, and will always be O(n). However, there are shortcuts for determining if they are not equal. You could use the following test (if (first (remove set1 set2)) :not-equal (if (first (remove set2 set1)) :not-equal :equal)) remove

Re: Funding update - the Clojure community is simply awesome!

2009-12-16 Thread ashishwave
all of us, the clojure community itself is very happy that the creator is satisfied with the response to continue the development. one request, can you just publish ROADMAP as to what new features do you plan to add in clojure in 2010. May be the clojure community can request to

Re: Trying to rewrite a loop as map/reduce

2009-12-16 Thread Meikel Brandmeyer
Hi, On Dec 15, 10:28 pm, DTH dth...@gmail.com wrote: Damn, well played sir; that's much cleaner. Someone, please enlighten me! Why is this clearer? (defn foo [a] (let [b f1 c (comp f2 b) d (comp f3 c) e (comp f4 d) g (comp f5 c) h (comp f5 f2 e)]

Re: Debugging Macros with the debug-repl

2009-12-16 Thread Meikel Brandmeyer
Hi, On Dec 16, 11:14 am, George Jahad cloj...@blackbirdsystems.net wrote: It can be tough debugging macros in Clojure.  Here's a quick demo of using the debug-repl to do so:http://georgejahad.com/clojure/debug-repl-macros.html Very cool. Sincerely Meikel -- You received this message

Re: How to efficiently compare related persistent collections (maps, sets)?

2009-12-16 Thread Meikel Brandmeyer
Hi, On Dec 16, 3:45 pm, Sean Devlin francoisdev...@gmail.com wrote: Set equality requires the complete traversal of the set, and will always be O(n). I think, what Dragan was refering to is the shared structure in a set. Let's say you have to two sets A' and A'' which evolved from set A by

Re: Trying to rewrite a loop as map/reduce

2009-12-16 Thread DTH
On Dec 16, 8:13 am, Laurent PETIT laurent.pe...@gmail.com wrote: 2009/12/15 DTH dth...@gmail.com (return-fn (some predicate-fn (iterate recur-fn a0))) would seem equivalent, though I doubt I'd have got there without your stepwise guide to change the way I was thinking about it. No,

Re: How to efficiently compare related persistent collections (maps, sets)?

2009-12-16 Thread Stuart Sierra
In general, straight equality is efficient for Clojure data structures. For example, the equals() implementation for sets checks type, size, and hash code before examining the set elements. Determining that two sets are equal is still O(n), but determining that they are NOT equal is usually O(1).

Re: How to efficiently compare related persistent collections (maps, sets)?

2009-12-16 Thread Sean Devlin
Oh, I get it. Thanks Meikel. I imagine this is possible if you drill into the guts of PersistentHaspMap, but I would strongly discourage the behavior in user code. Perhaps as an upgrade to the object itself? There is a 1% chance that this could be a language upgrade, assuming it works across

Re: Trying to rewrite a loop as map/reduce

2009-12-16 Thread Laurent PETIT
Hey, the exercise was to rewrite it with higher order functions, not to make it clearer ! 2009/12/16 Meikel Brandmeyer m...@kotka.de Hi, On Dec 15, 10:28 pm, DTH dth...@gmail.com wrote: Damn, well played sir; that's much cleaner. Someone, please enlighten me! Why is this clearer?

Re: Funding Clojure 2010

2009-12-16 Thread Bradbev
Just donated. Thank you very much for Clojure, and I hope that this funding model works out for everybody! Cheers, Brad -- 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

ClojureQL docs?

2009-12-16 Thread rb
Hi, After the recent discussion about ClojureQL, I wanted to try it, but I haven't found any documentation outside examples in blog posts. Did I miss something or is the code the current documentation? Raphaël -- You received this message because you are subscribed to the Google Groups Clojure

Re: ClojureQL docs?

2009-12-16 Thread Wilson MacGyver
there are samples in http://www.gitorious.org/clojureql/ and also http://wiki.github.com/Lau-of-DK/clojureql you can also look at /src/dk/bestinclass/clojureql/demo.clj On Wed, Dec 16, 2009 at 11:40 AM, rb raphi...@gmail.com wrote: Hi, After the recent discussion about ClojureQL, I wanted

Re: Roadmap for 2010

2009-12-16 Thread David Nolen
Well 1.1 is just around the corner. And 1.2 will probably bring all the deftype/defprotocol goodness. I imagine that Clojure-in-Clojure will be one of the big projects for 2010. You should check out http://www.assembla.com/spaces/clojure/ for more info. David On Tue, Dec 15, 2009 at 11:32 PM,

QCon video download

2009-12-16 Thread tsuraan
Does anybody have a download link for the QCon talk that is linked from the clojure front page? I tend to use platforms where Flash support is even worse than normal, whereas mplayer tends to be very good at playing videos on every machine I use. -- You received this message because you are

Re: QCon video download

2009-12-16 Thread Krukow
On Dec 16, 6:33 pm, tsuraan tsur...@gmail.com wrote: Does anybody have a download link for the QCon talk that is linked from the clojure front page?  I tend to use platforms where Flash support is even worse than normal, whereas mplayer tends to be very good at playing videos on every machine

Any interest in a Nova Clug?

2009-12-16 Thread Matt
I'm looking into setting up a Northern Virginia Clojure User Group and would like to know who is interested. I know there is a DC clojure study group, but it seems to not be as active recently. DC is also hard for me to get to during the week. We have a couple of other user groups which meet once

How to modify the last few elements of a vector

2009-12-16 Thread samppi
I'm using a vector as a stack. I want to apply a function–let's call it modify-element, one argument—to the elements from k to (- (count a- vector) k). Right now, I have something like (not tested yet): (reduce #(update-in %1 [%2] modify-element) a-vector (range k (- (count a-vector) k))) Is

Re: QCon video download

2009-12-16 Thread tsuraan
If you watch the http traffic, e.g. in firebug, you'll see it makes a request to: http://flv.thruhere.net/presentations/09-mar-persistentdatastructures.flv You'll have to find the slides on the qcon homepage if you want to follow. Thanks! -- You received this message because you are

Re: How to modify the last few elements of a vector

2009-12-16 Thread CuppoJava
The basic abstraction that I see, is that you need a function that will replace a range within a collection with another collection. Here's a quick and dirty way of doing that: (defn assoc-range [v min max v2] (vec (concat (take min v) v2 (nthnext v (dec max) So

Re: How to modify the last few elements of a vector

2009-12-16 Thread CuppoJava
Never mind, I realized that my solution doesn't quite answer your question. Here's another attempt. --Convenience Functions-- (defn indexed [coll] (map vector coll (iterate inc 0))) (defn between [n min max] (and ( n max) (= n min))) --Your Specific Case-- (for [[e i] (indexed v)] (if

Re: How to efficiently compare related persistent collections (maps, sets)?

2009-12-16 Thread Richard Newman
I imagine this is possible if you drill into the guts of PersistentHaspMap, but I would strongly discourage the behavior in user code. Perhaps as an upgrade to the object itself? There is a 1% chance that this could be a language upgrade, assuming it works across the board. I would tread

Semantic Versioning

2009-12-16 Thread Nicolas Buduroi
Hi, on the CommonJS Google Group there was a discussion on semantic versioning, a formalization of the concept of properly using a common version number scheme (Major.Minor.Patch) for libraries. http://semver.org/ I think it would be especially easy to enforce a simple version of this system in

Re: How to efficiently compare related persistent collections (maps, sets)?

2009-12-16 Thread Dragan Djuric
Yes, the true/false for equality is not a problem. I am looking for a shortcut that finds different elements more efficiently. So, the sets are different, but I want to get hold of elements that are in s2 but not in s1. On Dec 16, 8:38 pm, Richard Newman holyg...@gmail.com wrote: I imagine

Re: Semantic Versioning

2009-12-16 Thread Nicolas Buduroi
s/thinking/think/ On Dec 16, 2:56 pm, Nicolas Buduroi nbudu...@gmail.com wrote: Hi, on the CommonJS Google Group there was a discussion on semantic versioning, a formalization of the concept of properly using a common version number scheme (Major.Minor.Patch) for libraries.

Re: How to modify the last few elements of a vector

2009-12-16 Thread ataggart
On Dec 16, 10:33 am, samppi rbysam...@gmail.com wrote: I'm using a vector as a stack. I want to apply a function–let's call it modify-element, one argument—to the elements from k to (- (count a- vector) k). Right now, I have something like (not tested yet):   (reduce #(update-in %1 [%2]

Re: How to modify the last few elements of a vector

2009-12-16 Thread Graham Fawcett
On Wed, Dec 16, 2009 at 1:33 PM, samppi rbysam...@gmail.com wrote: I'm using a vector as a stack. I want to apply a function–let's call it modify-element, one argument—to the elements from k to (- (count a- vector) k). Right now, I have something like (not tested yet):  (reduce #(update-in

Re: Trying to rewrite a loop as map/reduce

2009-12-16 Thread Meikel Brandmeyer
Hi, On Dec 16, 4:30 pm, Laurent PETIT laurent.pe...@gmail.com wrote: Hey, the exercise was to rewrite it with higher order functions, not to make it clearer ! Well. It was claimed it is cleaner... Just asking... Sincerely Meikel -- You received this message because you are subscribed to

Re: Clojure Console Progress Bar

2009-12-16 Thread Kasim
Thank you. Here is my final progress bar code for anyone interested: (defn progress-string [i] (str-join (seq (for [x (range 50)] (if (= (/ i 2) x) =) (defn show-progress-string [t] (dotimes [percent 100 ] (do (Thread/sleep t) (print \r| (progress-string (inc

Re: How to efficiently compare related persistent collections (maps, sets)?

2009-12-16 Thread ajay gopalakrishnan
Your argument is right and it is a good idea to take advantage of the shared structure to calculate differences. However, it is important to remember that is is just a special case and I don't expect that whenever you want to calculate a difference between two sets, you always compare between the

Re: How to efficiently compare related persistent collections (maps, sets)?

2009-12-16 Thread ajay gopalakrishnan
If the sets data structure is also not shared, then the paper I mentioned (link provided earlier) is one of the fastest to date. And it is very small easy to implement. On Wed, Dec 16, 2009 at 2:59 PM, Dragan Djuric draga...@gmail.com wrote: Yes, the true/false for equality is not a problem.

How to fund open source Clojure development

2009-12-16 Thread Joe
a. Offer new clojure features in binary form to developers who pay $100 a year 3 months before everyone else. b. Run a clojure programmer temp and/or high level consulting agency. c. Charge for cert testing and training. d. Sell for access to online library api calls. e. Find a business for whom

Re: How to fund open source Clojure development

2009-12-16 Thread Zach Tellman
All of these seem to distract from the activity we're trying to fund: the development of Clojure. If the current approach can bring in enough money, it strikes me as fairly ideal. We'll just have to wait and see if it does. -- You received this message because you are subscribed to the Google

Re: Funding Clojure 2010

2009-12-16 Thread Alan Busby
I'd just like to second the request for selling a CD with Clojure 1.0 on it. No support, no additional features; just a CD with the Clojure jar file or something. I'd even go a step further and have multiple versions that would be identical except for the disc label, Gold, $1000 Silver, $500

Re: Any interest in a Nova Clug?

2009-12-16 Thread Seth
Matt, (conj nova-clug :me) Seth On Dec 16, 1:14 pm, Matt macourt...@gmail.com wrote: I'm looking into setting up a Northern Virginia Clojure User Group and would like to know who is interested. I know there is a DC clojure study group, but it seems to not be as active recently. DC is also

Re: Any interest in a Nova Clug?

2009-12-16 Thread Andrew Wagner
There's a possibility I might be interested in joining such a group. It would mostly depend on scheduling. On Wed, Dec 16, 2009 at 8:35 PM, Seth seth.schroe...@gmail.com wrote: Matt, (conj nova-clug :me) Seth On Dec 16, 1:14 pm, Matt macourt...@gmail.com wrote: I'm looking into setting

Re: Clojure analysis

2009-12-16 Thread Luc Préfontaine
I agree with Sean, the STM is a big feature also are parallelism and data immutability. These features are working now and they make things a lot simpler. I agree also that the lack of documentation is a barrier but even with documentation the learning curve would not be much shorter again

Re: Any interest in a Nova Clug?

2009-12-16 Thread Fogus
I'm looking into setting up a Northern Virginia Clojure User Group and would like to know who is interested. Sounds like fun. Count me in. -m -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to

Re: Any interest in a Nova Clug?

2009-12-16 Thread liebke
I'd try to make it, even though Reston is on the wrong side of the river :-) It would be cool to try to also schedule something in March when Rich and Stu will be in Reston for the Prag Studio training. David On Dec 16, 1:14 pm, Matt macourt...@gmail.com wrote: I'm looking into setting up a

Re: Clojure analysis

2009-12-16 Thread Dmitry Kakurin
Judging by the article you've spent very little time learning Clojure and have managed to get every key point wrong: Clojure is a multi-paradigm language no it's not, and it's most certainty not an OOP language: http://clojure.org/rationale Functional programming finds its best implementation