Reading items in doto from a vector (using swing)

2009-07-22 Thread Volker
I have some problems with using swing from clojure. Starting from the working choice list: (defn direct-ui "" [] (let [ tmp-my-list (doto (new DefaultListModel) (.addElement "Item1") (.addElement "Item2") (.addE

Re: Ant build.xml snippet: compile

2009-07-22 Thread Meikel Brandmeyer
Hi, Am 22.07.2009 um 20:46 schrieb Christopher Wilson: Sorry if this is a bit OT, but has anyone created an ant or maven jar task (maven: is 'goal' the correct term)? In the few jars that I've created I've AOT compiled my .clj files and hand-created the jar file. The way that I do this is compi

Re: Memory Problem

2009-07-22 Thread sailormoo...@gmail.com
Oh I see, Thanks.., but how to I check if a function is lazy or not? --~--~-~--~~~---~--~~ 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: Memory Problem

2009-07-22 Thread Stuart Halloway
The call to vec isn't lazy (and makes no sense in the example). Remove the call to vec and the remaining calls to drop and range are lazy. You will probably also want to (set! *print-length* 10) or some such at the REPL. Cheers, Stu > > Hi : > > I would like to know why > ( from > http:

Sweeping Networks with Clojure

2009-07-22 Thread tmountain
I've written a short blog post on using Clojure to search for available ssh servers on my companies VPN. It starts with a single- threaded example and then adds concurrency. The performance difference in this case was pretty extreme. Sweeping 254 hosts in a serial single- threaded fashion took twe

Re: predicates in Programming Clojure

2009-07-22 Thread Stuart Halloway
The question mark suffix should be used only for predicates. The author of the erroneous prose is currently being forced to drink an extra glass of wine before bed as punishment. I have *no* idea why I wrote that -- best guess is that is-small? started as a predicate and was later changed f

Memory Problem

2009-07-22 Thread sailormoo...@gmail.com
Hi : I would like to know why ( from http://stackoverflow.com/questions/749911/how-can-i-leak-memory-in-clojure ) (drop 90 (vec (range 100))) would cause memory problem in clojure and how to fix it? Thanks Because I think my code might have similar problem of memory cannot be

Re: Multimethods dispatching - performance for larger taxonomies

2009-07-22 Thread Stuart Halloway
I certainly agree with the addition of "yet". I am finding multimethods to be more and more useful every day. I am now covering keyword inheritance during *intro* talks on Clojure. Stuart > I've just read in the Stuart's book that multimethod dispatching on > something other than Java inheri

classloading / proxy / JMX issue

2009-07-22 Thread Stuart Halloway
I have a failing test in the JMX server code [1]: (deftest dynamic-mbean (let [mbean-name "clojure.contrib.test_contrib.test_jmx:name=Foo"] (jmx/register-mbean (jmx/dynamic-mbean (ref {:string-attribute "a-string"})) mbean-name) (is (= "a-string" (jmx/read mbean-na

Re: Clojure as a CGI language?

2009-07-22 Thread Niels Mayer
On Wed, Jul 22, 2009 at 12:36 AM, robert hickman < robert.e.hick...@googlemail.com> wrote: > > Trying to use CGI sounds like a bad idea. It's always full of > security issues > > I have read trough the page that you linked to and the issues listed > ain't any different from the issues as

Re: Clojure as a CGI language?

2009-07-22 Thread Niels Mayer
On Wed, Jul 22, 2009 at 8:58 AM, Mike Hinchey wrote: > As Daniel mentioned, Google App Engine can host java. It's very easy, just > upload a war with your clj AOT-compiled. > > See http://elhumidor.blogspot.com/2009/04/clojure-on-google-appengine.html Very interesting! It also looks like the

Re: New Lisp book involving Clojure

2009-07-22 Thread Bryan Green
B On 7/22/09, rob wrote: > > FYI, The latest post on Planet Lisp discussing Nick Levine's upcoming > book "Lisp outside the Box" (to be published by O'Reilly from what I > understand) mentions it will involves some words on interaction > between CL and Clojure. http://enlivend.livejournal.com/12

Re: Confusion with apply.

2009-07-22 Thread John Harrop
On Wed, Jul 22, 2009 at 5:17 PM, mmwaikar wrote: > So if this is the intended behavior of apply, which function should I > use in this case? Is there anything in Clojure where I can apply any > user-defined function to each and every element of a list one-by-one? Use map: user=> (map #(* 5 %)

Re: Clojure as a CGI language?

2009-07-22 Thread robert hickman
2009/7/22 Mike Hinchey : > As Daniel mentioned, Google App Engine can host java.  It's very easy, just > upload a war with your clj AOT-compiled. The google app engine looks like an interesting platform, However I cannot create an account as I don't have a phone. --~--~-~--~~

Multimethods dispatching - performance for larger taxonomies

2009-07-22 Thread Dragan Djuric
I've just read in the Stuart's book that multimethod dispatching on something other than Java inheritance is rarely used. It seems to me that there is a huge potential for their use in something that I do, so I'd add "yet" to his words. Anyway, what I would ask someone from the core team, or someo

read-line in emacs slime on windows problem

2009-07-22 Thread Kelvin Ward
I've been using EmacsW32 with SLIME. Whenever I call (read-line) in the REPL it never completes reading the input. This problem does not happen when using the command line to launch the clojure REPL. I've tried combinations of clojure1.0.0.jar the 1.1 alpha snapshot, the latest clojure-contrib.ja

Re: Ant build.xml snippet: compile

2009-07-22 Thread Daniel Renfer
On Wed, Jul 22, 2009 at 2:46 PM, Christopher Wilson wrote: > > Sorry if this is a bit OT, but has anyone created an ant or maven jar > task (maven: is 'goal' the correct term)? In the few jars that I've > created I've AOT compiled my .clj files and hand-created the jar file. > The way that I do th

New Lisp book involving Clojure

2009-07-22 Thread rob
FYI, The latest post on Planet Lisp discussing Nick Levine's upcoming book "Lisp outside the Box" (to be published by O'Reilly from what I understand) mentions it will involves some words on interaction between CL and Clojure. http://enlivend.livejournal.com/12770.html --~--~-~--~~

Re: Confusion with apply.

2009-07-22 Thread Richard Newman
> I would like this move to be applied to each file in the > list. If you don't want a sequence back -- probably because you only want the side-effects -- you should look at doseq. --~--~-~--~~~---~--~~ You received this message because you are subscribed to th

Re: Confusion with apply.

2009-07-22 Thread mmwaikar
Thanks Laurent. I read about map, but I didn't think of using it because "map takes a source collection coll and a function f, and it returns a new sequence by invoking f on each element in the coll" and in my situation, I don't want a new collection back. So for ex, a have a list of file names

Re: Confusion with apply.

2009-07-22 Thread Laurent PETIT
You are searching map. You should definitely consider reading the datastructures and sequences pages on clojure.org, or you will be stopped at each step. Regards, -- Laurent 2009/7/22 mmwaikar > > Hi, > > I am getting a little confused in how apply works. I thought that > (apply f args* args

Confusion with apply.

2009-07-22 Thread mmwaikar
Hi, I am getting a little confused in how apply works. I thought that (apply f args* argseq) means applying f to each of the elements of argseq one by one (assuming one doesn't pass any args), but it is not like that. So for ex, I wrote this: (defn mul5 [arg] (* arg 5)) and wanted to do this: (a

Re: predicates in Programming Clojure

2009-07-22 Thread Meikel Brandmeyer
Hi, Am 22.07.2009 um 19:35 schrieb Richard Newman: Note that predicates don't necessarily have to return literal true or false: in my opinion at least, it's perfectly reasonable to write (def my-predicate? #{:foo :bar}) -- it'll behave correctly in if and when, but the return value will act

Re: Bitfields access in Clojure

2009-07-22 Thread Meikel Brandmeyer
Hi, Am 22.07.2009 um 18:42 schrieb Paul Mooser: Is it safe to assume that you can extract the key ordering from the literal map the user specified ? Or am I misunderstanding ? Up to eight elements in a literal map are stored as array-map. An array-map keeps the key ordering. For more elements

Re: Logging functions delegated to java logging systems

2009-07-22 Thread ataggart
Tim, you're too modest. I'm incorporating some of your stuff now. I'll update once it's done. On Jul 22, 12:04 am, Timothy Pratley wrote: > Hi Alex, > > You've got my vote - logging is essential for non-trivial programs. > > Your implementation is superior to mine, but maybe you would like to

Re: Ant build.xml snippet: compile

2009-07-22 Thread Christopher Wilson
Sorry if this is a bit OT, but has anyone created an ant or maven jar task (maven: is 'goal' the correct term)? In the few jars that I've created I've AOT compiled my .clj files and hand-created the jar file. The way that I do this is compile to the default clojure "classes" directory, I then pull

New members and moderation

2009-07-22 Thread Dragan Djuric
Hi, How long are new members considered new and their messages moderated? I think the change is NOT automatic in Google Groups. The delay can be a bit annoying when you want to participate in an interesting discussion and none of the mods are currently there ;) --~--~-~--~~--

Re: Can (genclass) be changed to operate when not compiling?

2009-07-22 Thread Dragan Djuric
Howard, Is there a chance that you consider making Cascade servlet- independent? It would be great if Cascade application could be also run, for example, directly as a grizzlet (or some other yet-to-be- created technology). Is there an absolute need to depend on servlets now when we have Clojure'

Approaching Clojure-Hibernate integration using hibernate.default_entity_mode = dynamic-map (Feedback Request)

2009-07-22 Thread Shantanu Kumar
Hi, (I am cross-posting this on Clojure and Hibernate-users mailing list.) DISCLAIMER: I am a Clojure newbie - please let me know if you find any of my assumptions / statements to be incorrect. Hibernate has an experimental support for working with maps rather than POJOs using the following co

Re: predicates in Programming Clojure

2009-07-22 Thread Richard Newman
> That is what I thought. Is it proper or idiomatic Clojure to use a "?" > symbol on non-predicate functions? I don't think so. The standard library doesn't, at any rate. Note that predicates don't necessarily have to return literal true or false: in my opinion at least, it's perfectly reasona

Re: Logging functions delegated to java logging systems

2009-07-22 Thread Tom Faulhaber
Yeah, I'd like to see something like this in clojure-contrib. One of the problems that java systems routinely have is mismatches between the assumed logging system. This is a real pain when it comes up and it would be nice to have that taken care of by an abstraction layer. Tom On Jul 21, 10:13 

Re: Bitfields access in Clojure

2009-07-22 Thread Paul Mooser
Is it safe to assume that you can extract the key ordering from the literal map the user specified ? Or am I misunderstanding ? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, se

Re: Clojure as a CGI language?

2009-07-22 Thread Mike Hinchey
As Daniel mentioned, Google App Engine can host java. It's very easy, just upload a war with your clj AOT-compiled. See http://elhumidor.blogspot.com/2009/04/clojure-on-google-appengine.html -Mike --~--~-~--~~~---~--~~ You received this message because you are su

Re: Can (genclass) be changed to operate when not compiling?

2009-07-22 Thread Howard Lewis Ship
On Wed, Jul 22, 2009 at 8:16 AM, Stuart Sierra wrote: > > On Jul 21, 6:55 pm, Howard Lewis Ship wrote: >> It would be nice if (gen-class), when not in compile mode, would still >> create a class in memory that could be referenced by class name >> elsewhere in Clojure. > > The gen-class function d

Request for Assembla membership (hlship)

2009-07-22 Thread Howard Lewis Ship
I have a code contribution for clojure-contrib; please bump me up to member so I can create my ticket and attach my patch. Thanks! -- Howard M. Lewis Ship Creator of Apache Tapestry Director of Open Source Technology at Formos --~--~-~--~~~---~--~~ You received

Re: Can (genclass) be changed to operate when not compiling?

2009-07-22 Thread Stuart Sierra
On Jul 21, 6:55 pm, Howard Lewis Ship wrote: > It would be nice if (gen-class), when not in compile mode, would still > create a class in memory that could be referenced by class name > elsewhere in Clojure. The gen-class function does nothing unless the *compile-files* var is true. So you shou

Re: Clojure as a CGI language?

2009-07-22 Thread Chouser
On Wed, Jul 22, 2009 at 3:36 AM, robert hickman wrote: > > You could use FastCGI to accomplish this, though you would have to > write the interface. > http://www.fastcgi.com/ > FastCGI would remove the long startup times for the JVM, etc. > > I will look into fast CGI. Your pa

Re: predicates in Programming Clojure

2009-07-22 Thread Jimmie Houchin
Meikel Brandmeyer wrote: > Hi, > > Am 21.07.2009 um 22:48 schrieb Jimmie Houchin: > >>(defn is-small? [number] >>(if (< number 100) "yes" "no" )) >> >> Is is-small? a predicate? If so, is this a common pattern for such >> predicates? > > The definition is correct. is-small? is not > a p

Re: Clojure as a CGI language?

2009-07-22 Thread Daniel Renfer
On Wed, Jul 22, 2009 at 3:36 AM, robert hickman wrote: > If you want very easy to deploy web apps,  I would suggest Compojure: > http://github.com/weavejester/compojure/tree/master > You can always use a proxy to front a compojure app, which is how a > lot of web apps do it. >

Re: Protocol question: donating code to clojure-contrib

2009-07-22 Thread Meikel Brandmeyer
Hi, On Jul 22, 2:31 pm, Howard Lewis Ship wrote: > Wow!  I thought being on GitHub would mean that it wouldn't be > necessary to send patches via e-mail. (Disclaimer: Personal opinion following...) Pull requests are not a good device for open contribution. They require a lot of discipline. P

Re: Protocol question: donating code to clojure-contrib

2009-07-22 Thread Howard Lewis Ship
Wow! I thought being on GitHub would mean that it wouldn't be necessary to send patches via e-mail. On Tue, Jul 21, 2009 at 11:29 PM, Howard Lewis Ship wrote: > In my repo I've created a clojure.contrib.re for regular expression > oriented functions. >Wow > On Tue, Jul 21, 2009 at 7:14 PM, Chous

London Clojurians

2009-07-22 Thread Alex Scordellis
After the successful coding dojo held on Monday night [1], I've created a group for London Clojurians who want to get together to organise events, share learnings etc. It's at http://groups.google.com/group/london-clojurians Currently google thinks that the group is spam and won't let me post a

Re: Bitfields access in Clojure

2009-07-22 Thread Daniel Janus
On 22 Lip, 09:52, Timothy Pratley wrote: > Could you give a more detailed example to illustrate what this means? > > >   (with-bitfields arr 0 {last 1, term 1, dest 22, char 8} > >     [last term dest char]) Perhaps a good illustration will be what it macroexpands to: (let [last (+ (bit-and (ag

Re: Clojure as a CGI language?

2009-07-22 Thread robert hickman
Trying to use CGI sounds like a bad idea. It's always full of security issues I have read trough the page that you linked to and the issues listed ain't any different from the issues associated with developing PHP applications. I mostly agree with the above, just to extend it a bi

Re: thread-pool scope

2009-07-22 Thread Dan Fichter
Thanks very much for the reply. I've considered creating namespaces on the fly and interning vars in them for each thread pool. Thread-local binding that follows the stack discipline is a beautiful concept (if I call you, accept and pass on my bindings), and thread-pool binding seemed like it wou

Re: Ant build.xml snippet: compile

2009-07-22 Thread Laurent PETIT
2009/7/22 Michael Wood > > 2009/7/22 Howard Lewis Ship : > > > > On Tue, Jul 21, 2009 at 3:17 PM, Laurent PETIT > wrote: > >> Hi, > >> > >> so far my examples were more based on issues with namespaces separated > into > >> multiple pieces than on a namespace / script dichotomy. > >> > >> So while

Re: Ant build.xml snippet: compile

2009-07-22 Thread Michael Wood
2009/7/22 Howard Lewis Ship : > > On Tue, Jul 21, 2009 at 3:17 PM, Laurent PETIT wrote: >> Hi, >> >> so far my examples were more based on issues with namespaces separated into >> multiple pieces than on a namespace / script dichotomy. >> >> So while I understand the interest of separating source

Re: Bitfields access in Clojure

2009-07-22 Thread Timothy Pratley
Could you give a more detailed example to illustrate what this means? >   (with-bitfields arr 0 {last 1, term 1, dest 22, char 8} >     [last term dest char]) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure"

Re: Logging functions delegated to java logging systems

2009-07-22 Thread Timothy Pratley
Hi Alex, You've got my vote - logging is essential for non-trivial programs. Your implementation is superior to mine, but maybe you would like to include some sub-parts: http://github.com/timothypratley/strive/blob/baf83e2bb26662f5f5049d165dec31e47b91e171/clj/timothypratley/logging.clj log-capt