Re: "Wrapping" Java object

2010-03-02 Thread Miki
Hello Stu, > The JavaBeans spec defines the notion of a getter, and exposes it   > reflectively through java.beans.PropertyDescriptor. This matters   > because not all "getXXX" methods are getters, and not all getters have   > names "getXXX". The Clojure bean function uses beans reflection, you  

Re: Writing a put-if-absent operation a la Java's ConcurrentMap

2010-03-02 Thread Stuart Halloway
If so, there's more to be explained about `commute'. I'm imagining the commit-time rules saying that if competing changes to the refs touched by `commute' can be ignored, because the changes can be applied in either order. But if the operation was something like `inc', two competing threads would

Re: "Wrapping" Java object

2010-03-02 Thread Stuart Halloway
Hi Miki, The JavaBeans spec defines the notion of a getter, and exposes it reflectively through java.beans.PropertyDescriptor. This matters because not all "getXXX" methods are getters, and not all getters have names "getXXX". The Clojure bean function uses beans reflection, you should ta

"Wrapping" Java object

2010-03-02 Thread Miki
Hello All, I wrote a little utility that "wraps" Java object into a hash map (coming to think of it, "wrap" is not that good name). The code is at http://bitbucket.org/tebeka/clojurewise/src/tip/wrap.clj. Since I'm a Clojure newbie, I'll be glad to hear any comment about it. Thank you, -- Miki

Re: Writing a put-if-absent operation a la Java's ConcurrentMap

2010-03-02 Thread Steven E. Harris
Meikel Brandmeyer writes: > So using alter is the absolutely correct and nothing bad will > happen. However you might construct superfluous default nodes in case > the action is retried. They are not assoc'd to the map, though. Understood. Thanks for the explanation. > The anonymous function i

Re: Obtaining Clojure version: JVM or CLR?

2010-03-02 Thread ataggart
See http://clojure.org/patches On Mar 2, 7:17 am, soyrochus wrote: > Hi there, > > I'm currently experimenting with ways to make a program portable > across both Clojure and ClojureCLR (using IKVM). > Currently there doesn't seem to be a documented way to get the > _canonical_ answer about on wh

Re: recursive call boxing primitives?

2010-03-02 Thread Stuart Halloway
Hi John, You can get some speedup by using unboxed math in draw-tree (see below). What kind of speed difference are you seeing? Stu (import '(javax.swing JFrame JPanel ) '(java.awt Color Graphics Graphics2D)) (defn draw-tree [ #^Graphics g2d angle x y length branch-angle depth] (w

Re: Are there any plans for more allowed symbol characters?

2010-03-02 Thread Sean Devlin
While certainly legal unicode, it's a PITA with most western keyboards. I don't recommend straying far from ASCII-128 w/o a great, great, reason. Of course, someone from the east may disagree. On Mar 1, 5:24 pm, Joost wrote: > On 1 mrt, 23:02, Michael Wood wrote: > > > I don't know if the foll

Re: Are there any plans for more allowed symbol characters?

2010-03-02 Thread Mark Tomko
I agree with you in principle, but I suspect that the answer is deliberately delegated to Java's definition of letter or number. Mark On Mar 2, 3:17 am, Michael Wood wrote: > On 2 March 2010 00:24, Joost wrote: > > > On 1 mrt, 23:02, Michael Wood wrote: > >> I don't know if the following's "al

Obtaining Clojure version: JVM or CLR?

2010-03-02 Thread soyrochus
Hi there, I'm currently experimenting with ways to make a program portable across both Clojure and ClojureCLR (using IKVM). Currently there doesn't seem to be a documented way to get the _canonical_ answer about on which platform a program runs. The *clojure-version" var contains a map like {:int

Re: recursive call boxing primitives?

2010-03-02 Thread David Nolen
How are you measuring the difference between these two programs? What settings are you passing to the JVM when running the Clojure version? David On Mon, Mar 1, 2010 at 5:33 PM, John Lawrence Aspden wrote: > Hi, the other day I was at a conference in London and learned Scala. > > As my first pr

recursive call boxing primitives?

2010-03-02 Thread John Lawrence Aspden
Hi, the other day I was at a conference in London and learned Scala. As my first program I translated a favourite fractal tree program (which I stole from: http://marblemice.com/2009/04/26/clojure-fractal-tree/). The programs are almost exactly the same in the two languages. The Scala version see

Re: ANN: Fleet — templating system

2010-03-02 Thread Ilia Ablamonov
Despite I agree that writing code and markup in common ASP way is evil, I must argue that doing so or using provided abilities wisely is up to you. I see no reasons to divide (not so) complex display/ markup logic and e.g. HTML. But I see reason to have them together: fragility. When you're using