Re: Possible bug in proxy: NPE for unqualified class

2009-04-05 Thread Paul Drummond
2009/4/3 Rich Hickey : > Could you please submit an issue for that one? No problem: http://code.google.com/p/clojure/issues/detail?id=102 Thanks, Paul. -- Iode Software Ltd, registered in England No. 6299803. Registered Office Address: 12 Sancroft Drive, Houghton-le-Spring, Tyne & Wear, DH5 8N

Re: Possible bug in proxy: NPE for unqualified class

2009-04-03 Thread Rich Hickey
On Apr 3, 10:33 am, Paul Drummond wrote: > The following works - note ActionListener is fully qualified: > > - > user=> (.addActionListener (javax.swing.JButton.) > (proxy [java.awt.event.ActionListener] [] > (actionPerformed [evt] >

Possible bug in proxy: NPE for unqualified class

2009-04-03 Thread Paul Drummond
The following works - note ActionListener is fully qualified: - user=> (.addActionListener (javax.swing.JButton.) (proxy [java.awt.event.ActionListener] [] (actionPerformed [evt] (println "button press" nil -

Re: Possible Bug In clojure.zip/remove

2009-03-23 Thread Jason Sankey
Frantisek Sodomka wrote: > On Mar 19, 12:58 pm, Jason Sankey wrote: >> Also, is there somewhere I can contribute test cases for this to >> prevent a future regression? > > Tests for clojure.zip can from now on go to test-clojure.clojure-zip: > http://code.google.com/p/clojure-contrib/source/brow

Re: Possible Bug In clojure.zip/remove

2009-03-22 Thread Frantisek Sodomka
On Mar 19, 12:58 pm, Jason Sankey wrote: > Also, is there somewhere I can contribute test cases for this to > prevent a future regression? Tests for clojure.zip can from now on go to test-clojure.clojure-zip: http://code.google.com/p/clojure-contrib/source/browse/trunk/src/clojure/contrib/test_c

Re: Possible Bug In clojure.zip/remove

2009-03-20 Thread Jason Sankey
Hi Frantisek, Frantisek Sodomka wrote: > On Mar 19, 11:37 pm, Jason Sankey wrote: >> I pretty much have it working for the test-clojure suite now, although >> I'm sure the code could use review by a more experienced eye. I've been >> looking at adding the other two top-level suites (test-contri

Re: Possible Bug In clojure.zip/remove

2009-03-20 Thread Frantisek Sodomka
On Mar 19, 11:37 pm, Jason Sankey wrote: > I pretty much have it working for the test-clojure suite now, although > I'm sure the code could use review by a more experienced eye.  I've been > looking at adding the other two top-level suites (test-contrib and > datalog) too, but their test clojure

Re: Possible Bug In clojure.zip/remove

2009-03-19 Thread Jason Sankey
Hi Frantisek, Frantisek Sodomka wrote: > On Mar 19, 12:58 pm, Jason Sankey wrote: >> Also, is there somewhere I can contribute test cases for this to >> prevent a future regression? > > In order to contribute, you must fill-in and send The Contributor > Agreement (CA) to Rich Hickey: > http://c

Re: Possible Bug In clojure.zip/remove

2009-03-19 Thread Frantisek Sodomka
On Mar 19, 12:58 pm, Jason Sankey wrote: > Also, is there somewhere I can contribute test cases for this to > prevent a future regression? In order to contribute, you must fill-in and send The Contributor Agreement (CA) to Rich Hickey: http://clojure.org/contributing Tests for clojure.core are

Re: Possible Bug In clojure.zip/remove

2009-03-19 Thread Rich Hickey
On Mar 19, 7:22 am, Christophe Grand wrote: > Jason Sankey a écrit : > > > (if (and (branch? loc) (not (empty? (children loc > > (recur (-> loc down rightmost)) > > loc)) > > > Being new to both clojure and zip I admit there's still a good chance > > that I have no idea what I'm talking

Re: Possible Bug In clojure.zip/remove

2009-03-19 Thread Jason Sankey
Hi Christophe, On Mar 19, 11:22 am, Christophe Grand wrote: > Jason Sankey a écrit : > > > (if (and (branch? loc) (not (empty? (children loc > >   (recur (-> loc down rightmost)) > >   loc)) > > > Being new to both clojure and zip I admit there's still a good chance > > that I have no idea w

Re: Possible Bug In clojure.zip/remove

2009-03-19 Thread Christophe Grand
Jason Sankey a écrit : > (if (and (branch? loc) (not (empty? (children loc > (recur (-> loc down rightmost)) > loc)) > > Being new to both clojure and zip I admit there's still a good chance > that I have no idea what I'm talking about :). > No you are right and there's the same bug in

Possible Bug In clojure.zip/remove

2009-03-19 Thread Jason Sankey
Hi All, I've been teaching myself clojure and in the process am working on a small program to manipulate an XML file. I figured this was a good chance to try clojure.zip, but I'm having some difficulty. Being a newbie I strongly suspected myself - but when I posed the question on IRC the conclu

Re: Possible bug in sorted-set, question about comparisons

2009-02-20 Thread Frantisek Sodomka
Thanks for explanation, all! Frantisek On 20 Ún, 20:57, Jason Wolfe wrote: > It probably does an "identical?" call on a pair before calling > compare, for efficiency.  In other words, it may "work" on non- > comparable types, but only when passed n instances of the exact same > object: > > user

Re: Possible bug in sorted-set, question about comparisons

2009-02-20 Thread Jason Wolfe
It probably does an "identical?" call on a pair before calling compare, for efficiency. In other words, it may "work" on non- comparable types, but only when passed n instances of the exact same object: user> (sorted-set '(1) '(1)) ; Exception user> (let [x '(1)] (sorted-set x x)) #{(1)} This

Re: Possible bug in sorted-set, question about comparisons

2009-02-20 Thread Frantisek Sodomka
It looks that it is more complicated than that: user=> (sorted-set () ()) #{()} user=> (sorted-set {} {}) #{{}} user=> (sorted-set #{} #{}) #{#{}} Frantisek On 20 Ún, 20:33, Vincent Foley wrote: > I'm pretty sure that sorted-set works only with values that are > instances of a class that implem

Re: Possible bug in sorted-set, question about comparisons

2009-02-20 Thread Vincent Foley
I'm pretty sure that sorted-set works only with values that are instances of a class that implements Comparable. user=> (instance? Comparable []) true user=> (instance? Comparable {}) false user=> (instance? Comparable ()) false user=> On Feb 20, 2:21 pm, Frantisek Sodomka wrote: > sorted-set

Possible bug in sorted-set, question about comparisons

2009-02-20 Thread Frantisek Sodomka
sorted-set works for vectors, but doesn't work for lists, maps and sets: user=> (sorted-set [1 4]) #{[1 4]} user=> (sorted-set [1 4] [1 4]) #{[1 4]} user=> (sorted-set [4 1] [1 4]) #{[1 4] [4 1]} user=> (sorted-set '(1 4)) #{(1 4)} user=> (sorted-set '(1 4) '(1 4)) java.lang.ClassCastException: c

Possible bug? ExceptionInInitializerError

2009-02-19 Thread Jeffrey Chu
Hi, After updating to r1295, I'm hitting an error in swank-clojure I can't seem to fix. Here's a micro test: (ns jochu.micro-test) (defn deep-replace [smap coll] (map #(if (or (seq? %) (vector? %)) (deep-replace smap %) %) (replace smap coll))) (defn t-to-true [for

Possible bug, NullPointerException for undefined proxy interface or super-class

2009-02-15 Thread BerlinBrown
I don't know if this is expected, but I get a Nullpointerexception when I implement a proxy function and the 'interface' isn't 'imported'. For example, I was refactoring some code and didn't carry over the import and get this nullpointerexception error. Obviously, I should just add the import, b

Re: Possible bug in preduce

2009-02-04 Thread Anand Patil
On Feb 3, 11:09 pm, Rich Hickey wrote: > On Feb 3, 4:43 pm, Anand Patil > wrote: > No, it's not. as the docs for preduce say:http://clojure.org/api#preduce > > "Also note that (f base an-element) might be performed many times" > > in fact, an arbitrary number of times depending on how many pa

Re: Possible bug in preduce

2009-02-04 Thread Zak Wilson
I got a 50% speedup using psort instead of sort with a compute- intensive comparator and a 100 element sequence on a dual-core machine. That said, I found a faster way to do it: I separated the intensive calculations from the comparator - just returning a numeric value. I used pmap to get a seque

Re: possible bug with doto and function literals

2009-02-03 Thread Stephen C. Gilardi
On Feb 3, 2009, at 10:32 PM, kyle smith wrote: (map #(doto %1 (.add 2)) (doto (new java.util.ArrayList) (.add 1))) user=> (map #(doto %1 (.add 2)) (doto (new java.util.ArrayList) (.add 1))) java.lang.IllegalArgumentException: No matching method found: add for class java.lang.Integer T

possible bug with doto and function literals

2009-02-03 Thread kyle smith
(map #(doto %1 (.add 2)) (doto (new java.util.ArrayList) (.add 1))) This seems like it should work, but does not. Can anyone confirm? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this

Re: Possible bug in preduce

2009-02-03 Thread Mark Engelberg
A month or so ago, I installed the ForkJoin library, and played around with the clojure.parallel wrapper library, and I wasn't able to get a single test to show a speed improvement on my dual core machine. In contrast, pmap, which doesn't rely on the ForkJoin library, works just fine. It makes m

Re: Possible bug in preduce

2009-02-03 Thread Rich Hickey
On Feb 3, 4:43 pm, Anand Patil wrote: > Hi all, > > Messing around with preduce at the REPL I saw this: > > user=> (defn q [sofar new] (do (print new sofar"\n") (+ (+ 1 new) > sofar))) > #'user/q > user=> (reduce q 0 [1 2 > 3]) > 1 0 > 2 2 > 3 5 > 9 > user=> (preduce q 0 [1 2 > 3]) > 3 2 > 6 1

Possible bug in preduce

2009-02-03 Thread Anand Patil
Hi all, Messing around with preduce at the REPL I saw this: user=> (defn q [sofar new] (do (print new sofar"\n") (+ (+ 1 new) sofar))) #'user/q user=> (reduce q 0 [1 2 3]) 1 0 2 2 3 5 9 user=> (preduce q 0 [1 2 3]) 3 2 6 1 8 It looks like preduce takes its arguments in the opposite order from r

Re: test-is possible bug in are

2008-12-19 Thread Mark Volkmann
On Thu, Dec 18, 2008 at 9:08 PM, Stuart Sierra wrote: > > On Dec 18, 6:05 pm, "Mark Volkmann" wrote: >> If I understand correctly, >> >> (are (< 1 2, 5 7)) >> >> is equivalent to >> >> (is (< 1 2)) >> (is (< 5 7)) > > Not exactly. The first argument to "are" is a template expression, > which is

Re: test-is possible bug in are

2008-12-18 Thread Stuart Sierra
On Dec 18, 6:05 pm, "Mark Volkmann" wrote: > If I understand correctly, > > (are (< 1 2, 5 7)) > > is equivalent to > > (is (< 1 2)) > (is (< 5 7)) Not exactly. The first argument to "are" is a template expression, which is sort of like #(). The arguments to the template are symbols named "_1"

test-is possible bug in are

2008-12-18 Thread Mark Volkmann
If I understand correctly, (are (< 1 2, 5 7)) is equivalent to (is (< 1 2)) (is (< 5 7)) The following may be incorrect usage of are: (are < 1 2, 5 7) However, instead of complaining about the arguments, it hangs forever. -- R. Mark Volkmann Object Computing, Inc. --~--~-~--~~

Re: possible bug with seq and Enumeration?

2008-12-15 Thread Brian Doyle
Using enumeration-seq does the trick! Thanks. user=> (enumeration-seq (.entries (java.util.zip.ZipFile. ""))) On Mon, Dec 15, 2008 at 5:14 PM, Rich Hickey wrote: > > > > On Dec 15, 6:01 pm, "Brian Doyle" wrote: > > According to the docs the seq function should be able to take an > > enumerati

Re: possible bug with seq and Enumeration?

2008-12-15 Thread Rich Hickey
On Dec 15, 6:01 pm, "Brian Doyle" wrote: > According to the docs the seq function should be able to take an > enumeration, > but here is what I see: > > user=> (seq (.elements (doto (java.util.Vector.) (.add "hello") (.add > "world" > java.lang.IllegalArgumentException: Don't know how to cr

possible bug with seq and Enumeration?

2008-12-15 Thread Brian Doyle
According to the docs the seq function should be able to take an enumeration, but here is what I see: user=> (seq (.elements (doto (java.util.Vector.) (.add "hello") (.add "world" java.lang.IllegalArgumentException: Don't know how to create ISeq from: (NO_SOURCE_FILE:0) SVN 1160, thanks. --

Re: Possible bug? StringIndexOutOfBoundException

2008-11-20 Thread Rich Hickey
On Nov 20, 12:37 pm, Feng <[EMAIL PROTECTED]> wrote: > I start getting StringIndexOutOfBoundException since svn rev 1113 (use > source name in smap). Fixed - rev 1120 - thanks for the report. Rich --~--~-~--~~~---~--~~ You received this message because you are s

Possible bug? StringIndexOutOfBoundException

2008-11-20 Thread Feng
I start getting StringIndexOutOfBoundException since svn rev 1113 (use source name in smap). Though I'm not sure if this a bug in clojure or in user code, it appears that SOURCE var always have a root bound "NO_SOURCE_FILE". Shouldn't below code check against that, instead of just null? Index: sr

Re: Possible bug with accessing child classes

2008-09-24 Thread James Reeves
On Sep 24, 9:33 pm, ".Bill Smith" <[EMAIL PROTECTED]> wrote: > Try this: > > user=> (import '(java.util Map$Entry)) > nil > user=> Map$Entry > java.util.Map$Entry > user=> Perfect! Thanks! - James --~--~-~--~~~---~--~~ You received this message because you are sub

Re: Possible bug with accessing child classes

2008-09-24 Thread .Bill Smith
James, Try this: user=> (import '(java.util Map$Entry)) nil user=> Map$Entry java.util.Map$Entry user=> Bill --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to cl

Possible bug with accessing child classes

2008-09-24 Thread James Reeves
I'm having some problems accessing child classes in the latest release of Clojure: user=> (import '(java.util Map)) nil user=> Map java.util.Map user=> Map.Entry java.lang.ClassNotFoundException: Map.Entry user=> (import '(java.util.Map Entry)) java.lang.ClassNotFoundException: java.util.Map.Entr

<    1   2