Re: Slurping structs from file fails with whitespace string attributes
Thanks! Sorry about double-posting, the message took over 24 hours to appear here. -Perttu On May 29, 2:56 pm, "J. McConnell" wrote: > On Thu, May 28, 2009 at 4:23 PM, Perttu wrote: > > > I use a store-function like this: > > > (defn store-customer-db [customer-db filename] > > (spit filename (with-out-str (print customer-db > > I believe this is your problem. The print/println functions print in a > format suitable for human consumption. That's why you don't see quotes > around the strings. These are the functions you would normally use for, for > example, echoing instructions to a console user. > > I believe what you are looking for are the pr/prn functions (pr in > particular). These are designed to print objects for reader consumption. > > HTH, > > - J. --~--~-~--~~~---~--~~ 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: Slurping structs from file fails with string attributes containing whitespaces
Thanks! Sorry about double-posting, the message took over 24 hours to appear here. -Perttu On May 29, 2:59 pm, Christophe Grand wrote: > On 29 mai, 05:55, Perttu wrote: > > > I use a store-function like this: > > > (defn store-customer-db [customer-db filename] > > (spit filename (with-out-str (print customer-db > > From the output file of spit I can see that the print doesn't give > > double quotes to the strings which seems to be a problem for slurp. > > What would be the correct solution for this? > > Use pr instead of print (seehttp://clojure.org/api#pr"By default, pr > and prn print in a way that objects can be read by the reader"). > You can even remove with-out-str if you use pr-str > > hth > > Christophe --~--~-~--~~~---~--~~ 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: VimClojure v2.1.1 is released
if someone just has a vimclojure set up for mac/tiger (and one for Windows) that can somehow be bundled, I'd be interested. I still haven't settled into any sort of reliable/intuitive environment for developing in clojure -- it's by far the biggest hurdle to everyone I know trying to get into it. Thanks. - Eli On Sat, Jun 6, 2009 at 12:27 PM, Emeka wrote: > This is probably the global _vimrc installed by Vim I think as much, vim > needs this file to run. > If you installed Vim as an administrator I always work as administrator. > I will create that file and now what and what am I going to add to it. > > Regards, > Emeka > > > > O > > > On Sat, Jun 6, 2009 at 4:03 PM, Meikel Brandmeyer wrote: > >> Hi, >> >> Am 06.06.2009 um 17:47 schrieb Emeka: >> >> Then it is pretty obvious that I have erred again. >>> C:\Program files\Vim\_vimrc That's where I found that file. >>> >> >> This is probably the global _vimrc installed by Vim. >> You should first try a _vimrc in your home directory. >> Just create it if it doesn't exist. If you installed Vim as >> an administrator and now work as a "normal" user >> that might explain, why you are not allowed to edit >> the file. >> >> 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: What books have helped you wrap your brain around FP and Clojure?
+1 for Higher Order Perl. The author, Mark Jason Dominus, has made the book available for free download at http://hop.perl.plover.com/book/. Cheers, Danny. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
New and stuck ??
Any ideas ? Mac OS-X ~/Downloads/clojure_1.0.0$ java -cp clojure.jar clojure.lang.Repl Exception in thread "main" java.lang.NoClassDefFoundError: clojure/ lang/Repl ~/Downloads/clojure_1.0.0$ java -cp clojure.jar /clojure.main Exception in thread "main" java.lang.NoClassDefFoundError: /clojure/ main ~/Downloads/clojure_1.0.0$ ls build.xml epl-v10.html pom.xml src clojure-1.0.0.jar pom-template.xml readme.txtsvninfo.txt ~/Downloads/clojure_1.0.0$ java -version java version "1.5.0_16" Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_16- b06-284) Java HotSpot(TM) Client VM (build 1.5.0_16-133, mixed mode, sharing) -= Darrell --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
timing for map
user=> (time (map answer '(50 50))) "Elapsed time: 0.032826 msecs" (392330 392711) user=> (time (answer 50)) "Elapsed time: 6357.131423 msecs" 392849 When I try to time 'map' it seems to return right away. How do I time the full two executions of 'answer'? --~--~-~--~~~---~--~~ 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: timing for map
I map produces a lazy sequence, time doesn't force it, if you wrap it in either a dorun or doall, you should get what you expect: user> (time (map #(Thread/sleep %) '(1000 1000 1000))) "Elapsed time: 0.156 msecs" (nil nil nil) user> (time (doall (map #(Thread/sleep %) '(1000 1000 1000 "Elapsed time: 3000.383 msecs" (nil nil nil) user> I think that is what you're running into. Kyle On Sat, Jun 6, 2009 at 5:02 PM, artg wrote: > > user=> (time (map answer '(50 50))) > "Elapsed time: 0.032826 msecs" > (392330 392711) > user=> (time (answer 50)) > "Elapsed time: 6357.131423 msecs" > 392849 > > When I try to time 'map' it seems to return right away. How do I time > the full two executions of 'answer'? > > > > -- -- kyle.bur...@gmail.comhttp://asymmetrical-view.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: New and stuck ??
I think your ls showed it, the jar name is clojure-1.0.0.jar, so the java -cp argument should point to that instead: java -cp clojure-1.0.0.jar clojure.lang.Repl Kyle On Sat, Jun 6, 2009 at 6:17 PM, darrell wrote: > > Any ideas ? > Mac OS-X > > ~/Downloads/clojure_1.0.0$ java -cp clojure.jar clojure.lang.Repl > Exception in thread "main" java.lang.NoClassDefFoundError: clojure/ > lang/Repl > > ~/Downloads/clojure_1.0.0$ java -cp clojure.jar /clojure.main > Exception in thread "main" java.lang.NoClassDefFoundError: /clojure/ > main > > ~/Downloads/clojure_1.0.0$ ls > build.xml epl-v10.html pom.xml src > clojure-1.0.0.jar pom-template.xml readme.txt svninfo.txt > > ~/Downloads/clojure_1.0.0$ java -version > java version "1.5.0_16" > Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_16- > b06-284) > Java HotSpot(TM) Client VM (build 1.5.0_16-133, mixed mode, sharing) > > -= Darrell > > > > -- -- kyle.bur...@gmail.comhttp://asymmetrical-view.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: ICFP 2009
Just an update on this thread - it turns out my wife and I are out of town at a wedding the weekend of the contest this year, so if anyone wants to organize a clojure team, don't depend on me to organize it. Good luck! On Thu, Apr 23, 2009 at 1:34 PM, Jason Wolfe wrote: > > I'm interested, although I'm not sure if I'll be around that weekend. > I've done quite well in past TopCoder-style contests (where I've had > to use Java); it would be fun to do a competition in Clojure. > > -Jason > > > --~--~-~--~~~---~--~~ 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: VimClojure v2.1.1 is released
Hi, Am 07.06.2009 um 14:26 schrieb e: if someone just has a vimclojure set up for mac/tiger (and one for Windows) that can somehow be bundled, I'd be interested. I still haven't settled into any sort of reliable/intuitive environment for developing in clojure -- it's by far the biggest hurdle to everyone I know trying to get into it. Please keep in mind: VimClojure does not claim to be an intuitive environment for Clojure per se. It tries to be intuitive for *Vim* users. If you weren't exposed to vim before, you will probably have a hard time getting started. Similar applies to emacs+SLIME. Also ClojureBox doesn't change that in my opinion. At a first look you might have a quick start, but then still there is the emacs hiding underneath. And no, I don't think, that emacs is more intuitive than vim... Netbeans and Eclipse (and probably IntelliJ) finally aren't masters of Intuition also. So what a "intuitive" environment is, mostly depends on your background. You are a Java hacker and grok Netbeans? Choose enclojure! You hacked the Linux kernel with Vim? Choose VimClojure! You have a CL background and are a SLIME guru? Well, choose emacs. If non of the above applies, you probably have to take the pill and learn one the environments. If you just want to get started with Clojure, use a simple text editor of your liking and a repl running in the shell/command prompt window. This works quite well and it forces you to think about the namespace structure etc. Friction caused by not-knowing the environment almost vanishes. Claiming that not having a full-fledged environment stops someone from using the language is a lame excuse. Neither Perl nor Python nor pick-your-lang had a full-fledged env two years after first public appearance. Still people managed to develop using them. That said, I think the current fauna of environments for Clojure is very rich. Each fills its own niche. Sincerely Meikel smime.p7s Description: S/MIME cryptographic signature
Re: New and stuck ??
OK, embarrassing Thanks, I was caught wishing to see a wow fun demo, without thought on my part. -= Darrell On Jun 7, 10:13 am, "Kyle R. Burton" wrote: > I think your ls showed it, the jar name is clojure-1.0.0.jar, so the > java -cp argument should point to that instead: > > java -cp clojure-1.0.0.jar clojure.lang.Repl > > Kyle > --~--~-~--~~~---~--~~ 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: VimClojure v2.1.1 is released
If you just want to get started with Clojure, use a simple text editor of your liking and a repl running in the shell/command prompt window. Well, that's what I have done. Now I am looking for something else. And because I have flirted with vi before, and I am somehow thinking that learning vim would be a great experience :). But I am not yet able to get vimclojure kicking. That's why I have been appealing for help since. And it took Meikel three weeks to make out time to talk to me. That shows that vim learning curve is indeed steep! Regards, Emeka --~--~-~--~~~---~--~~ 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: VimClojure v2.1.1 is released
thanks. I do grok, vim. the other point is less about what to do once it is all set up ... it's that setting up is a multi-step hurdle. That's what has been prohibitive for folks. The risk is sinking the time and ending up at some sort of dead end. For me, i had to hack like crazy, for example to get up through the the rlwrap point in one set of instructions. seems simple enough but compiling all the dependencies was a killer... required though in my case -- ports not working. So I was pretty much out of steam after 8 hours just as I was seeing all the VimClojure instructions. You are all right that it is a bunch of whining on my part, but remember that it's not just me. I represent a demographic. I agree that all the progress being made is awesome. was mostly asking if that piece happened to have been done yet . . . . a vim analogue of clojurebox for Windows and Mac. On Sun, Jun 7, 2009 at 10:43 AM, Meikel Brandmeyer wrote: > Hi, > > Am 07.06.2009 um 14:26 schrieb e: > > if someone just has a vimclojure set up for mac/tiger (and one for >> Windows) that can somehow be bundled, I'd be interested. I still haven't >> settled into any sort of reliable/intuitive environment for developing in >> clojure -- it's by far the biggest hurdle to everyone I know trying to get >> into it. >> > > Please keep in mind: VimClojure does not claim > to be an intuitive environment for Clojure per se. > It tries to be intuitive for *Vim* users. If you weren't > exposed to vim before, you will probably have > a hard time getting started. > > Similar applies to emacs+SLIME. Also ClojureBox > doesn't change that in my opinion. At a first look > you might have a quick start, but then still there > is the emacs hiding underneath. And no, I don't > think, that emacs is more intuitive than vim... > > Netbeans and Eclipse (and probably IntelliJ) finally > aren't masters of Intuition also. > > So what a "intuitive" environment is, mostly depends > on your background. You are a Java hacker and > grok Netbeans? Choose enclojure! You hacked the > Linux kernel with Vim? Choose VimClojure! You > have a CL background and are a SLIME guru? > Well, choose emacs. > > If non of the above applies, you probably have to > take the pill and learn one the environments. If you > just want to get started with Clojure, use a simple > text editor of your liking and a repl running in the > shell/command prompt window. This works quite > well and it forces you to think about the namespace > structure etc. Friction caused by not-knowing the > environment almost vanishes. > > Claiming that not having a full-fledged environment > stops someone from using the language is a lame > excuse. Neither Perl nor Python nor pick-your-lang > had a full-fledged env two years after first public > appearance. Still people managed to develop using > them. > > That said, I think the current fauna of environments > for Clojure is very rich. Each fills its own niche. > > 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: New and stuck ??
the new entry point is clojure.main java -cp clojure.jar clojure.main ;no slash, with the corrent jar name java -cp clojure.jar clojure.main --help will print a nice help message On Sun, Jun 7, 2009 at 8:20 AM, darrell wrote: > > OK, embarrassing > > Thanks, I was caught wishing to see a wow fun demo, without thought on > my part. > > -= Darrell > > On Jun 7, 10:13 am, "Kyle R. Burton" wrote: >> I think your ls showed it, the jar name is clojure-1.0.0.jar, so the >> java -cp argument should point to that instead: >> >> java -cp clojure-1.0.0.jar clojure.lang.Repl >> >> Kyle >> > > > > -- And what is good, Phaedrus, And what is not good— Need we ask anyone to tell us these things? --~--~-~--~~~---~--~~ 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: VimClojure v2.1.1 is released
Hi, Am 07.06.2009 um 19:13 schrieb e: So I was pretty much out of steam after 8 hours just as I was seeing all the VimClojure instructions. You are all right that it is a bunch of whining on my part, but remember that it's not just me. I represent a demographic. The VimClojure instructions really boil down to building the jar and installing the Vim plugin. The normal way of "extract the zip into .vim" doesn't work because of the extra contents, which I - personally - don't want in my .vim. Having a local.properties is the only solution I came up with, which was reasonably simple. Similar for the contorted setup for the clojure.jar: ant somehow does not honor CLASSPATH. So the user has to specify the clojure.jar location manually. Tips from ant gurus appreciated. Note: if you don't provide a local.properties file Ivy is used. Then this is a non-issue, because the clojure.jar and the necessary parts of contrib are downloaded automatically. I just learned about user.home. So I can simplify also the .vim installation of the plugin. was mostly asking if that piece happened to have been done yet . . . . a vim analogue of clojurebox for Windows and Mac. I can try to do a "ClojureBall" MacVim. Hmm... Never done that before. Anyone with experience for Windows? Sincerely Meikel smime.p7s Description: S/MIME cryptographic signature
Re: VimClojure v2.1.1 is released
Hi, Am 07.06.2009 um 17:41 schrieb Emeka: And it took Meikel three weeks to make out time to talk to me. Huh? Did I miss something? Sincerely Meikel smime.p7s Description: S/MIME cryptographic signature
Multimethods & derive
Hi, I would like to use multimethods by dispatching on keys of the variables (maps) in a way that I sometimes have constraints on only some of the arguments. In common lisp I would say (defgeneric foo (a b)) (defmethod foo ((a bar) b) ...) (defmethod foo (a (b baz)) ...) (defmethod foo ((a bar) (b baz)) ...) This would mean that I have also defined methods for calls when (for example) `a' is an instance of `bar' and `b' of anything but `baz'. How can I achieve something like this with multimethods? I could define a relationship like (derive :bar :anything) (derive :baz :anything) and then do (defmulti foo (fn [a b] [(:somekey1 a) (:somekey2 b)])) with (defmethod foo [:bar :anything] [a b] ...) (defmethod foo [:anything :baz] [a b] ...) (defmethod foo [:bar :baz] [a b] ...) This seems to do the trick... but is this really the way to do it? If it is, it would be very useful to have something that is the ancestor of everything (like T in common lisp). Thanks, Peter --~--~-~--~~~---~--~~ 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: Multimethods & derive
On Jun 7, 7:46 pm, Peter Salvi wrote: > (defmethod foo [:bar :anything] [a b] ...) > (defmethod foo [:anything :baz] [a b] ...) > (defmethod foo [:bar :baz] [a b] ...) > > This seems to do the trick... but is this really the way to do it? This looks reasonable. > If it is, it would be very useful to have something that is the > ancestor of everything (like T in common lisp). This has been thought about, at least: http://clojure.org/todo I think the question is... what should the universal ancestor be? For classes, it's java.lang.Object. But "derive" allows you to create relationships outside the Java class hierarchy. So for now, defining your own "root" ancestor is the way to proceed. -Stuart Sierra --~--~-~--~~~---~--~~ 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: What books have helped you wrap your brain around FP and Clojure?
On Jun 6, 7:12 am, Robert Campbell wrote: > Going beyond the language-specific Programming Clojure book, what > other books have best helped you make the (sometimes mind-bending) > transition from OOP thinking to FP thinking? Practical Common Lisp, on the web at http://gigamonkeys.com/book/ Clojure borrows the good bits of CL. SICP is available online too, http://mitpress.mit.edu/sicp/ -Stuart Sierra --~--~-~--~~~---~--~~ 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: VimClojure v2.1.1 is released
> I can try to do a "ClojureBall" MacVim. Hmm... > Never done that before. Anyone with experience > for Windows? > > That'd be awesome. assume the user doesn't even have vim. they just have jdk. ... and they only care about vim for clojure. Well, I'd want to eventually integrate with svn and git, but I suppose folks just drop to a shell for that stuff, typically. --~--~-~--~~~---~--~~ 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: Threadring Benchmark
So I got a chance to do some tweaks to the clojure code and run the benchmark. I also used the "approved" (not alternative) version of java code for comparison. I must say I am impressed with the clojure agent performance. The previous implementation results for 20,000,000 hops was: java: 27.14 sec, 92% cpu scala: 190.78 sec, 183% cpu clojure: 215.26 sec, 134% cpu The new results are: java: 33.56 sec, 94% cpu scala: 191.08 sec, 177% cpu clojure: 77.01 sec, 91% cpu The tweaks to clojure code were minor. Basically, coercing hops to (int hops) and using (neg? hops) instead of =. Detailed Log: http://gist.github.com/125614 Updated Clojure Code: http://gist.github.com/125615 Jave Code: http://shootout.alioth.debian.org/u32q/benchmark.php?test=threadring&lang=java&id=4 Scala Code: http://shootout.alioth.debian.org/u32q/benchmark.php?test=threadring&lang=scala&id=1 Regards, Parth On Jun 6, 2:39 pm, Parth wrote: > On Jun 6, 11:44 am, Sean Devlin wrote: > > > This problem came up on the mailing list recently: > > >http://groups.google.com/group/clojure/browse_thread/thread/5e0c078d0... > > > You might want to compare your code to what was done here, but at a > > glance the implementations are similar. > > > You provide relative speed comparisons (Such and such is % > > better...). Would you be able to share absolute times as well? I'm > > just curious at this point. > > > Sean > > For some reason the google spreadsheet link provided in > my original mail requires users to login for viewing. > The same numbers are available in this published > google spreadsheet (hopefully without login). > > http://tinyurl.com/ofhync > > Regards, > Parth > > > > > On Jun 6, 12:41 am, Parth Malwankar wrote: > > > > Hello, > > > > In order to understand the agent model of Clojure > > > better I wrote the alioth shootout threadring benchmark [1]. > > > I ran some tests to compare it with the Java and Scala > > > implementation [2, 3] which I picked from the published > > > benchmarks. > > > > The clojure code can be found here:http://gist.github.com/124688 > > > > The benchmark from my two core 1.7GHz pentium system > > > (ubuntu 9.04) w/ 1GB RAM can be found > > > here:http://spreadsheets.google.com/ccc?key=rQLD6jgTTV5OqXwHdXtrTyg > > > > In summary, scala implementation is 6.34x times slower than > > > java, clojure is 7.8x. Avg CPU consumption is 93.3% for java and > > > 179.2% and 131.34% for scala and clojure respectively. > > > > I thought of sharing this in case others are interested. > > > As this is my first program using clojure agents I would appreciate > > > any > > > comments on improving the Clojure implementation (or in case > > > there are any bugs). > > > > Thanks. > > > Parth > > > PS: For the Java implementation I happen to pick the "interesting > > > alternate programs" (Java 6 -server #5) but it was already quite > > > late in the cycle when I realized that. So the Java numbers are > > > probably better than the other java implementations. > > > > [1]http://shootout.alioth.debian.org/u32q/benchmark.php?test=threadring&;... > > > [2]http://shootout.alioth.debian.org/u32q/benchmark.php?test=threadring&;... > > > [3]http://shootout.alioth.debian.org/u32q/benchmark.php?test=threadring&;... --~--~-~--~~~---~--~~ 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: Multimethods & derive
On 08.06.2009, at 04:26, Stuart Sierra wrote: >> If it is, it would be very useful to have something that is the >> ancestor of everything (like T in common lisp). > > This has been thought about, at least: http://clojure.org/todo > I think the question is... what should the universal ancestor be? For > classes, it's java.lang.Object. But "derive" allows you to create > relationships outside the Java class hierarchy. So for now, defining > your own "root" ancestor is the way to proceed. See also my patch that creates such a universal root type (the keyword :root): http://groups.google.com/group/clojure/browse_thread/thread/ bc5193304c1ab2e3/77e5d53d8ccd6b10?lnk=gst&q=%3Aroot#77e5d53d8ccd6b10 Of course, it is not a good idea to write code relying on an unofficial patch, I don't even use it myself for production code. But the patch illustrates that this can be done, and my tests have not shown any undesirable side effects. Konrad. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---