Re: tests involving threads

2009-07-06 Thread Jarkko Oranen
On Jul 6, 7:51 am, Timothy Pratley timothyprat...@gmail.com wrote: 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:

Re: Adding type hint causes compiler error

2009-07-06 Thread philip.hazel...@gmail.com
On Jul 5, 10:31 pm, Mark Triggs mark.h.tri...@gmail.com wrote: (defn bi-get-pixels   [#^BufferedImage bi]   (let [raster (.getData bi)         pixels (.getPixels raster 0 0 (.getWidth bi) (.getHeight bi)                            (cast (Class/forName [I) nil))]     (vec pixels))) This

Re: Adding type hint causes compiler error

2009-07-06 Thread Jarkko Oranen
On Jul 6, 1:26 pm, philip.hazel...@gmail.com philip.hazel...@gmail.com wrote: On Jul 5, 10:31 pm, Mark Triggs mark.h.tri...@gmail.com wrote: (defn bi-get-pixels   [#^BufferedImage bi]   (let [raster (.getData bi)         pixels (.getPixels raster 0 0 (.getWidth bi) (.getHeight bi)  

Re: Adding type hint causes compiler error

2009-07-06 Thread philip.hazel...@gmail.com
On Jul 6, 12:25 pm, Jarkko Oranen chous...@gmail.com wrote: (ints nil) might also work It does indeed. This seems to be as good a solution as could be hoped for, thank you. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google

Re: Mysterious ClassFormatError after simple code change.

2009-07-06 Thread Chouser
On Sun, Jul 5, 2009 at 3:51 PM, John Harropjharrop...@gmail.com wrote: This is frankly quite baffling. The changes to the function are innocent from a large-literal or pretty much any other perspective. Both your functions load fine for me without the rest of your code. Are there type hints

Re: Add apropos-list-for-emacs

2009-07-06 Thread JLR
On Jul 2, 7:46 am, Takeshi Banse tak...@laafc.net wrote: Hi all, I Takeshi Banse live in Japan, have been teaching myself Clojure and in the process have a patch to theswank-clojure I'd like to make. With this patch, I can happily `M-x slime-apropos' within Emacs/SLIME. Hope this helps.

Flag spam in files?

2009-07-06 Thread Sean Devlin
Hey everyone, I've noticed on several occasions there's spam in the file section (like right now. e.g. SexyBabe.html). What's the preferred approach to handle this: 1. Ignore it 2. Mention it on this list 3. Use a system for tagging files as spam 4. Some other idea?

Re: Displaying Clojure code on a Website

2009-07-06 Thread Kai
Hi Rick, I think we've both encountered the same concerns with coding style in Clojure. I can't really say which is better - a large list of conditions or a mutually recursive implementation. I have a feeling that it depends on your fluency in functional languages. For me, I'm relatively new to

Confusion on Clojure 1.0, compatible clojure-contrib, git-hub, svn, ...

2009-07-06 Thread Tom Emerson
Hi all, I've been away from Clojure for a while (I was side tracked about a month before 1.0 was released) and now that I'm back I'm completely confused. Clojure and Clojure-Contrib have both moved to git and are hosted on git-hub, right? Is it then the case that the SVN repository on

Re: Confusion on Clojure 1.0, compatible clojure-contrib, git-hub, svn, ...

2009-07-06 Thread Phil Hagelberg
Tom Emerson tremer...@gmail.com writes: Clojure and Clojure-Contrib have both moved to git and are hosted on git-hub, right? Is it then the case that the SVN repository on GoogleCode is no longer being used? That's right. Side note to folks with commit access: it would be a good idea to

Re: print-base / print-radix?

2009-07-06 Thread Tom Faulhaber
OK, as of clojure-contrib commit 0d29198..., *print-base* and *print- radix* are fully supported for the various integer classes and ratios in cl-format, write, and pprint. e.g.: (binding [*print-base* 2, *print-radix* true] (pprint (range 4))) = (#b0 #b1 #b10 #b11) Please let me know if you

Re: Confusion on Clojure 1.0, compatible clojure-contrib, git-hub, svn, ...

2009-07-06 Thread Tom Emerson
Thanks Paul, for the quick response. On Mon, Jul 6, 2009 at 12:56 PM, Phil Hagelbergp...@hagelb.org wrote: That's right. Side note to folks with commit access: it would be a good idea to check in a note to the deprecated repositories telling people where to go for the latest versions. Or,

Re: Confusion on Clojure 1.0, compatible clojure-contrib, git-hub, svn, ...

2009-07-06 Thread Stephen C. Gilardi
On Jul 6, 2009, at 3:13 PM, Tom Emerson wrote: Thanks Paul, for the quick response. On Mon, Jul 6, 2009 at 12:56 PM, Phil Hagelbergp...@hagelb.org wrote: That's right. Side note to folks with commit access: it would be a good idea to check in a note to the deprecated repositories telling

Is this unquote dangerous?

2009-07-06 Thread Mike
Newbie question here. Probably answered in Stu's book, but I forgot it at home today. is: (for [x [1 2 3]] `(some-symbol ~x)) dangerous? I mean, assuming that some-symbol is bound and all. At the REPL I get ((user/some-symbol 1) (user/some-symbol 2) (user/some-symbol 3)) which is what I'm

Re: Mysterious ClassFormatError after simple code change.

2009-07-06 Thread John Harrop
On Mon, Jul 6, 2009 at 8:53 AM, Chouser chou...@gmail.com wrote: On Sun, Jul 5, 2009 at 3:51 PM, John Harropjharrop...@gmail.com wrote: This is frankly quite baffling. The changes to the function are innocent from a large-literal or pretty much any other perspective. Both your functions

Re: Confusion on Clojure 1.0, compatible clojure-contrib, git-hub, svn, ...

2009-07-06 Thread Tom Emerson
Thanks Stu, Mike, and Stephen for your responses: I appreciate the help. @Stephen, these are all horses not worth kicking any further. Thanks for the git links. @Stu, I'll take that under advisement, but I'm not going to install ruby for that one tool... yet. :) Thanks again guys, -tree

Re: Is this unquote dangerous?

2009-07-06 Thread Sean Devlin
I think your unquote is okay. ClojureQL does something similar. However, my gut says this should be in a doseq, not a for statement. Could be totally wrong, tough. My $.02 Sean On Jul 6, 2:39 pm, Mike cki...@gmail.com wrote: Newbie question here.  Probably answered in Stu's book, but I

Re: Mysterious ClassFormatError after simple code change.

2009-07-06 Thread Emeka
(defn- subexpressions-of-sum** [[n p] terms] (let-print [sum (cons '+ (map #(factor-term % n p) terms)) prod (rest (make-product* n p))] (cons sum (map #(cons '* (cons sum (rest %))) (concat prod (subexpressions-of-product prod)) I look at the above, and something

Re: Confusion on Clojure 1.0, compatible clojure-contrib, git-hub, svn, ...

2009-07-06 Thread Laurent PETIT
Hi, 2009/7/6 Stephen C. Gilardi squee...@mac.com: On Jul 6, 2009, at 3:13 PM, Tom Emerson wrote: Thanks Paul, for the quick response. On Mon, Jul 6, 2009 at 12:56 PM, Phil Hagelbergp...@hagelb.org wrote: That's right. Side note to folks with commit access: it would be a good idea to

Re: Is this unquote dangerous?

2009-07-06 Thread Chouser
On Mon, Jul 6, 2009 at 3:47 PM, Sean Devlinfrancoisdev...@gmail.com wrote: I think your unquote is okay.  ClojureQL does something similar. However, my gut says this should be in a doseq, not a for statement. Could be totally wrong, tough. I think the OP is trying to build and return a

Re: Is this unquote dangerous?

2009-07-06 Thread Meikel Brandmeyer
Hi, Am 06.07.2009 um 22:00 schrieb Chouser: Or if you really do need a list: (for [x [1 2 3]] (cons 'some-symbol (list x))) o.O *cough*(list 'some-symbol x)*cough* ;) Sincerely Meikel smime.p7s Description: S/MIME cryptographic signature

Re: Is this unquote dangerous?

2009-07-06 Thread Chouser
On Mon, Jul 6, 2009 at 4:18 PM, Meikel Brandmeyerm...@kotka.de wrote: Hi, Am 06.07.2009 um 22:00 schrieb Chouser: Or if you really do need a list:  (for [x [1 2 3]] (cons 'some-symbol (list x))) o.O *cough*(list 'some-symbol x)*cough* ;) Oh. Right. What he said. --Chouser

Calling static methods on a variable holding a class

2009-07-06 Thread Nicolas Buduroi
Hi, I needed to call a static method on a class stored in a var yesterday and found that it was a little bit trickier than I initially thought. There's three way of doing it, the two first are quite straightforward and working ;-) e.g.: (import '(java.nio ByteBuffer FloatBuffer)) (def foo

Re: Is this unquote dangerous?

2009-07-06 Thread John Harrop
Or if you really do need a list: (for [x [1 2 3]] (cons 'some-symbol (list x))) Why not (for [x [1 2 3]] (list 'some-symbol x)) ? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Clojure group. To post to this

Re: Mysterious ClassFormatError after simple code change.

2009-07-06 Thread John Harrop
On Mon, Jul 6, 2009 at 3:58 PM, Emeka emekami...@gmail.com wrote: (defn- subexpressions-of-sum** [[n p] terms] (let-print [sum (cons '+ (map #(factor-term % n p) terms)) prod (rest (make-product* n p))] (cons sum (map #(cons '* (cons sum (rest %))) (concat prod

Re: Mysterious ClassFormatError after simple code change.

2009-07-06 Thread Richard Newman
Since it's not apparently a simple bug in my function above, but something about a combination of that version of that function and some other part of my code, I can't think of a way to track the cause down short of the very tedious method of commenting out functions or replacing

I/O in Nailgun

2009-07-06 Thread Phil Hagelberg
So a common counter to the VM startup time is so bad problem is to use Nailgun for a long-running server process. I've gotten this working in some respects, but I get a Unexpected chunk type 83 ('S') error quite often when I'm trying to read from the stdin that the nailgun context provides. (ns

Re: loneclojurian at ICFP programming contest

2009-07-06 Thread fft1976
On Jul 5, 11:42 pm, Bradbev brad.beveri...@gmail.com wrote: more to modern x86 chips.  After you have the best algorithm for the job, you very quickly find that going fast is entirely bound by memory speed (actually latency) - cache misses are the enemy. IME (outside JVM), this depends

Re: Calling static methods on a variable holding a class

2009-07-06 Thread Nicolas Buduroi
I've just figured out that the macro version in the allocate example can't be used with local variables. (let [foo ByteBuffer] (allocate1 foo 1024)) throws java.lang.UnsupportedOperationException: Can't eval locals (NO_SOURCE_FILE:94) On Jul 6, 6:59 pm, Nicolas Buduroi nbudu...@gmail.com

Re: loneclojurian at ICFP programming contest

2009-07-06 Thread Bradbev
On Jul 6, 4:30 pm, fft1976 fft1...@gmail.com wrote: On Jul 5, 11:42 pm, Bradbev brad.beveri...@gmail.com wrote: more to modern x86 chips.  After you have the best algorithm for the job, you very quickly find that going fast is entirely bound by memory speed (actually latency) - cache

swank-clojure bug fix

2009-07-06 Thread Sudish Joseph
Hi, The patch below fixes the computation of swank-version, which broke when (clojure-version) was defined to returned a string. The bug only manifests itself if swank-clojure-compile-p is set to t. -Sudish Joseph From: Sudish Joseph sud...@gmail.com Date: Mon, 1 Jun 2009 19:18:11 -0400

Re: I/O in Nailgun

2009-07-06 Thread George Jahad
Hey Phil: I think it is just an input stream encoding problem. I think if you change this line: (copy (- context .in) out) to this: (copy (- context .in InputStreamReader.) out) it will work. George On Jul 6, 5:06 pm, Phil Hagelberg p...@hagelb.org wrote: So a common counter to the

Re: Calling static methods on a variable holding a class

2009-07-06 Thread Adrian Cuthbertson
You can call the static method directly on the class name; (java.nio.ByteBuffer/allocate 1024) or just (ByteBuffer/allocat 1024) if it's imported. Rgds, Adrian. On Tue, Jul 7, 2009 at 2:16 AM, Nicolas Buduroi nbudu...@gmail.com wrote: I've just figured out that the macro version in the

Re: Calling static methods on a variable holding a class

2009-07-06 Thread Adrian Cuthbertson
Hi Nicolas, sorry, that last post missed the second part, I meant to add; If you know the method you wish to call, do you not know the class and can thus call the static method directly? -Adrian. On Tue, Jul 7, 2009 at 5:21 AM, Adrian Cuthbertson adrian.cuthbert...@gmail.com wrote: You can

procedural docstring attachment

2009-07-06 Thread Timothy Pratley
I have a function that relies on a keyword being supplied. The keyword is used to find something in a static map. I want to put in the doc- string: (str blah blah blah, arg1 must be one of (keys map)) Suggestions? --~--~-~--~~~---~--~~ You received this message

Re: procedural docstring attachment

2009-07-06 Thread Richard Newman
I have a function that relies on a keyword being supplied. The keyword is used to find something in a static map. I want to put in the doc- string: (str blah blah blah, arg1 must be one of (keys map)) Suggestions? You'd need to generate a suitable function definition using a macro. E.g.,

Re: Penumbra, a new set of OpenGL bindings

2009-07-06 Thread Glen Stampoultzis
2009/7/1 ztellman ztell...@gmail.com Most of the OpenGL code I've seen has been a fairly literal translation of the corresponding Java, so as a way of getting my feet wet in Clojure I've written something that tries to be a little more idiomatic. It can be found at