help--reading keyboard input from Clojure is surprisingly difficult

2011-04-07 Thread Gregg Williams
Having worked with Clojure for over a year, I can sympathize with Clojure beginners (like myself) who find it extremely difficult to do simple things with Clojure. (It took me weeks to get Clojure working with Emacs, Swank, and the Clojure Debugging Toolkit, but I'm persistent.) Now this. I'm lear

Re: Simple Clojure/Java interop

2011-04-07 Thread MohanR
That was my guess too and when I specify swank-clojure-extra-vm-args it seems to work. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - pleas

Re: Simple Clojure/Java interop

2011-04-07 Thread Sean Corfield
Ah, static initializers... Well, I expect your initializer (in Java) is running before the Clojure code has had a chance to set the property... On Thu, Apr 7, 2011 at 8:56 PM, MohanR wrote: > > (let [ test (LogManager/getLogger "Stream")]) > > This code inside the same clojure function is suppose

Re: Simple Clojure/Java interop

2011-04-07 Thread MohanR
(let [ test (LogManager/getLogger "Stream")]) This code inside the same clojure function is supposed to call a static method of a Java class and in the Java class there is a static initializer. That initializer calls System.getProperty( "Test" ) This is compiled from within emacs C-c C-l. Not AO

Re: Announcement: pretzel - a predicate library + call for suggestions

2011-04-07 Thread Joost
James Reeves wrote: > On 7 April 2011 06:48, Joost wrote: > > I think your choice of currying makes more sense, at least in the > > context of validations, so it might be a good idea to switch pretzel > > over to that scheme. > > Would it make sense for clj-decline? Yes. The main idea of clj-decl

Re: Announcement: pretzel - a predicate library + call for suggestions

2011-04-07 Thread James Reeves
On 7 April 2011 06:48, Joost wrote: > I think your choice of currying makes more sense, at least in the > context of validations, so it might be a good idea to switch pretzel > over to that scheme. Would it make sense for clj-decline? The Valip predicates are designed with HTML form validation i

Re: minor pauses

2011-04-07 Thread Sam Aaron
Hi Peter, On 7 Apr 2011, at 18:45, Peter Schuller wrote: >> * GC kicking in > > -XX:+PrintGC > -XX:+PrintGCDetails > -XX:+PrintGCTimeStamps > > Will tell you immediately. This is brilliant, thanks for letting me know about it. Here's a short snippet of my system running. I'm using the followi

Re: How to profile my app?

2011-04-07 Thread Stuart Sierra
clojure.contrib.profile is kind of a hack, I wouldn't rely on it for accurate information. -Stuart Sierra clojure.com -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from

Re: clj3D, a Clojure 3D Library

2011-04-07 Thread Ken Wesson
On Wed, Apr 6, 2011 at 5:18 PM, Ken Wesson wrote: > On Wed, Apr 6, 2011 at 4:46 PM, Benny Tsai wrote: >> Works for me (Chrome 10.0.648.204, Windows XP SP3). > > Well, this is just screwy. I have tried restarting Chrome, disabling > and re-enabling its Flash plugin, and various other things. No jo

Re: minor pauses

2011-04-07 Thread Peter Schuller
> * GC kicking in -XX:+PrintGC -XX:+PrintGCDetails -XX:+PrintGCTimeStamps Will tell you immediately. A couple of hundred ms seems very very plausible for GC. What is your target/desired maximum pause time? -- / Peter Schuller -- You received this message because you are subscribed to the Goo

Re: How to add a java library (that is not in maven) as a dependency for a clojure library?

2011-04-07 Thread Phil Hagelberg
On Apr 7, 8:05 am, j1n3l0 wrote: > Thank you very much, that was exactly what I needed to do. I've > managed to publish the java library on clojars. Now I need to tell the > original author what I'm doing :) Glad you got it working. For future reference, it's much better to contact the author fir

Re: Simple Clojure/Java interop

2011-04-07 Thread Sean Corfield
I tried it in the REPL and it seemed to work fine: user=> (use 'clojure.test) nil user=> (deftest testlogging (System/setProperty "Test" "Test1") (let [ configfile (System/getProperty "Test")] (is (= "Test1" configfile )) )) #'user/testlogging user=> (run-tests) Testing user Ran 1 te

Re: How to add a java library (that is not in maven) as a dependency for a clojure library?

2011-04-07 Thread j1n3l0
Thank you very much, that was exactly what I needed to do. I've managed to publish the java library on clojars. Now I need to tell the original author what I'm doing :) On Apr 7, 3:46 pm, Mark Rathwell wrote: > I'm not aware of any clojars policies relating to this, so I'm not sure if > they only

Re: How to add a java library (that is not in maven) as a dependency for a clojure library?

2011-04-07 Thread Mark Rathwell
I'm not aware of any clojars policies relating to this, so I'm not sure if they only want clojure artifacts in their repository, but I would think it would not be an issue. You will first need to create a minimal pom.xml for the library jar file, see 'Minimal POM' section at http://maven.apache.or

minor pauses

2011-04-07 Thread Sam Aaron
Hi there, I'm trying to track down what might be creating seemingly sporadic tiny pauses in my application execution. Essentially the system is calling a JNI interface with a regular rhythm. Most of the time this is the case, however, occasionally the system will pause for a few hundred ms and

Re: How to add a java library (that is not in maven) as a dependency for a clojure library?

2011-04-07 Thread j1n3l0
Thank you both for your input. Now assuming I am prepared to publish the java component to clojars myself (which I am), how do I go about publishing said java library with an ant build file to clojars? My understanding of clojars was that it was for clojure libraries? Thanks. On Apr 7, 3:19 pm,

Re: Simple Clojure/Java interop

2011-04-07 Thread Armando Blancas
There's nothing wrong there. Would need to see the java snippet how is called. On Apr 6, 11:03 pm, MohanR wrote: > This is a beginner's question but I thought I might be missing > something. > > I am setting a System property and testing for it like this. It > passes. > >  ( deftest testlogger >

Re: How to add a java library (that is not in maven) as a dependency for a clojure library?

2011-04-07 Thread Mark Rathwell
Wow, I really shouldn't be reading this early in the morning. Just realized you want to publish to clojars.org. In that case, yes, you do need to alert users as to where they can download the additional dependencies that are not in common maven repositories. Or, as Armando suggested, petition th

Re: How to add a java library (that is not in maven) as a dependency for a clojure library?

2011-04-07 Thread Armando Blancas
You may want to contact the library's developer to request it be published as a component, or do it yourself since it's open source and they won't mind the added exposure. Once that lib is up in clojars you continue as normal. On Apr 7, 6:49 am, j1n3l0 wrote: > Hi, > > I've written a little cloju

Re: How to add a java library (that is not in maven) as a dependency for a clojure library?

2011-04-07 Thread Mark Rathwell
Oops, just reread your question, looks like you may be more interested in deployment. For deployment, try 'lein uberjar' to bundle all dependencies into one distributable jar file. Hopefully answered the right question this time ;) - Mark On Thu, Apr 7, 2011 at 9:54 AM, Mark Rathwell wrote: >

Re: How to add a java library (that is not in maven) as a dependency for a clojure library?

2011-04-07 Thread Mark Rathwell
The easiest way would be to install the library to you local maven repository with the command below (assuming you have maven installed. That way, you can add the dependency to all of your projects on your local box. If you do not want to use maven, you make sure the library is on your classpath

Re: Applying collection of functions

2011-04-07 Thread Baishampayan Ghose
On Thu, Apr 7, 2011 at 7:17 PM, Meikel Brandmeyer wrote: > Each anonymous function you define via fn or #() generates a new > class. Functions like comp or partial just return a new instance of > the anonymous class contained in the comp resp. partial definition. So > they don't create a new class

How to add a java library (that is not in maven) as a dependency for a clojure library?

2011-04-07 Thread j1n3l0
Hi, I've written a little clojure library that depends on a java library for functionality. This java library is only available on sourceforge.net. I have been using leiningen to manage my clojure projects and I would like to add it as a dependency in my project.clj file so I can publish my librar

Re: Applying collection of functions

2011-04-07 Thread Meikel Brandmeyer
Hi, On 7 Apr., 15:11, Baishampayan Ghose wrote: > On a more serious note, how do I find out how many classes a form compiles to? Each anonymous function you define via fn or #() generates a new class. Functions like comp or partial just return a new instance of the anonymous class contained in

Re: Applying collection of functions

2011-04-07 Thread Chouser
On Thu, Apr 7, 2011 at 9:11 AM, Baishampayan Ghose wrote: > On Thu, Apr 7, 2011 at 6:34 PM, Chouser wrote: Given a collection of functions (def fs [#(* % 10) #(+ % 1)]) and some numbers (def c [1 2 3]) How do I apply all the functions to c so that the

Re: Applying collection of functions

2011-04-07 Thread Baishampayan Ghose
On Thu, Apr 7, 2011 at 6:34 PM, Chouser wrote: >>> Given a collection of functions >>> >>> (def fs [#(* % 10) #(+ % 1)]) >>> >>> and some numbers >>> >>> (def c [1 2 3]) >>> >>> How do I apply all the functions to c so that the results of one >>> function are passed to the other. In the same way -

Re: Applying collection of functions

2011-04-07 Thread Chouser
On Thu, Apr 7, 2011 at 8:56 AM, Baishampayan Ghose wrote: >> Given a collection of functions >> >> (def fs [#(* % 10) #(+ % 1)]) >> >> and some numbers >> >> (def c [1 2 3]) >> >> How do I apply all the functions to c so that the results of one >> function are passed to the other. In the same way

Re: Applying collection of functions

2011-04-07 Thread Baishampayan Ghose
On Thu, Apr 7, 2011 at 6:26 PM, Scott Jaderholm wrote: > (map #((apply comp (reverse fs)) %) c) > => (11 21 31) Don't need the lambda around comp because comp returns a function which can be mapped. Regards, BG -- Baishampayan Ghose b.ghose at gmail.com -- You received this message because y

Re: Applying collection of functions

2011-04-07 Thread Baishampayan Ghose
> Given a collection of functions > > (def fs [#(* % 10) #(+ % 1)]) > > and some numbers > > (def c [1 2 3]) > > How do I apply all the functions to c so that the results of one > function are passed to the other. In the same way -> works. Thus in > this case the expected result would be: 11 21 31

Re: Applying collection of functions

2011-04-07 Thread Scott Jaderholm
(map #((apply comp (reverse fs)) %) c) => (11 21 31) Scott On Thu, Apr 7, 2011 at 4:51 AM, zm wrote: > > Hi, > > Given a collection of functions > > (def fs [#(* % 10) #(+ % 1)]) > > and some numbers > > (def c [1 2 3]) > > How do I apply all the functions to c so that the results of one > func

Re: 1.3 master commit for lazy defn loading

2011-04-07 Thread Mikhail Kryshen
Looks like it is a bug in Clojure. Create foo.clj: (ns foo) (let [] (defn foo [] :foo)) Then call foo from REPL: $ java -cp .:clojure-1.3.0-alpha6.jar clojure.main Clojure 1.3.0-alpha6 user=> (use 'foo) nil user=> (foo) ClassNotFoundException foo$eval9$foo__10 java.lang.Class.forName0 (Class

Applying collection of functions

2011-04-07 Thread zm
Hi, Given a collection of functions (def fs [#(* % 10) #(+ % 1)]) and some numbers (def c [1 2 3]) How do I apply all the functions to c so that the results of one function are passed to the other. In the same way -> works. Thus in this case the expected result would be: 11 21 31 -- You rec

Re: Announcement: pretzel - a predicate library + call for suggestions

2011-04-07 Thread Joost
On Apr 7, 1:47 am, James Reeves wrote: > I've been writing a small validation library, Valip, with a number of > included predicates. The predicates in Valip are curried if they have > more than one argument, but there is probably some overlap between > Valip and Pretzel, and it might be an idea