Re: tests involving threads

2009-07-06 Thread Timothy Pratley
Thanks for the reply Jarkko, Yes I can work around it. The scenario is that I want to see a message correctly passed: http://github.com/timothypratley/strive/blob/cef5a3a9ea18159f866fe6c94603b704daba1ba8/clj/timothypratley/test-messenger.clj It is useful (tempting?) in this case to be able to che

Re: Penumbra, a new set of OpenGL bindings

2009-07-06 Thread Glen Stampoultzis
2009/7/1 ztellman > > 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 > http://github.com/ztellman/penumbra/t

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.

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 b

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

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 wrote: > > I've just figured out that the macro version in the allocate example > ca

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 wrote: > So a common counter to "the VM startup

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 Date: Mon, 1 Jun 2009 19:18:11 -0400 Subject: [PATCH] cloju

Re: loneclojurian at ICFP programming contest

2009-07-06 Thread Bradbev
On Jul 6, 4:30 pm, fft1976 wrote: > On Jul 5, 11:42 pm, Bradbev 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

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 wrote: > Hi, I needed

Re: loneclojurian at ICFP programming contest

2009-07-06 Thread fft1976
On Jul 5, 11:42 pm, Bradbev 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 strongly on the kind of pro

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.

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

Re: Mysterious ClassFormatError after simple code change.

2009-07-06 Thread John Harrop
On Mon, Jul 6, 2009 at 3:58 PM, Emeka 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 (subexpressions-of-p

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 t

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 ByteBu

Re: Is this unquote dangerous?

2009-07-06 Thread Chouser
On Mon, Jul 6, 2009 at 4:18 PM, Meikel Brandmeyer 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 --~--~--

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 3:47 PM, Sean Devlin 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 list, not trying to exec

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 : > > 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 Hagelberg wrote: > > That's right. Side note to folks with commit access: it would be a good > > idea to check in a note to the d

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 stupi

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 wrote: > Newbie question here.  Probably answered in Stu's book, but I forgot > it at home

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 O

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

2009-07-06 Thread Stuart Halloway
I strongly recommend using grb (http://grb.rubyforge.org/) as a wrapper for remote-branch-related stuff. It provides a convenient terminal API, and will tell you the git commands it is using under the hood. Stu > So I guess my unstated question is this: what is the GIT incantation > to get

Re: Mysterious ClassFormatError after simple code change.

2009-07-06 Thread John Harrop
On Mon, Jul 6, 2009 at 8:53 AM, Chouser wrote: > > On Sun, Jul 5, 2009 at 3:51 PM, John Harrop 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 th

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: Confusion on Clojure 1.0, compatible clojure-contrib, git-hub, svn, ...

2009-07-06 Thread Mike Hinchey
After you do the git clone, cd into clojure, then: git checkout remotes/origin/1.0 For clojure-contrib: git checkout remotes/origin/clojure-1.0-compatible -Mike --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojur

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 Hagelberg 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

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 Hagelberg 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, better, do away

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 s

Re: [PATCH Emacs/swank-clojure] Add apropos-list-for-emacs

2009-07-06 Thread Phil Hagelberg
Takeshi Banse writes: > I Takeshi Banse live in Japan, have been teaching myself Clojure and in the > process have a patch to the swank-clojure I'd like to make. > > With this patch, I can happily `M-x slime-apropos' within Emacs/SLIME. > > Hope this helps. Thanks. Thanks! This is really helpfu

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

2009-07-06 Thread Phil Hagelberg
Tom Emerson 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 check in a note to th

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 GoogleCode

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 t

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: Add apropos-list-for-emacs

2009-07-06 Thread JLR
On Jul 2, 7:46 am, Takeshi Banse 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. Thanks. >

Re: Mysterious ClassFormatError after simple code change.

2009-07-06 Thread Chouser
On Sun, Jul 5, 2009 at 3:51 PM, John Harrop 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 on the return valu

Re: Adding type hint causes compiler error

2009-07-06 Thread philip.hazel...@gmail.com
On Jul 6, 12:25 pm, Jarkko Oranen 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 Groups "Clojure" gr

Re: Adding type hint causes compiler error

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

Re: Adding type hint causes compiler error

2009-07-06 Thread philip.hazel...@gmail.com
On Jul 5, 10:31 pm, Mark Triggs 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 still generates a s

Re: tests involving threads

2009-07-06 Thread Jarkko Oranen
On Jul 6, 7:51 am, Timothy Pratley 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: > > test-test.clj: > (