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

2009-05-09 Thread Meikel Brandmeyer
Hi Mark, Am 10.05.2009 um 07:00 schrieb Mark Reid: So the extra parentheses are there to force the evaluation of the predicate and function? Well. The don't "force" the evaluation. They just call the provided function. "pred" evaluates to a function. In our example #(.ready reader). "(pred)

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

2009-05-09 Thread Meikel Brandmeyer
Hi Laurent, Am 10.05.2009 um 07:19 schrieb Laurent PETIT: No problem, but you can still consider (for the definition of the function) the equivalent higher-order version I provided later in the my post (you didn't answer to this one): (defn repeatedly-while [no-arg-pred f] (take-while (f

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

2009-05-09 Thread Laurent PETIT
2009/5/10 Mark Reid > > Hi Laurent, > > On May 10, 5:15 am, Laurent PETIT 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 con

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

2009-05-09 Thread Laurent PETIT
2009/5/10 Laurent PETIT > 2009/5/9 Stefan Hübner > >> >> On 8 Mai, 01:39, Laurent PETIT 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 sp

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 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 pattern. For my purpose

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 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) (cons

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

2009-05-09 Thread Laurent PETIT
2009/5/9 Stefan Hübner > > On 8 Mai, 01:39, Laurent PETIT 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

Re: cloggle: OpenGL library for Clojure

2009-05-09 Thread philip.hazel...@gmail.com
On May 10, 12:37 am, David Nolen wrote: > 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 Is this with gears.clj? Could you post a full backtrace and relevant softwa

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 wrote: > When I tried to import PrettyWriter from clojure-contrib I'm getting > java.lang.ClassNotFoundException.  Am I missing something? > Thanks

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: 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 wrote: > I'm interested to do audio syn

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 t

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 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. > I didn't check

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 li

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 i

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 wrote: > I'm interested to

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

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 dig

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 fr

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: 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 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). Thanks for the tip!

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 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 itself. Does

cloggle: OpenGL library for Clojure

2009-05-09 Thread philip.hazel...@gmail.com
It's essentially a thin wrapper on JOGL, but I intend to improve the interface in future. http://github.com/ChickenProp/cloggle/tree/master Clojure, the JVM and opengl are all fairly new to me, so I'd appreciate feedback about my coding style, potential pitfalls, and anything else you can think

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 ada

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 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 > >       `(fn [stat

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 wrote: > If you haven't seen it yet, the set module (clojure.set) provides a > basic i

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 m

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 camelCa

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 Rich Hickey
On May 9, 11:58 am, Julien 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 returned object

Re: CL libraries - Newbie question

2009-05-09 Thread Stuart Sierra
On May 8, 7:17 pm, André Thieme 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 between. -Stuart Sierra --~--~--

Re: Launching apps

2009-05-09 Thread Stuart Sierra
On May 8, 6:30 pm, Chris Dean 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 the Google Groups "

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 i

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

2009-05-09 Thread Howard Lewis Ship
clojure-lang because there will be a clojure-contrib artifact for the same group. On Thu, May 7, 2009 at 7:28 AM, Stefan Hübner wrote: > > Laurent PETIT writes: > >> Seems fine to me. >> >> One question, though: I see that you want to name the artifact >> "clojure-lang" and not just "clojure".

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 wrote: > > > > > > > > ; First thing to le

Re: Add JNDI lookup support for contrib/sql

2009-05-09 Thread Sean Devlin
+1 On May 9, 2:33 am, Mark Derricutt 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 can't cha

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.fnpar

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 PrintWriter))

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

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 oCricket.com signature.asc Description: OpenPGP digital signature

Re: Launching apps

2009-05-09 Thread Chris Dean
Adrian Cuthbertson writes: > For production server systems running under Linux, I've used apache > commons daemon to get java apps launched Thanks for the info. 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 requiremen