Re: Clojure Conj Questions
Hi, On 19 Aug., 17:19, Sean Devlin francoisdev...@gmail.com wrote: http://first.clojure-conj.org/ Will the talks be recorded? Put on blip.tv? For those on the other side of the Big Pond? Sincerely 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Clojure 1.3: Integrating clj-stacktrace?
Yes, this is very important problem with current implementation of Clojure. Many of beginners complain, that they couldn't understand where error happened, especially during compilation of code. Phil Hagelberg at Tue, 24 Aug 2010 21:55:52 -0700 wrote: PH One of the most common complaints about the current implementation of PH Clojure is that the stack traces are often unreadable. At work we have PH been using Mark McGranaghan's clj-stacktrace library[1] to print stack PH traces, and it does a great job of cleaning them up and making it much PH clearer as to what the actual cause of the problem is. I've found it PH invaluable for this--it provides indentation, better details, and even PH coloring to help make the relevant frames stand out in the noise. PH I've spoken to him about it, and he is agreeable to the idea of PH merging it into Clojure. He is the sole author of it, and it sounds PH like he'd be fine with relicensing and copyright assignment. PH It appears at first glance to be compatible with the existing PH clojure.stacktrace library. Obviously before it could be merged we PH would need to investigate this more thoroughly, but I think it could PH be a valuable improvement to Clojure 1.3. PH Thoughts? PH -Phil PH [1] - http://github.com/mmcgrana/clj-stacktrace -- With best wishes, Alex Ott, MBA http://alexott.blogspot.com/ http://alexott.net http://alexott-ru.blogspot.com/ -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Clojure Conj Questions
It would be fantastic if the talkes would be record. We have seen the effects a couple of videos of rich had on the world and how many people it led to clojure (including me). On Aug 25, 9:36 am, Meikel Brandmeyer m...@kotka.de wrote: Hi, On 19 Aug., 17:19, Sean Devlin francoisdev...@gmail.com wrote: http://first.clojure-conj.org/ Will the talks be recorded? Put on blip.tv? For those on the other side of the Big Pond? Sincerely 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Clojure 1.3: Integrating clj-stacktrace?
+1 Good idea. On Aug 25, 12:45 pm, Alex Ott alex...@gmail.com wrote: Yes, this is very important problem with current implementation of Clojure. Many of beginners complain, that they couldn't understand where error happened, especially during compilation of code. Phil Hagelberg at Tue, 24 Aug 2010 21:55:52 -0700 wrote: PH One of the most common complaints about the current implementation of PH Clojure is that the stack traces are often unreadable. At work we have PH been using Mark McGranaghan's clj-stacktrace library[1] to print stack PH traces, and it does a great job of cleaning them up and making it much PH clearer as to what the actual cause of the problem is. I've found it PH invaluable for this--it provides indentation, better details, and even PH coloring to help make the relevant frames stand out in the noise. PH I've spoken to him about it, and he is agreeable to the idea of PH merging it into Clojure. He is the sole author of it, and it sounds PH like he'd be fine with relicensing and copyright assignment. PH It appears at first glance to be compatible with the existing PH clojure.stacktrace library. Obviously before it could be merged we PH would need to investigate this more thoroughly, but I think it could PH be a valuable improvement to Clojure 1.3. PH Thoughts? PH -Phil PH [1] -http://github.com/mmcgrana/clj-stacktrace -- With best wishes, Alex Ott, MBAhttp://alexott.blogspot.com/ http://alexott.nethttp://alexott-ru.blogspot.com/ -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
help with native-jar files..
Hello everybody, I wanted to package jreality along with its native dependencies and upload it to my clojars since there were none already there.. I followed the procedure on http://nakkaya.com/2010/04/05/managing-native-dependencies-with-leiningen/ the resultant was the following ... http://clojars.org/org.clojars.sunilnandihalli/jreality-native-deps I however tried to use it and had trouble doing so.. I was hoping to get some help from the community .. I might have something really stupid here since I am new to the jar and java stuff.. The project file I am using is @project file @ (defproject helloworld 1.0.0-SNAPSHOT :description FIXME: write :dependencies [[org.clojure/clojure 1.2.0-beta1] [org.clojure/clojure-contrib 1.2.0-beta1] [java3d/j3d-core 1.3.1] [java3d/j3d-core-utils 1.3.1] [java3d/vecmath 1.3.1] [org.clojars.sunilnandihalli/jreality-native-deps current]] :dev-dependencies [[swank-clojure 1.2.1]]) The simple code I tried to execute @code@ (ns helloworld.core (:require (de.jreality.plugin JRViewer))) and the error I recieved is @errors @ Could not locate de/jreality/plugin/JRViewer__init.class or de/jreality/plugin/JRViewer.clj on classpath: [Thrown class java.io.FileNotFoundException] I verified that the final jar that I created had JRViewer file it is complaining about using jarexplorer.. can anybody help me with a suggestion? Sunil. -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Removed Clojure binaries from contrib 'complete' jar
I think what Stuart meant is that the class files compiled from the core clojure library will not be incide the clojure contrib uberjar. Only the class files compiled from the clojure contrib libs will be in there. On Wed, Aug 25, 2010 at 8:20 AM, ataggart alex.tagg...@gmail.com wrote: Pardon the silly question, but if it doesn't contain any AOT compiled .class files, then is it a de facto source jar? On Aug 24, 2:56 pm, Stuart Sierra the.stuart.sie...@gmail.com wrote: I've updated the clojure-contrib build to create the uberjar at modules/complete/target/complete-1.3.0-SNAPSHOT-bin.jar WITHOUT the Clojure .class build files included. This is a binary-only JAR right now. I will look into building a JAR that includes the clojure-contrib source files. -S -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.comclojure%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Clojure 1.3: Integrating clj-stacktrace?
On Aug 24, 2010, at 9:55 PM, Phil Hagelberg wrote: Thoughts? +1. The existing stack traces are pretty horrible. Phil's proposal, or something similar, would be a huge improvement. -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Clojure 1.3: Integrating clj-stacktrace?
I am a newcomer to the language, and to lisps in general, and having to interpret Clojure's stacktraces is really hard. It is one of those things that made me not want to use the language at all. It also makes it hard for me to recommend the language to others. It is not just the stacktraces, but also the error messages. For beginners they really are a kick in the face: you have absolutely no idea of what you are doing, do you??. This extremely simple (and easy to debug :) ) example, shows my point I think: user= (1) java.lang.ClassCastException: java.lang.Integer cannot be cast to clojure.lang.IFn (NO_SOURCE_FILE:0) How about at least hinting a little bit about what is wrong here? Trivial example yes, but when you get this, or something similar, inside a 50 line Clojure script, and it does not tell you where or why, it can be a bit frustrating. Clojure has steep learning curve, at least for a Java developer, and these problems make it difficult to do the effort of really getting to know the language. This is actually my main complaint about Clojure. I have no knowledge about clj-stacktrace, but I would welcome anything that makes it easier for beginners to get started. Anyhow, thanks for a great language and a great community. Having gotten through the initial shock, I am really starting to enjoy programming in Clojure. Cheers, - Alf On Wed, Aug 25, 2010 at 06:55, Phil Hagelberg p...@hagelb.org wrote: One of the most common complaints about the current implementation of Clojure is that the stack traces are often unreadable. At work we have been using Mark McGranaghan's clj-stacktrace library[1] to print stack traces, and it does a great job of cleaning them up and making it much clearer as to what the actual cause of the problem is. I've found it invaluable for this--it provides indentation, better details, and even coloring to help make the relevant frames stand out in the noise. I've spoken to him about it, and he is agreeable to the idea of merging it into Clojure. He is the sole author of it, and it sounds like he'd be fine with relicensing and copyright assignment. It appears at first glance to be compatible with the existing clojure.stacktrace library. Obviously before it could be merged we would need to investigate this more thoroughly, but I think it could be a valuable improvement to Clojure 1.3. Thoughts? -Phil [1] - http://github.com/mmcgrana/clj-stacktrace -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Bug report: function metadata is broken
On 13 Jul., 12:03, Meikel Brandmeyer m...@kotka.de wrote: I'm not sure, though, why the metadata gets moved to the function on redefinition. Does anyone know why this is so? (defn foo [x] x) (defn foo [x y] (+ x y)) (:arglists (meta (var foo))) == ([x y]) (:arglists (meta foo)) == ([x]) Thanks, Andreas -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Clojure 1.3: Integrating clj-stacktrace?
+1 on improving stack traces (though I haven't had experience with clj-stacktrace, other than what I have read on this list). -- / Peter Schuller -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Clojure 1.3: Integrating clj-stacktrace?
I haven't had a lot of problems with stack-traces. I would be happy to have more information on the context, though. And maybe better reporting of exception occuring in a delayed context. (when forcing a seq and the excpetion occurs under a lazy.) In this situation I have sometimes fonud that the stacks where a bit srange, but I understand it is a well known problem with lazyness and difficult to solve. On Wed, Aug 25, 2010 at 12:54 PM, Peter Schuller peter.schul...@infidyne.com wrote: +1 on improving stack traces (though I haven't had experience with clj-stacktrace, other than what I have read on this list). -- / Peter Schuller -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Clojure 1.3: Integrating clj-stacktrace?
I agree with the point in discussion that the error messages in Clojure are more of a problem than stack traces per se. Regards, Shantanu On Aug 25, 5:02 pm, Nicolas Oury nicolas.o...@gmail.com wrote: I haven't had a lot of problems with stack-traces. I would be happy to have more information on the context, though. And maybe better reporting of exception occuring in a delayed context. (when forcing a seq and the excpetion occurs under a lazy.) In this situation I have sometimes fonud that the stacks where a bit srange, but I understand it is a well known problem with lazyness and difficult to solve. On Wed, Aug 25, 2010 at 12:54 PM, Peter Schuller peter.schul...@infidyne.com wrote: +1 on improving stack traces (though I haven't had experience with clj-stacktrace, other than what I have read on this list). -- / Peter Schuller -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: trouble using nested map fn
I'm glad my question generated so much discussion! Thank you all for the suggestions...it's all good stuff trying to wrap my head around and improve my facility with clojure. On Aug 24, 1:27 am, Meikel Brandmeyer m...@kotka.de wrote: Hi, On 24 Aug., 03:08, gary ng garyng2...@gmail.com wrote: (map #(for [s %2] (map * %1 s)) target signal) Though personally I still think the %2 %1 is a bit confusing.- Zitierten Text ausblenden - If you don't like it, don't use it.You can always give things meaningful names. (for [[signals target] (map vector signals-list target-list) signal signals] (map * signal target)) Sincerely 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Clojure 1.2 and the Computer Language Benchmarks Game
I will try submitting one or a few of my benchmark programs created 1 year ago. For anyone that wants to look at some timing results and/or my source code used to achieve them before then, they are available on github here: http://github.com/jafingerhut/clojure-benchmarks I just pushed a few changes required for Clojure 1.2 about 10 minutes ago. There aren't many changes to the results from Clojure 1.1 alpha I tested against a year ago, except for the following -- note that besides updating my Clojure version since last time, I have also upgraded the version of OS X on my Mac, and the version of Java from Apple. I have not attempted to test these changes independently to see which one or ones caused the change in run time: k-nucleotide benchmark completed in about 2/3 the time of earlier runs (good) mandelbrot also runs in about 2/3 the time of before n-body takes about 5x longer than before. I do not know why. As always, improvements to my versions are welcome. I am pretty sure some people have posted programs they have worked on for these problems during the most recent 1 year to the group, but I'm sorry to say I haven't kept up with all of them to see if they are faster than my fastest versions. Andy On Mon, Aug 23, 2010 at 10:29 AM, Isaac Gouy igo...@yahoo.com wrote: Now Clojure 1.2 has been released, Clojure programs will be included in the Computer Language Benchmarks Game. If you'd like to contribute Clojure programs, please follow the step- by-step http://shootout.alioth.debian.org/help.php#contribute -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.comclojure%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Clojure 1.3: Integrating clj-stacktrace?
The error messages are often the easiest the thing in the world to improve, even if you are new to contributing to Clojure. Most of the bad error messages are in the context of macroexpansion, so it is almost free (in performance terms) to add rigorous checks and error messages. Take a look at assert-valid-fdecl at the bottom of core.clj, for example. To get better error reports for bad function declarations, just add more conditionals to this function. Patches welcome. *Specific* documentation of pain points also welcome. Stu I agree with the point in discussion that the error messages in Clojure are more of a problem than stack traces per se. Regards, Shantanu On Aug 25, 5:02 pm, Nicolas Oury nicolas.o...@gmail.com wrote: I haven't had a lot of problems with stack-traces. I would be happy to have more information on the context, though. And maybe better reporting of exception occuring in a delayed context. (when forcing a seq and the excpetion occurs under a lazy.) In this situation I have sometimes fonud that the stacks where a bit srange, but I understand it is a well known problem with lazyness and difficult to solve. On Wed, Aug 25, 2010 at 12:54 PM, Peter Schuller peter.schul...@infidyne.com wrote: +1 on improving stack traces (though I haven't had experience with clj-stacktrace, other than what I have read on this list). -- / Peter Schuller -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
misunderstanding collection
After toying around at the REPL I realize that I have been working with a heretofore invalid understanding of collections. For example, working with the following collection(s): signal: (((1 2 3 4) (2 3 4 5) (3 4 5 6)) ((3 4 5 6) (4 5 6 7) (5 6 7 8))) I wanted to sum each individual list: e.g. (1 2 3 4) = (10) I thought I could do this as follows: (map #(map reduce + %) signal) This resulted in an error, so trying to comprehend why I ran the following: (map #(map identity (take 1 %)) signal) which results in, (((1 2 3 4)) ((3 4 5 6))) So, clojure sees 'signal' as 2 collections, whereas I thought it was a single collection. This makes me concerned that I have been doing everything wrong thus far and getting computational errors. :( So, how should I sum each individual list in the above collections? -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Clojure 1.2 and the Computer Language Benchmarks Game
You can probably boost n-body on 1.2 by replacing arrays with deftypes. (definterface BodyIsh (^double getMass []) (setMass [^double x]) (^double getPosX []) .) (deftype Body [^double ^{:unsynchronized-mutable true} mass ^double ^{:unsynchronized-mutable true} posX .] BodyIsh (getMass [x] mass) (setMass [x m] (set! mass m) .) And then rewriting the program using Body (and a type annotation on bodies, of course) I used interfaces and not protocols here because I am not sure 1.2 supports protocols with primitives. Best, Nicolas. -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: misunderstanding collection
clojure sees 'signal' as 2 collections thats wrong signals is one collection with two items. These happen to be collection but only the function that gets called by map carres what it gets. How can this (map #(map reduce + %) signal) work? (map ) does take 1 function and some collections you pass in to functions and one collection. In you problem you have 3 levels so you need more 2 anonym functions. Like this (map (fn [lst] (map #(reduce + %) lst)) signals) or something like this is maybe cleaner. (map #(map (partial reduce +) %) signals) On Aug 25, 4:06 pm, Glen Rubin rubing...@gmail.com wrote: After toying around at the REPL I realize that I have been working with a heretofore invalid understanding of collections. For example, working with the following collection(s): signal: (((1 2 3 4) (2 3 4 5) (3 4 5 6)) ((3 4 5 6) (4 5 6 7) (5 6 7 8))) I wanted to sum each individual list: e.g. (1 2 3 4) = (10) I thought I could do this as follows: (map #(map reduce + %) signal) This resulted in an error, so trying to comprehend why I ran the following: (map #(map identity (take 1 %)) signal) which results in, (((1 2 3 4)) ((3 4 5 6))) So, clojure sees 'signal' as 2 collections, whereas I thought it was a single collection. This makes me concerned that I have been doing everything wrong thus far and getting computational errors. :( So, how should I sum each individual list in the above collections? -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: misunderstanding collection
Hi, On 25 Aug., 16:06, Glen Rubin rubing...@gmail.com wrote: (map #(map reduce + %) signal) The error you got here is probably related to the inner map. It should probably read (map #(map (partial reduce +) %) signal) or (map (partial map #(reduce + %)) signal) Sincerely 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: misunderstanding collection
On Aug 25, 4:06 pm, Glen Rubin rubing...@gmail.com wrote: After toying around at the REPL I realize that I have been working with a heretofore invalid understanding of collections. For example, working with the following collection(s): signal: (((1 2 3 4) (2 3 4 5) (3 4 5 6)) ((3 4 5 6) (4 5 6 7) (5 6 7 8))) I wanted to sum each individual list: e.g. (1 2 3 4) = (10) (map #(map reduce + %) signal) + is not a collection, it's a function. You need nested currying in some way. ... So, clojure sees 'signal' as 2 collections, whereas I thought it was a single collection. This makes me concerned that I have been doing everything wrong thus far and getting computational errors. :( So, how should I sum each individual list in the above collections? signal is not 2 collections. It's a list containing two lists each of which contains 3 lists. As far as I can see, you're either expecting ((1 2 3 4) (2 3 4 5) (3 4 5 6) (3 4 5 6) (4 5 6 7) (5 6 7 8)) In which case user (map #(reduce + %) signal) (10 14 18 18 22 26) works, or you want to really use (def signal '(((1 2 3 4) (2 3 4 5) (3 4 5 6)) ((3 4 5 6) (4 5 6 7) (5 6 7 8 In which case (since you can't use nested #( .. ) forms, something like this will work: user (map #(map (fn [c] (reduce + c)) %) signal) ((10 14 18) (18 22 26)) Which is probably clearer like this: (defn sum [c] (map #(reduce + %) c)) (map sum signal) = ((10 14 18) (18 22 26)) Hope this helps, Joost. -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Clojure 1.3: Integrating clj-stacktrace?
Ahoy, On 25 August 2010 15:46, Stuart Halloway stuart.hallo...@gmail.com wrote: *Specific* documentation of pain points also welcome. In general I haven't found the stack traces to be too much of a problem, but the lack of full paths in the trace has bitten me. Since all of my namespaces have a core.clj this can mean a bit of detective work to find which core.clj is being reported. Cheers, David -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: misunderstanding collection
On Wed, 25 Aug 2010 16:06:15 +0200, Glen Rubin rubing...@gmail.com wrote: After toying around at the REPL I realize that I have been working with a heretofore invalid understanding of collections. For example, working with the following collection(s): signal: (((1 2 3 4) (2 3 4 5) (3 4 5 6)) ((3 4 5 6) (4 5 6 7) (5 6 7 8))) I wanted to sum each individual list: e.g. (1 2 3 4) = (10) I thought I could do this as follows: (map #(map reduce + %) signal) You have collection of two elements, each being collection of three elements, each being collection of four... So in short everything is OK with collections, problem is with reduce invocation this should work better: (map #(map (fn [e] (reduce + e)) %) signal) It returns: ((10 14 18) (18 22 26)) -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: misunderstanding collection
Ahoy, On 25 August 2010 16:06, Glen Rubin rubing...@gmail.com wrote: After toying around at the REPL I realize that I have been working with a heretofore invalid understanding of collections. For example, working with the following collection(s): signal: (((1 2 3 4) (2 3 4 5) (3 4 5 6)) ((3 4 5 6) (4 5 6 7) (5 6 7 8))) I wanted to sum each individual list: e.g. (1 2 3 4) = (10) I thought I could do this as follows: (map #(map reduce + %) signal) This resulted in an error, so trying to comprehend why I ran the following: (map #(map identity (take 1 %)) signal) which results in, (((1 2 3 4)) ((3 4 5 6))) So, clojure sees 'signal' as 2 collections, whereas I thought it was a single collection. This makes me concerned that I have been doing everything wrong thus far and getting computational errors. :( So, how should I sum each individual list in the above collections? It is a single collection, with two collections inside it: user (let [signal '(((1 2 3 4) (2 3 4 5) (3 4 5 6)) ((3 4 5 6) (4 5 6 7) (5 6 7 8)))] (do (println (nth signal 0)) (println (nth signal 1 ((1 2 3 4) (2 3 4 5) (3 4 5 6)) ((3 4 5 6) (4 5 6 7) (5 6 7 8)) So don't you want to do this? user (map (fn [s] (map (fn [lst] (list (reduce + lst))) s)) signal) (((10) (14) (18)) ((18) (22) (26))) I'm not sure if that's the final data structure you're after - just assuming from your e.g. (1 2 3 4) = (10) above. Cheers, David -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: misunderstanding collection
Hi, and again the for solution if nested anonymous functions are too hard to read. (for [signals signals-list] (map #(reduce + %) signals)) Sincerely 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: misunderstanding collection
I think you're getting confused. (map reduce + %) won't work, because the signature of the map function is (map func colls). In other words, the second argument is expected to be a collection, but you've put in +, which is a function. When dealing with nested collections, you may want to work from the inside out. So take one of your inner lists: s1: (1 2 3 4) (reduce + s1) = 10 (apply + s1) = 10 You can use reduce or apply to sum the lists. On the next level, we have: s2: ((1 2 3 4) (2 3 4 5) (3 4 5 6)) (map (partial reduce +) s2) = (10 14 18) So we're using map to sum each list. (partial reduce +) is just another way of writing #(reduce + %). Next is the final layer: signal: (((1 2 3 4) (2 3 4 5) (3 4 5 6)) ((3 4 5 6) (4 5 6 7) (5 6 7 8))) (map (partial map (partial reduce +)) signal) = ((10 14 18) (18 22 26)) Again, we add a map, and use partial. We could perhaps make this a little clearer by using for: (for [s signal] (for [c s] (reduce + c))) - James On 25 August 2010 15:06, Glen Rubin rubing...@gmail.com wrote: After toying around at the REPL I realize that I have been working with a heretofore invalid understanding of collections. For example, working with the following collection(s): signal: (((1 2 3 4) (2 3 4 5) (3 4 5 6)) ((3 4 5 6) (4 5 6 7) (5 6 7 8))) I wanted to sum each individual list: e.g. (1 2 3 4) = (10) I thought I could do this as follows: (map #(map reduce + %) signal) This resulted in an error, so trying to comprehend why I ran the following: (map #(map identity (take 1 %)) signal) which results in, (((1 2 3 4)) ((3 4 5 6))) So, clojure sees 'signal' as 2 collections, whereas I thought it was a single collection. This makes me concerned that I have been doing everything wrong thus far and getting computational errors. :( So, how should I sum each individual list in the above collections? -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: misunderstanding collection
Hi Glen, You have two separate problems here. The question of understanding collections isn't really that tricky. Your variable 'signals' is simply a 2-element list. Conceptually it's no different than: (a b). But in your case each element is itself a 3-element list. An equivalent would be: ((a b c) (d e f)). But again, in your case, each of those 2nd-level elements is itself a 4-element list. So your list has 3 levels with numbers at the bottom. If you map across signal, you will handle the two 3-element lists: (map count signal) = (3 3) To get to the next level, we need another map: (map (fn [level-1] (map count level-1)) signal) = ((4 4 4) (4 4 4)) Finally, we can get to the numbers themselves: (map (fn [level-1] (map (fn [level-2] (map class level-2)) level-1)) signal) = (((java.lang.Integer java.lang.Integer java.lang.Integer java.lang.Integer) ... Let's take a look at the second problem before we finish above. Your example with 'reduce' is: (map #(map reduce + %) signal) But we can't bundle it that way. 'reduce' is a 2-arg (optionally 3-arg) function, however, you are asking 'map' to apply 'reduce' to the 2 sequences '+' and the value of '%'. Of course, '+' is not a sequence. What you need instead is this: (map #(map (fn [coll] (reduce + coll)) %) signal) = ((10 14 18) (18 22 26)) Now 'reduce' takes each of the sublists in '%' as an arg and does its work. You might find it easier to work with such nested structures by using named functions to process each level. Or at the very least be careful about choosing names and layout: (map (fn [level-1] (map (fn [level-2] (reduce + level-2)) level-1)) signal) That's a lot easier for me to understand. Have all good days, David Sletten On Aug 25, 2010, at 10:06 AM, Glen Rubin wrote: After toying around at the REPL I realize that I have been working with a heretofore invalid understanding of collections. For example, working with the following collection(s): signal: (((1 2 3 4) (2 3 4 5) (3 4 5 6)) ((3 4 5 6) (4 5 6 7) (5 6 7 8))) I wanted to sum each individual list: e.g. (1 2 3 4) = (10) I thought I could do this as follows: (map #(map reduce + %) signal) This resulted in an error, so trying to comprehend why I ran the following: (map #(map identity (take 1 %)) signal) which results in, (((1 2 3 4)) ((3 4 5 6))) So, clojure sees 'signal' as 2 collections, whereas I thought it was a single collection. This makes me concerned that I have been doing everything wrong thus far and getting computational errors. :( So, how should I sum each individual list in the above collections? -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: misunderstanding collection
To bad we don't have a voting system like on stackoverflow would be nice to see witch answer got the most points. -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: misunderstanding collection
I vote for James'. On 25 Aug., 16:42, nickikt nick...@gmail.com wrote: To bad we don't have a voting system like on stackoverflow would be nice to see witch answer got the most points. -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: misunderstanding collection
On Wed, Aug 25, 2010 at 7:06 AM, Glen Rubin rubing...@gmail.com wrote: After toying around at the REPL I realize that I have been working with a heretofore invalid understanding of collections. For example, working with the following collection(s): signal: (((1 2 3 4) (2 3 4 5) (3 4 5 6)) ((3 4 5 6) (4 5 6 7) (5 6 7 8))) I wanted to sum each individual list: e.g. (1 2 3 4) = (10) I thought I could do this as follows: (map #(map reduce + %) signal) This resulted in an error, so trying to comprehend why I ran the following: (map #(map identity (take 1 %)) signal) which results in, (((1 2 3 4)) ((3 4 5 6))) So, clojure sees 'signal' as 2 collections, whereas I thought it was a single collection. This makes me concerned that I have been doing everything wrong thus far and getting computational errors. :( So, how should I sum each individual list in the above collections? I would suggest you to learn either F#(the IDE is the best) or Haskell in parallel. Both of them are typed language which would give you a better clue of what is going on here and the map/reduce thing is basically the same. -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: date serialization in clojure-contrib json
I added the *deserializers* atom, converted read-json-object to a macro (def *deserializers* (atom {})) (defn add-deserializer [k deserializer] (swap! *deserializers* #(assoc % k deserializer))) (defn remove-deserializer [k] (swap! *deserializers* #(dissoc % k))) (defmacro get-object-reader [] (let [store '(recur (.read stream) nil (assoc! result (if keywordize? (keyword key) key) element)) deserialize-store '(let [elm-key (if keywordize? (keyword key) key) deserializer (get @*deserializers* elm-key)] (recur (.read stream) nil (assoc! result elm-key (if deserializer (deserializer element) element store-and-recur (if (empty? @*deserializers*) deserialize- store store)] `(fn [#^PushbackReader ~'stream ~'keywordize?] ;; Expects to be called with the head of the stream AFTER the ;; opening bracket. (loop [~'i (.read ~'stream), ~'key nil, ~'result (transient {})] (let [~'c (char ~'i)] (cond (= ~'i -1) (throw (EOFException. JSON error (end-of- file inside object))) (Character/isWhitespace ~'c) (recur (.read ~'stream) ~'key ~'result) (= ~'c \,) (recur (.read ~'stream) nil ~'result) (= ~'c \:) (recur (.read ~'stream) ~'key ~'result) (= ~'c \}) (if (nil? ~'key) (persistent! ~'result) (throw (Exception. JSON error (key missing value in object :else (do (.unread ~'stream ~'i) (let [~'element (read-json-reader ~'stream ~'keywordize? true nil)] (if (nil? ~'key) (if (string? ~'element) (recur (.read ~'stream) ~'element ~'result) (throw (Exception. JSON error (non-string key in object ~store-and-recur) and changed read-json-reader to use get-object-reader at the start of the loop (defn- read-json-reader ([#^PushbackReader stream keywordize? eof-error? eof-value] (loop [i (.read stream) object-reader (get-object-reader)] (let [c (char i)] (cond ;; Handle end-of-stream (= i -1) (if eof-error? (throw (EOFException. JSON error (end-of- file))) eof-value) ;; Ignore whitespace (Character/isWhitespace c) (recur (.read stream) object- reader) these are the only changes that are needed and should preserve the default case, while allowing to extend object reader with custom deserializers, would this solution be acceptable? On Aug 24, 8:21 pm, Dmitri dmitri.sotni...@gmail.com wrote: I understand the desire to keep the parser clean, but at the same time the ability to register custom data deserializers would be very convenient. Would something like the following help with the performance issue, since if no deserializers were registered there would only be a one time penalty for selecting the object reader? (defn- read-json-reader ([#^PushbackReader stream keywordize? eof-error? eof-value] (loop [i (.read stream) object-reader (if (empty? @*deserializers*) read-json- object read-json-object-and-deserialize)] On Aug 24, 6:51 pm, Stuart Sierra the.stuart.sie...@gmail.com wrote: On Aug 23, 9:03 pm, Dmitri dmitri.sotni...@gmail.com wrote: Would there be an issue with adding something like that to the contrib? I don't want to add anything that impacts performance in the plain parsing case. -S -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: date serialization in clojure-contrib json
I posted the complete file on github here http://gist.github.com/549771 -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: date serialization in clojure-contrib json
Thanks, I'll give it a try. On Aug 25, 12:00 pm, Dmitri dmitri.sotni...@gmail.com wrote: I posted the complete file on github herehttp://gist.github.com/549771 -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Clojure 1.3: Integrating clj-stacktrace?
I have the same problem, but you can usually figure that out by looking at the function to which the backtrace refers, as well as the filename: 4: clojure.lang.RT.nth(RT.java:722) 5: ddsolve.core$play_deal_strategically.invoke(core.clj:177) 6: ddsolve.core$eval2129.invoke(NO_SOURCE_FILE:1) 7: clojure.lang.Compiler.eval(Compiler.java:5424) Here I can tell that the problem was in ddsolve.core, not some other core.clj, from looking at line 5. On Aug 25, 7:06 am, David Jagoe davidja...@gmail.com wrote: Ahoy, On 25 August 2010 15:46, Stuart Halloway stuart.hallo...@gmail.com wrote: *Specific* documentation of pain points also welcome. In general I haven't found the stack traces to be too much of a problem, but the lack of full paths in the trace has bitten me. Since all of my namespaces have a core.clj this can mean a bit of detective work to find which core.clj is being reported. Cheers, David -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Clojure 1.3: Integrating clj-stacktrace?
+1 the default stacktraces in clojure are one of the most off-putting things for new people (Besides the ) :-)). On Wed, Aug 25, 2010 at 6:55 AM, Phil Hagelberg p...@hagelb.org wrote: One of the most common complaints about the current implementation of Clojure is that the stack traces are often unreadable. At work we have been using Mark McGranaghan's clj-stacktrace library[1] to print stack traces, and it does a great job of cleaning them up and making it much clearer as to what the actual cause of the problem is. I've found it invaluable for this--it provides indentation, better details, and even coloring to help make the relevant frames stand out in the noise. I've spoken to him about it, and he is agreeable to the idea of merging it into Clojure. He is the sole author of it, and it sounds like he'd be fine with relicensing and copyright assignment. It appears at first glance to be compatible with the existing clojure.stacktrace library. Obviously before it could be merged we would need to investigate this more thoroughly, but I think it could be a valuable improvement to Clojure 1.3. Thoughts? -Phil [1] - http://github.com/mmcgrana/clj-stacktrace -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- Anders Rune Jensen http://www.iola.dk -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: help with native-jar files..
On Aug 24, 4:43 pm, Sunil S Nandihalli sunil.nandiha...@gmail.com wrote: Could not locate de/jreality/plugin/JRViewer__init.class or de/jreality/plugin/JRViewer.clj on classpath: [Thrown class java.io.FileNotFoundException] I verified that the final jar that I created had JRViewer file it is complaining about using jarexplorer.. can anybody help me with a suggestion? Sunil. This is not such a useful suggestion but I recommend you try with a new repl after running: lein clean lein deps lein repl I had a similar problem with something yesterday and the error message changed to a FileNotFoundException after the package was used once. Sorry I can't be more helpful. Saul -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
bug?? extend Object compilation order dependency?
So if I do this in a clean REPL Clojure 1.2.0 user= (defprotocol Foo (bar [this x])) Foo user= (defrecord fooed [] Foo (bar [this x] (* 2 x))) user.fooed user= (defprotocol Foo (bar [this x])) Foo user= (extend-type Object Foo (bar [this x] (/ 2 x))) nil user= (def fooey (fooed.)) #'user/fooey user= (bar fooey 10) 1/5 user= (defrecord fooed [] Foo (bar [this x] (* 2 x))) user.fooed user= (def fooey (fooed.)) #'user/fooey user= (bar fooey 10) 20 I would have expected 20 the first call to bar to be 20. This is a natural sequence of lines to execute if you---for instance--- have Foo defined in file A and fooed in file B, and you then add a default implementation using extend-type in file A and then recompile file A. This scenario is easily fixed by recompiling file B (as the last few lines demonstrate). I don't see any easy way to actually fix this behavior (though my understanding of how protocols are implemented is largely based on seeing how they behave and my limited knowledge of the JVM, rather than actually looking at the code), but it does seem like it would be less surprising if it could be accomplished. Thoughts? Should I post this as a ticket in assembla? -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Clojure 1.3: Integrating clj-stacktrace?
problem, but the lack of full paths in the trace has bitten me. Since all of my namespaces have a core.clj this can mean a bit of detective work to find which core.clj is being reported. +1 for that. -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Clojure 1.3: Integrating clj-stacktrace?
On 25 August 2010 20:16, Alan a...@malloys.org wrote: I have the same problem, but you can usually figure that out by looking at the function to which the backtrace refers, as well as the filename: 4: clojure.lang.RT.nth(RT.java:722) 5: ddsolve.core$play_deal_strategically.invoke(core.clj:177) 6: ddsolve.core$eval2129.invoke(NO_SOURCE_FILE:1) 7: clojure.lang.Compiler.eval(Compiler.java:5424) Here I can tell that the problem was in ddsolve.core, not some other core.clj, from looking at line 5. Excellent point, Alan! Who knew you had to be able to read to be a developer! ;-) -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Clojure 1.3: Integrating clj-stacktrace?
+1 need to improve the present stacktrace, and error messages if clojure is to attract more noobs. On Wed, Aug 25, 2010 at 6:16 PM, Alan a...@malloys.org wrote: I have the same problem, but you can usually figure that out by looking at the function to which the backtrace refers, as well as the filename: 4: clojure.lang.RT.nth(RT.java:722) 5: ddsolve.core$play_deal_strategically.invoke(core.clj:177) 6: ddsolve.core$eval2129.invoke(NO_SOURCE_FILE:1) 7: clojure.lang.Compiler.eval(Compiler.java:5424) Here I can tell that the problem was in ddsolve.core, not some other core.clj, from looking at line 5. On Aug 25, 7:06 am, David Jagoe davidja...@gmail.com wrote: Ahoy, On 25 August 2010 15:46, Stuart Halloway stuart.hallo...@gmail.com wrote: *Specific* documentation of pain points also welcome. In general I haven't found the stack traces to be too much of a problem, but the lack of full paths in the trace has bitten me. Since all of my namespaces have a core.clj this can mean a bit of detective work to find which core.clj is being reported. Cheers, David -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.comclojure%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Leiningen 1.3.0 - compile task problem
Hi all, We are completing the migration to clojure and contrib 1.2. I am working on the packaging this week using leinigen 1.3 for acceptance tests. I download artifacts from Clojars and other maven repos using our archiva server here. I have a problem that I do not understand yet (slowly coming back from summer vacations...) with the compile task. I end up with .class files from clojure-contrib in my class folder in one of my projects here. The src folder does not contain any clojure-contrib stuff though... Adding the omit-source option removed the .clj files in the target but still stuffed the .class files from contrib. Only the alien classes from contrib end up in the target, nothing from clojure or other dependencies. It's like if the compile task is picking up source code from the jar dependency, not just the source code files of the project. I specified :all instead of enumerating my own name spaces which I will do right now to see if it clears out the issue. Any ideas anyone ? Thank you, Luc -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Leiningen 1.3.0 - compile task problem
On Wed, Aug 25, 2010 at 5:59 PM, lprefonta...@softaddicts.ca wrote: We are completing the migration to clojure and contrib 1.2. I am working on the packaging this week using leinigen 1.3 for acceptance tests. I download artifacts from Clojars and other maven repos using our archiva server here. I have a problem that I do not understand yet (slowly coming back from summer vacations...) with the compile task. I end up with .class files from clojure-contrib in my class folder in one of my projects here. The src folder does not contain any clojure-contrib stuff though... Adding the omit-source option removed the .clj files in the target but still stuffed the .class files from contrib. This is a possibly due to a problem with Clojure's compiler. There is a fix implemented in this patch: http://www.assembla.com/spaces/clojure/tickets/322 Hopefully it can be applied soon to Clojure 1.3. Maybe you could try applying it yourself to see if it solves the problem? -Phil -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Please correct me if I'm wrong about the proxy macro
Hey, I just want to be sure that I understand the proxy macro correctly. proxy macro is used to create a block of code that implements/extends Java interface/class , so we don't have to create Java object explicitly. Please correct me if I'm wrong. 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 members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Does Clojure has a compiler
Hey, Both Groovy and Scala have a compiler to produce class files. Does Clojure has a compiler? Do Clojure files are compiled usually? 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 members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Does Clojure has a compiler
On Wed, Aug 25, 2010 at 7:17 PM, HB hubaghd...@gmail.com wrote: Both Groovy and Scala have a compiler to produce class files. Does Clojure has a compiler? Yup. See the recent thread called AOT compilation newbie mistakes for both the way to do it and some of the issues you may run into. Several people prefer using a build tool like Leiningen tho' (I find that easier to work with than command line compilation): http://github.com/technomancy/leiningen Then you can just do: lein new project cd project lein test -- to run the unit tests for your project lein compile -- to compile to .class files lein jar -- to create a JAR file etc. -- Sean A Corfield -- (904) 302-SEAN Railo Technologies, Inc. -- http://getrailo.com/ An Architect's View -- http://corfield.org/ If you're not annoying somebody, you're not really alive. -- Margaret Atwood -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Does Clojure has a compiler
Yes, clojure has a compiler that can compile directly to class files. There's more information here: http://clojure.org/compilation and a short demo that you can try here: http://www.rlmcintyre.com/iassac-gouy.tar.bz2 or http://www.bortreb.com/iassac-gouy.tar.bz2 --Robert McIntyre On Wed, Aug 25, 2010 at 10:17 PM, HB hubaghd...@gmail.com wrote: Hey, Both Groovy and Scala have a compiler to produce class files. Does Clojure has a compiler? Do Clojure files are compiled usually? 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 members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: bug?? extend Object compilation order dependency?
I think the current behavior follows the principle of least surprise: (1) bar is a function, in whatever namespace the protocol Foo is defined in (2) you redefine bar (perhaps by reloading the file Foo is in) (3) you call bar and get the new behavior Remember that bar lives in Foo's namespace, not in fooed's. Also: what should your expectation be if the second definition of Foo had changed the arity of bar? Stu So if I do this in a clean REPL Clojure 1.2.0 user= (defprotocol Foo (bar [this x])) Foo user= (defrecord fooed [] Foo (bar [this x] (* 2 x))) user.fooed user= (defprotocol Foo (bar [this x])) Foo user= (extend-type Object Foo (bar [this x] (/ 2 x))) nil user= (def fooey (fooed.)) #'user/fooey user= (bar fooey 10) 1/5 user= (defrecord fooed [] Foo (bar [this x] (* 2 x))) user.fooed user= (def fooey (fooed.)) #'user/fooey user= (bar fooey 10) 20 I would have expected 20 the first call to bar to be 20. This is a natural sequence of lines to execute if you---for instance--- have Foo defined in file A and fooed in file B, and you then add a default implementation using extend-type in file A and then recompile file A. This scenario is easily fixed by recompiling file B (as the last few lines demonstrate). I don't see any easy way to actually fix this behavior (though my understanding of how protocols are implemented is largely based on seeing how they behave and my limited knowledge of the JVM, rather than actually looking at the code), but it does seem like it would be less surprising if it could be accomplished. Thoughts? Should I post this as a ticket in assembla? -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Please correct me if I'm wrong about the proxy macro
Yes, proxy returns an instance of whatever classes/interfaces you're extending/implementing. On Aug 25, 7:15 pm, HB hubaghd...@gmail.com wrote: Hey, I just want to be sure that I understand the proxy macro correctly. proxy macro is used to create a block of code that implements/extends Java interface/class , so we don't have to create Java object explicitly. Please correct me if I'm wrong. 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 members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Clojure 1.2 and the Computer Language Benchmarks Game
On Aug 25, 6:17 am, John Fingerhut andy.finger...@gmail.com wrote: I will try submitting one or a few of my benchmark programs created 1 year ago. For anyone that wants to look at some timing results and/or my source code used to achieve them before then, they are available on github here: http://github.com/jafingerhut/clojure-benchmarks I just pushed a few changes required for Clojure 1.2 about 10 minutes ago. There aren't many changes to the results from Clojure 1.1 alpha I tested against a year ago, except for the following -- note that besides updating my Clojure version since last time, I have also upgraded the version of OS X on my Mac, and the version of Java from Apple. I have not attempted to test these changes independently to see which one or ones caused the change in run time: k-nucleotide benchmark completed in about 2/3 the time of earlier runs (good) mandelbrot also runs in about 2/3 the time of before n-body takes about 5x longer than before. I do not know why. As always, improvements to my versions are welcome. I am pretty sure some people have posted programs they have worked on for these problems during the most recent 1 year to the group, but I'm sorry to say I haven't kept up with all of them to see if they are faster than my fastest versions. Andy 1) The command line requested for these first programs doesn't AOT compile so the measured time includes compiling the program. Perhaps AOT compilation is an usual way to use Clojure - or perhaps it would be better to show programs that used AOT compilation? http://groups.google.com/group/clojure/browse_thread/thread/e9902e30afbb805e 2) mandelbrot - There seems to be some problem with the mandelbrot program - the program doesn't seem to exit for perhaps a minute after the output file is created - see the difference between CPU secs and Elapsed secs. http://shootout.alioth.debian.org/u32q/program.php?test=mandelbrotlang=clojureid=1 3) regexdna http://shootout.alioth.debian.org/u32q/program.php?test=regexdnalang=clojureid=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 Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Clojure 1.2 and the Computer Language Benchmarks Game
On Aug 25, 10:31 pm, Meikel Brandmeyer m...@kotka.de wrote: Hi, On 26 Aug., 05:37, Isaac Gouy igo...@yahoo.com wrote: 1) The command line requested for these first programs doesn't AOT compile so the measured time includes compiling the program. Which makes the comparison of languages with this benchmark even more uninteresting. Have you actually measured the time difference? Perhaps AOT compilation is an usual way to use Clojure - or perhaps it would be better to show programs that used AOT compilation? If startup time matters AOT compilation is a valid step to take. AOT is not necessary but helps in such a case. 2) mandelbrot - There seems to be some problem with the mandelbrot program - the program doesn't seem to exit for perhaps a minute after the output file is created - see the difference between CPU secs and Elapsed secs. (shutdown-agents) Sincerely 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en