Add JNDI lookup support for contrib/sql

2009-05-09 Thread Mark Derricutt
Hi, Can we add the following to contrib's sql namespace, it simply adds jndi as a db-spec scheme ( I also raised this as http://code.google.com/p/clojure-contrib/issues/detail?id=39 , which google decided to set as a defect and I can't change): Index: src/clojure/contrib/sql/internal.clj

Re: partition improvement

2009-05-09 Thread Jason Wolfe
See also partition-all in clojure.contrib.seq-utils. It isn't as feature-complete as your version, but is instead a drop-in replacement for partition that always returns the final part (regardless of whether or not it's long enough). -Jason On May 8, 4:02 pm, DiG

Re: Launching apps

2009-05-09 Thread Baishampayan Ghose
Chris Dean wrote: For now I'm using hand written scripts that launch under screen. And that works for us. Would be great if you share those scripts with us. Regards, BG -- Baishampayan Ghose b.gh...@ocricket.com oCricket.com signature.asc Description: OpenPGP digital signature

Re: Using Map

2009-05-09 Thread Emeka
From what you say I imagine you have something like a matrix or table, something with rows and columns that form cells. And you want to be able to grab the contents of one cell and move it around to another cell. Andre, that statement captures all I intend to achieve. This is what I wanted to

Re: Can for be enhanced to not have to take a binding?

2009-05-09 Thread Mark Reid
Hi Laurent, Thanks for the feedback. I'm still a bit stuck though since neither my proposal nor yours work for the type of application I had in mind. Here's a complete program which highlights the problems: ; Begin lazyread.clj (import '(java.io FileReader BufferedReader

Re: Using a monad's m-plus function inside a macro

2009-05-09 Thread Konrad Hinsen
On 09.05.2009, at 03:50, samppi wrote: I'm trying to use m-plus inside a macro like this: (defmacro alt [ subrules] (with-monad parser-m `(fn [state#] ((m-plus ~...@subrules) state# Unfortunately, I get the error: No such var: my-namespace.fnparse/m-plus

Re: Add JNDI lookup support for contrib/sql

2009-05-09 Thread Sean Devlin
+1 On May 9, 2:33 am, Mark Derricutt m...@talios.com wrote: Hi, Can we add the following to contrib's sql namespace, it simply adds jndi as a db-spec scheme ( I also raised this ashttp://code.google.com/p/clojure-contrib/issues/detail?id=39, which google decided to set as a defect and I

Re: AIML pattern matcher design

2009-05-09 Thread dhs827
I'm completely engulfed in all this material, but I wanted to come back and say that I'm stunned by the enthusiasm with which you share your knowledge here. Many thanks, again. Dirk Parth Malwankar schrieb: On Fri, 08 May 2009 22:20:13 +0530, dhs827 scheur...@gmail.com wrote: ; First

Interfaces : not fully implemented in clojure?

2009-05-09 Thread Julien
Hello all, A quick newbie question about getting hold of an object implementing interface from the Java sound API. The static method AudioSystem/getSourceDataLine returns an object implementing the SourceDataLine interface. But the returned object in clojure doesn't seem to fully implement the

Re: Launching apps

2009-05-09 Thread Stuart Sierra
On May 8, 6:30 pm, Chris Dean ctd...@sokitomi.com wrote: How do folks launch their apps? Shell scripts, calling AOT-compiled classes (gen-class with a -main function). -Stuart Sierra --~--~-~--~~~---~--~~ You received this message because you are subscribed to

Re: CL libraries - Newbie question

2009-05-09 Thread Stuart Sierra
On May 8, 7:17 pm, André Thieme splendidl...@googlemail.com wrote: In principle you could run Clojure and ABCL inside the same VM. http://common-lisp.net/project/armedbear/ That sounds like a nightmare. You still couldn't call a CL function directly from Clojure without some Java in

Re: Interfaces : not fully implemented in clojure?

2009-05-09 Thread Rich Hickey
On May 9, 11:58 am, Julien julien.ma...@gmail.com wrote: Hello all, A quick newbie question about getting hold of an object implementing interface from the Java sound API. The static method AudioSystem/getSourceDataLine returns an object implementing the SourceDataLine interface. But the

Re: Can for be enhanced to not have to take a binding?

2009-05-09 Thread Meikel Brandmeyer
Hi, Am 09.05.2009 um 13:06 schrieb Mark Reid: ; Begin lazyread.clj (import '(java.io FileReader BufferedReader PrintWriter)) (def filename test.data) ; Write out a small test file. Numbers 0 to 99, one per line. (with-open [data (PrintWriter. filename)] (dotimes [i 100] (.println

Re: Interfaces : not fully implemented in clojure?

2009-05-09 Thread Julien
Thank you Rich for answering, I appreciate your expertise. It's always best to post a complete example - it makes it easier for people to help you, e.g. ;audioFormat is defined above just leaves me having to figure out how to make one in order to reproduce your problem. Use of camelCase in

Re: Feedback on new persistentmatrix datatype

2009-05-09 Thread aperotte
Hey Anand, Thanks for the feedback! I would have liked to call the arrays arrays but java's arrays make that name less than ideal. If people think a better name for the library is persistentarray, I'm not opposed to changing (especially this early in the game). It shouldn't be a problem to

Re: Feedback on new persistentmatrix datatype

2009-05-09 Thread aperotte
Thanks Adrian, I have looked at the clojure.set library, but haven't thought about it significantly with respect to the matrix library. Thanks for the heads up. -Adler On May 6, 11:17 pm, Adrian Cuthbertson adrian.cuthbert...@gmail.com wrote: If you haven't seen it yet, the set module

Re: Using a monad's m-plus function inside a macro

2009-05-09 Thread samppi
Wow, I've never seen ~' before. But it works great. Thanks a lot. On May 9, 5:41 am, Konrad Hinsen konrad.hin...@laposte.net wrote: On 09.05.2009, at 03:50, samppi wrote: I'm trying to use m-plus inside a macro like this:   (defmacro alt     [ subrules]     (with-monad parser-m      

Re: Can for be enhanced to not have to take a binding?

2009-05-09 Thread Laurent PETIT
Hi, the version of repeatedly-while I submitted still takes an argument for the predicate function, that would be the value of the last generated item in the list: (defn repeatedly-while [pred f] (take-while pred (repeatedly f))) So if you want to call it with a no-arg predicate, you must

Re: Concerns About Pushing Clojure 1.0.0 to Maven Central Repo?

2009-05-09 Thread Stefan Hübner
On 9 Mai, 17:08, Howard Lewis Ship hls...@gmail.com wrote: clojure-lang because there will be a clojure-contrib artifact for the same group. It didn't occur to me yet, that having clojure-contrib in the same group would render org.clojure:clojure a bad choice as groupId:artifactId for clojure

Re: Concerns About Pushing Clojure 1.0.0 to Maven Central Repo?

2009-05-09 Thread Stefan Hübner
On 8 Mai, 01:39, Laurent PETIT laurent.pe...@gmail.com wrote: note that clojure must be compatible with JDK 1.5, so if you compile with 1.6, maybe you should verify the compatibility mode (not sure if what I write here makes sense, I'm not a specialist in javac retrocompatibility concerns).

Re: Launching apps

2009-05-09 Thread Richard Newman
The problem (such as it is) with these solutions is that you still need to do something to attach to a repl.   A repl is a requirement for us. I've done the screen thing in the past. It works fine, though I have (very rarely) encountered issues with screen locking up or dying a few times over

Re: Method overloading proxy method

2009-05-09 Thread ronen
Well the solution in my case was to create a map from visited types to visited members (http://tinyurl.com/poq5e2) the visitation logic uses this map in order to invoke the next visit (http://tinyurl.com/ pkugra). This pattern enables visitors to be implemented in Clojure for pure Java based

java faster than clojure?(probably not)

2009-05-09 Thread Julien
I'm interested to do audio synthesis and eventually audio DSP on the JVM using the Java sound API and I think that it could be fun to do that following the functional programming paradigm. I don't intend to build a huge library but just to try some experiment on my own to better understand how

Re: java faster than clojure?(probably not)

2009-05-09 Thread David Nolen
I would set your *warn-on-reflection* flag of course to see if you're missing out on any type hinting. Also watch out for math ops that involve more than 2 arguments: ;; takes ~400ms on my machine (time (dotimes [x 100] (* 1 2 3))) ;; takes ~50ms on my machine (time (dotimes [x 100] (* 1

Re: java faster than clojure?(probably not)

2009-05-09 Thread David Nolen
Also type hinting your math ops like mad on tight loops helps: ;; ~20ms (time (dotimes [x 100] (* (float 1.0) (* (float 2.0) (float 3.0) ;; ~65ms (time (dotimes [x 100] (* 1.0 (* 2.0 3.0 Another 3x increase. On May 9, 6:53 pm, Julien julien.ma...@gmail.com

Re: java faster than clojure?(probably not)

2009-05-09 Thread Julien
Out of curiosity, how long does that function take to execute in Java? The java version is much faster even with much more work to do, which put me perplex. I didn't check how much it takes, must be about 100ms. Thx for the tips, though that doesn't really improve anything. My guess is that

Re: cloggle: OpenGL library for Clojure

2009-05-09 Thread David Nolen
Cool, I couldn't get this to work, I get an exception like the following: Exception in thread AWT-EventQueue-0 java.lang.IllegalArgumentException: wrong number of arguments The original version works alright for me. Also you should organize the library folder in the standard way so that your

Re: java faster than clojure?(probably not)

2009-05-09 Thread David Nolen
What's a sample set of values you would pass to this function? On Sat, May 9, 2009 at 7:35 PM, Julien julien.ma...@gmail.com wrote: Out of curiosity, how long does that function take to execute in Java? The java version is much faster even with much more work to do, which put me perplex.

clojure.contrib.pprint.PrettyWriter ClassNotFoundException

2009-05-09 Thread Aaron Feng
When I tried to import PrettyWriter from clojure-contrib I'm getting java.lang.ClassNotFoundException. Am I missing something? Thanks, Aaron --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Clojure group. To post to

Re: java faster than clojure?(probably not)

2009-05-09 Thread Stuart Sierra
One comment, although this has no effect on performance: you don't need to use the static class fields as functions. That is, you can write Math/PI and Short/MAX_VALUE instead of (Math/PI) and (Short/ MAX_VALUE). -Stuart Sierra On May 9, 6:53 pm, Julien julien.ma...@gmail.com wrote: I'm

Re: java faster than clojure?(probably not)

2009-05-09 Thread David Nolen
(set! *warn-on-reflection* true) (defn byte-array-sound [frequency sample-rate nb-frame] (let [sample-array (make-array (. Byte TYPE) (* nb-frame 2)) sample-interval (/ (float frequency) (float sample-rate)) limit (alength sample-array)] (loop [sample-index 0 impulse-train (float 0)]

Re: clojure.contrib.pprint.PrettyWriter ClassNotFoundException

2009-05-09 Thread Stuart Sierra
The pretty-printer requires clojure-contrib to be compiled with ant - Dclojure.jar=... You may be missing that. -SS On May 9, 8:25 pm, Aaron Feng aaron.f...@gmail.com wrote: When I tried to import PrettyWriter from clojure-contrib I'm getting java.lang.ClassNotFoundException.  Am I missing

Re: Concerns About Pushing Clojure 1.0.0 to Maven Central Repo?

2009-05-09 Thread Laurent PETIT
2009/5/9 Stefan Hübner sthueb...@googlemail.com On 8 Mai, 01:39, Laurent PETIT laurent.pe...@gmail.com wrote: note that clojure must be compatible with JDK 1.5, so if you compile with 1.6, maybe you should verify the compatibility mode (not sure if what I write here makes sense, I'm not a

Re: Can for be enhanced to not have to take a binding?

2009-05-09 Thread Mark Reid
Hi Meikel, On May 10, 3:05 am, Meikel Brandmeyer m...@kotka.de wrote: There is a mistake in this function: pred should be (pred) as well as f should be (f). Furthermore I would call it repeatedly-while. (defn repeatedly-while    [pref f]    (lazy-seq      (when (pred)        (cons (f)

Re: Can for be enhanced to not have to take a binding?

2009-05-09 Thread Mark Reid
Hi Laurent, On May 10, 5:15 am, Laurent PETIT laurent.pe...@gmail.com wrote: So if you want to call it with a no-arg predicate, you must adapt it : (repeatedly-while (fn [ _ ] (no-arg-pred)) f) instead of (repeatedly-while no-arg-pred f) I think that this is too convoluted a calling

Re: Concerns About Pushing Clojure 1.0.0 to Maven Central Repo?

2009-05-09 Thread Laurent PETIT
2009/5/10 Laurent PETIT laurent.pe...@gmail.com 2009/5/9 Stefan Hübner sthueb...@googlemail.com On 8 Mai, 01:39, Laurent PETIT laurent.pe...@gmail.com wrote: note that clojure must be compatible with JDK 1.5, so if you compile with 1.6, maybe you should verify the compatibility mode (not

Re: Can for be enhanced to not have to take a binding?

2009-05-09 Thread Laurent PETIT
2009/5/10 Mark Reid mark.r...@gmail.com Hi Laurent, On May 10, 5:15 am, Laurent PETIT laurent.pe...@gmail.com wrote: So if you want to call it with a no-arg predicate, you must adapt it : (repeatedly-while (fn [ _ ] (no-arg-pred)) f) instead of (repeatedly-while no-arg-pred f) I