Re: loneclojurian at ICFP programming contest

2009-07-05 Thread Bradbev
On Jul 5, 3:18 am, fft1976 wrote: > On Jul 5, 2:31 am, Nicolas Oury wrote: > > > After, when I run the benchmark in -server with a big enough CacheCode area > > (1000m), and enough iterations to have everything JITed, I get more than > > 860.000 iterations per second. (I benchmarked 100 000 000

tests involving threads

2009-07-05 Thread Timothy Pratley
Very glad that test is now part of clojure core. I've run into 2 strange behaviours when trying to write tests where threads are involved. My case is a little complex so here is a minimal version which shows what I mean: test-test.clj: (ns test-test (:use clojure.test)) (deftest testathon (

Re: Clojure at LispNYC tonight 7pm

2009-07-05 Thread Daniel Jomphe
I second this suggestion to add the video to clojure.blip.tv. It felt very awkward in 2009 to have to download this thing instead of stream it. :) I just watched it and wanted to say it's a very nice show of Clojure's Java interop in practice. Congrats to Stuart. It was also very nice to learn th

Re: print-base / print-radix?

2009-07-05 Thread Parth
On Jul 5, 9:02 pm, Tom Faulhaber wrote: > Parth, > > I've created a little wrapper as promised at:http://gist.github.com/141001. > > It gives you my-pprint: > > user> (binding [*print-base* 2] (my-pprint (range 10))) > (0 1 10 11 100 101 110 111 1000 1001) > nil > user> > Thanks Tom. This work

Re: sanity check needed

2009-07-05 Thread Mark Volkmann
On Sun, Jul 5, 2009 at 8:14 PM, Stephen C. Gilardi wrote: > > On Jul 5, 2009, at 8:12 PM, Mark Volkmann wrote: > > I'd appreciate it if someone > could look it over and let me know if I've done anything that isn't > very idiomatic. > > A few recommendations just at the "look and feel" level: > - u

Re: sanity check needed

2009-07-05 Thread Mark Volkmann
On Sun, Jul 5, 2009 at 8:05 PM, ataggart wrote: > > A set might be better to hold the player-refs, then you can just call > (disj player-refs player-ref) without doing any extra checking. Thanks, I llke that much better! > Also you can access ref values without needing to be in a dosync. > Thing

Re: sanity check needed

2009-07-05 Thread ataggart
I should have been more clear when I said to use (disj ...); I meant sending that via an alter. On Jul 5, 6:05 pm, ataggart wrote: > A set might be better to hold the player-refs, then you can just call > (disj player-refs player-ref) without doing any extra checking. > > Also you can access ref

Re: sanity check needed

2009-07-05 Thread Stephen C. Gilardi
On Jul 5, 2009, at 8:12 PM, Mark Volkmann wrote: I'd appreciate it if someone could look it over and let me know if I've done anything that isn't very idiomatic. A few recommendations just at the "look and feel" level: - use doc strings for functions in place of comments - global delete of

Re: sanity check needed

2009-07-05 Thread ataggart
A set might be better to hold the player-refs, then you can just call (disj player-refs player-ref) without doing any extra checking. Also you can access ref values without needing to be in a dosync. Things being immutable, the value you get from, say, @team-ref won't change once you have it. On

Re: ANN: FnParse, a functional parsing library

2009-07-05 Thread Wilson MacGyver
Thanks for the tip on looking at clojure.contrib. I keep forgetting to check there. On Jul 5, 2009, at 4:20 PM, samppi wrote: > > If you need a JSON parser, there's already a good one included with > clojure.contrib. The one with the FnParse library is just a sample to > show how it works. Bu

sanity check needed

2009-07-05 Thread Mark Volkmann
I wrote some fairly simple code to demonstrate use of StructMaps and Refs. It's 80 lines including comments. I'd appreciate it if someone could look it over and let me know if I've done anything that isn't very idiomatic. The program models sports teams and players. The main functionality is the

Re: Mysterious ClassFormatError after simple code change.

2009-07-05 Thread John Harrop
I'm not doing any funny things with load-string. The largest literal at this time is [2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97 101 103 107 109 113 127 131 137 139 149 151 157 163 167 173 179 181 191 193 197 199 211 223 227 229 233 239 241 251 257 263 269 271 277 2

Re: loneclojurian at ICFP programming contest

2009-07-05 Thread fft1976
On Jul 5, 10:53 am, igorrumiha wrote: > I think it's safe to say that once again it's proved that Clojure > easily matches the Java level of performance. I think one shouldn't generalize from one [unverified] example. Personally, I'll wait for Jon Harrop or someone to port the relevant Shootou

Re: Adding type hint causes compiler error

2009-07-05 Thread Kevin Downey
On Sun, Jul 5, 2009 at 5:18 AM, philip.hazel...@gmail.com wrote: > > Hi, > > The following code works as expected: > > (import 'javax.imageio.ImageIO 'java.io.File > 'java.awt.image.BufferedImage) > (defn bi-get-pixels >  [bi] >  (vec (.. bi (getData) (getPixels 0 0 (.getWidth bi) (.getHeight bi)

Re: Adding type hint causes compiler error

2009-07-05 Thread Mark Triggs
Hi Phil, Part of me hopes there's a nicer way of doing this, but I was able to get it working using: (defn bi-get-pixels [#^BufferedImage bi] (let [raster (.getData bi) pixels (.getPixels raster 0 0 (.getWidth bi) (.getHeight bi) (cast (Class/forName "[I")

Re: ANN: FnParse, a functional parsing library

2009-07-05 Thread samppi
If you need a JSON parser, there's already a good one included with clojure.contrib. The one with the FnParse library is just a sample to show how it works. But please feel free to use it however it can be useful to you. :) On Jul 4, 1:45 pm, Wilson MacGyver wrote: > Very timely, I need to parse

Re: Mysterious ClassFormatError after simple code change.

2009-07-05 Thread Stephen C. Gilardi
On Jul 5, 2009, at 2:01 AM, John Harrop wrote: and got: #32 in class file com/mycompany/myfile$eval__14598 (NO_SOURCE_FILE:0)> Are there large literals elsewhere in the same namespace? Here's some info from a previous report of this error: http://groups.google.com/group/clojure/browse_frm/t

Re: loneclojurian at ICFP programming contest

2009-07-05 Thread Nicolas Oury
I don't know if it will help, but I used another flag. I have not my computer at hand but I think it was in the lines of -XX agressiveoptimizations. Moreover, the performance goes from 200 000 to 800 000 depending on the size of the chunks. I tried to launch for 1 or 10 millions iterations to find

Re: ants.clj and render thread starvation

2009-07-05 Thread John Newman
I'm on an hp mini. It runs on an Atom processor. I ran ants.clj and it was frozen for a little while. Then after maybe 30 seconds it looked normal -- a tick every second or half second or so. I'm running a lot of applications though. On Ubuntu here too. On Sun, Jul 5, 2009 at 11:17 PM, B Smit

Re: ants.clj and render thread starvation

2009-07-05 Thread B Smith-Mannschott
On Tue, Jun 30, 2009 at 18:01, Rich Hickey wrote: > > On Tue, Jun 30, 2009 at 7:50 AM, Krukow wrote: >> >> On Jun 29, 7:51 pm, B Smith-Mannschott wrote: >> [snip...] >>> much on my netbook. The problem seems to be that with only a single >>> (hyperthreaded) core the render agent is almost constan

Re: loneclojurian at ICFP programming contest

2009-07-05 Thread igorrumiha
On Jul 5, 3:05 pm, Nicolas Oury wrote: > Actually, that would be so good, that I actually think there is a mistake > somewhere either in my program or my computation of the speed. > Let's wait for igorrumiha to check and to test this implementation. > OK, I did my tests, I found and fixed two sm

Re: print-base / print-radix?

2009-07-05 Thread Tom Faulhaber
Parth, I've created a little wrapper as promised at: http://gist.github.com/141001. It gives you my-pprint: user> (binding [*print-base* 2] (my-pprint (range 10))) (0 1 10 11 100 101 110 111 1000 1001) nil user> While doing this, I realized to my horror that ~r doesn't do 0 correctly for non-s

Re: loneclojurian at ICFP programming contest

2009-07-05 Thread Nicolas Oury
Each iteration contains 266 instructions. So, it is more like 10.5 clock cycle per instructions. Probably the cost of the method call, that I had to introduce in order to have the JIT compile, or the fact that the status register is not directly in a local variable but with an indirection, because

Mysterious ClassFormatError after simple code change.

2009-07-05 Thread John Harrop
I had this: (defn- subexpressions-of-sum** [[n p] terms] (let-print [sum (cons '+ (map #(factor-term % n p) terms)) prod (rest (make-product* n p))] (concat [sum] (subexpressions-of-product (cons sum prod) in a source file with other definitions. Load-file worked. I then change

Adding type hint causes compiler error

2009-07-05 Thread philip.hazel...@gmail.com
Hi, The following code works as expected: (import 'javax.imageio.ImageIO 'java.io.File 'java.awt.image.BufferedImage) (defn bi-get-pixels [bi] (vec (.. bi (getData) (getPixels 0 0 (.getWidth bi) (.getHeight bi) nil (bi-get-pixels (. ImageIO read (File. "/home/phil/prog/small- test.png"))

Re: conversation with Corey Haines

2009-07-05 Thread Timothy Pratley
Interesting talk Stuart, thanks for the link. On Jul 4, 1:12 pm, Stuart Halloway wrote: > Corey Haines, the touring software journeyman, recently spent a few   > days at Relevance (including a day pairing on a Clojure project). At   > the end, he videoed a conversation with me [1]. In Part 2 of

Re: loneclojurian at ICFP programming contest

2009-07-05 Thread fft1976
On Jul 5, 2:31 am, Nicolas Oury wrote: > After, when I run the benchmark in -server with a big enough CacheCode area > (1000m), and enough iterations to have everything JITed, I get more than > 860.000 iterations per second. (I benchmarked 100 000 000 iterations in 121 > sec, on my 2.4GHz comput

Re: adding a member to a set in a map in a map in a map in a ref

2009-07-05 Thread Rowdy Rednose
You're right, the scenario that I described doesn't need it. In my actual code I need it because the function actually reads #(conj (or % #{}) constraint#) If I don't do that, I get a list instead of a set. On Jul 5, 5:12 pm, Meikel Brandmeyer wrote: > Hi, > > Am 05.07.2009 um 07:27 schrieb Row

Re: loneclojurian at ICFP programming contest

2009-07-05 Thread Nicolas Oury
Hello, Thanks to Rich's advices, I managed to make your ICFP program run very fast. I have made a few modifications: - changed the code following Rich's advices in order to have primitive array access everywhere. - I didn't managed to do it for booleans, so I used a java object conataining only a

Re: adding a member to a set in a map in a map in a map in a ref

2009-07-05 Thread Meikel Brandmeyer
Hi, Am 05.07.2009 um 07:27 schrieb Rowdy Rednose: user=> (dosync (alter gnu-rms update-in [:key1 :key2 :key3] #(conj % "foo"))) {:key1 {:key2 {:key3 #{"foo" You actually don't need the anonymous function... (dosync (alter gnu-rms update-in [:key1 :key2 :key3] conj "foo")) Sincerely M