Re: java built in HTTP server, proxy and HttpHandler interface

2008-12-09 Thread prhlava
Hello Kyle, What got me started is java code on: http://www.java2s.com/Code/Java/JDK-6/LightweightHTTPServer.htm But what is strange that java code handler can print to console and clojure version (if run as a script) does not. How do you go about debugging the handler? Kind regards, Vlad

Re: Noob question on strings.

2008-12-09 Thread Parth Malwankar
On Dec 9, 4:47 pm, Ant [EMAIL PROTECTED] wrote: Hi all, I've just started looking with interest at the language, and have decided to port some of my smaller programs and scripts to Clojure as a way of getting to know the language. I am stumbling over Strings at the moment, as I am trying

Re: java built in HTTP server, proxy and HttpHandler interface

2008-12-09 Thread Stephen C. Gilardi
On Dec 9, 2008, at 7:30 AM, prhlava wrote: The (. java.lang.System/err println something) works from in handler (it looks that *out* gets re-directed)... It may be that *out* gets redirected. Another difference between out and err is that System/err is often associated with an autoflush

Noob question on strings.

2008-12-09 Thread Ant
Hi all, I've just started looking with interest at the language, and have decided to port some of my smaller programs and scripts to Clojure as a way of getting to know the language. I am stumbling over Strings at the moment, as I am trying to read a file. I have tried the following: user=

Re: Noob question on strings.

2008-12-09 Thread Michael Wood
On Tue, Dec 9, 2008 at 1:47 PM, Ant [EMAIL PROTECTED] wrote: Hi all, I've just started looking with interest at the language, and have decided to port some of my smaller programs and scripts to Clojure as a way of getting to know the language. I am stumbling over Strings at the moment, as

Re: Noob question on strings.

2008-12-09 Thread Mark Wutka
On Dec 9, 6:47 am, Ant [EMAIL PROTECTED] wrote: Hi all, I've just started looking with interest at the language, and have decided to port some of my smaller programs and scripts to Clojure as a way of getting to know the language. I am stumbling over Strings at the moment, as I am trying

Re: Noob question on strings.

2008-12-09 Thread Ant
Hi all, I think the reader gets confused after your initial C:\dev\java \clojure\clj-repl.bat If you start the repl again and try the string with \\ it works fine. Also, when the reader gets confused by the above string, it seems to miss the at the end. If you enter a by itself it seems

Re: java built in HTTP server, proxy and HttpHandler interface

2008-12-09 Thread prhlava
Hello Steve, It may be that *out* gets redirected. Another difference between out and err is that System/err is often associated with an autoflush stream. It's possible that your output to *out* has ben buffered and that you need a call to (flush) to ensure it's displayed. Not calling the

Re: Extending Clojure's STM with external transactions

2008-12-09 Thread Razvan Ludvig
Cool stuff, Dave. I'm interested to see/test it, could you post it as an attachment to this group or commit it to contrib ? Cheers, Razvan. On Dec 8, 9:08 pm, Dave Griffith [EMAIL PROTECTED] wrote: Okay, hacking complete.  I've got a patch that extends the Clojure STM so that it will make

Re: Extending Clojure's STM with external transactions

2008-12-09 Thread Dave Griffith
Since it requires changes to the Clojure runtime, it probably doesn't make much sense to put it in contrib. I've posted it as an attachment to the group. --Dave Griffith --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google

Re: clojure-contrib documentation

2008-12-09 Thread Paul Drummond
Hi Mark, Most modules in clojure-contrib (including test-is) contain documentation and examples directly in the header comment of the source file. Cheers, Paul. 2008/12/9 Mark Volkmann [EMAIL PROTECTED] Is there a primary website that provides documentation and examples of using the various

import doesn't work when jar was loaded with add-classpath ?

2008-12-09 Thread rob.blackwell
When I load a JAR at runtime with add-classpath (add-classpath file:///Users/reb/java/jena.jar) and try user= (import '(com.hp.hpl.jena.rdf.model ModelFactory)) I get java.lang.ClassNotFoundException: com.hp.hpl.jena.rdf.model.ModelFactory (NO_SOURCE_FILE:0) user= However, I can still use

Re: java built in HTTP server, proxy and HttpHandler interface

2008-12-09 Thread prhlava
Well, The (. java.lang.System/err println something) works from in handler (it looks that *out* gets re-directed)... Vlad --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Clojure group. To post to this group,

Re: clojure.contrib.test-is: first major rewrite

2008-12-09 Thread Stuart Sierra
On Dec 9, 2:56 am, Dan Larkin [EMAIL PROTECTED] wrote: Just one bone to pick, though.  The are macro doesn't work so well   if I want to test a custom assert-expr function that only deals with a   single expression. Yeah, are isn't right. It's going to change, either by specifying the number

Re: List comprehension: :when AND :while for the same binding?

2008-12-09 Thread Rich Hickey
On Mon, Dec 8, 2008 at 7:15 PM, Chouser [EMAIL PROTECTED] wrote: On Mon, Dec 8, 2008 at 10:42 AM, Rich Hickey [EMAIL PROTECTED] wrote: On Dec 8, 10:08 am, Chouser [EMAIL PROTECTED] wrote: doseq currently supports both. If both appear on the same binding, the :while is always test first

Re: Calling superclass methods from implemented methods

2008-12-09 Thread Rich Hickey
On Dec 9, 12:24 am, Matt Revelle [EMAIL PROTECTED] wrote: The attached patch adds :super-methods option to generate-class as a map, {local-name [name [param-types] return-type], ...}. The mechanics work as Rich suggested in an earlier message, a method is created that has the same type

PCL - Clojure examples updated

2008-12-09 Thread Stuart Halloway
Over the last few weeks I have updated the examples in the Practical Common Lisp - Clojure blog series [1]. They should be up-to-date with the changes to binding forms in Clojure, plus a few errata fixes. Enjoy, and let me know if you find errors. Cheers, Stu [1]

Re: PCL - Clojure examples updated

2008-12-09 Thread Mon Key
The PCL - Clojure blog helped turn me on to Clojure... She's a valuable asset. Glad to see she hasn't been left wearing a red dress out in the rain. You must be swamped with the book deadlines. Thank You for making the time to continue sharing and updating the pcl - clojure code. On Dec 9,

Re: Running clojure-contrib.jar

2008-12-09 Thread janus
Thanks All, It's working now,I followed Stuarts instructions(example 1). Emeka --~--~-~--~~~---~--~~ 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 To

recur vs. lazy: establishing guidelines

2008-12-09 Thread Stuart Halloway
Hi all, I am working on the functional programming chapter for the book this week, and I have been reviewing uses of loop/recur vs. lazy-cat/lazy- cons in Clojure to come up with some guidelines. Here is where I am: If your function creates/returns only atoms or fixed size collections,

Understanding SLIME blog post

2008-12-09 Thread bc
Hi all, With the recent huge surge of interest in Clojure, a lot of people have started using Emacs/SLIME for Clojure development. However, if you haven't developed in a Lisp-like language previously, SLIME may be quite confusing. I've posted a summary of a bunch of SLIME-related links on my

A generic tree walker - clojure.contrib.walk

2008-12-09 Thread Stuart Sierra
Hi folks, I just committed a new contrib lib, an experimental tree walker for Clojure. I'm hoping it will make it easier to write macros that need to do transformations arbitrary code structures. -Stuart Sierra - clojure.contrib.walk/walk ([f form]) Performs a

anyone experience with brics.automaton regex engine?

2008-12-09 Thread bOR_
Hi all. Ported my research project to clojure, and now just benchmarking parts of it. I am currently spending about 5/6th of all simulation time doing regular expressions, so I looked into alternative regex engines, optimizing the regular expression and trying to find out whether clojure's

Re: recur vs. lazy: establishing guidelines

2008-12-09 Thread Stuart Sierra
On Dec 9, 1:18 pm, Stuart Halloway [EMAIL PROTECTED] wrote: Here is where I am: If your function creates/returns only atoms or   fixed size collections, loop/recur is fine. If it might return (or   internally create) variable/huge/infinite collections, use lazy-*. I agree in general, although

Re: recur vs. lazy: establishing guidelines

2008-12-09 Thread Parth Malwankar
On Dec 9, 11:18 pm, Stuart Halloway [EMAIL PROTECTED] wrote: Hi all, I am working on the functional programming chapter for the book this   week, and I have been reviewing uses of loop/recur vs. lazy-cat/lazy- cons in Clojure to come up with some guidelines. Here is where I am: If your

Re: Lazy sequences without caching?

2008-12-09 Thread Stephan Mühlstrasser
On Dec 9, 12:34 am, harrison clarke [EMAIL PROTECTED] wrote: you're keeping the head of the sequence, and thus all the elements between the head and nth. it's because you're using def, basically. if you make a function to return the sequence, and pass the result directly to nth, without

Re: Lazy sequences without caching?

2008-12-09 Thread Drew Olson
On Tue, Dec 9, 2008 at 2:28 PM, Stephan Mühlstrasser [EMAIL PROTECTED] wrote: On Dec 9, 12:34 am, harrison clarke [EMAIL PROTECTED] wrote: you're keeping the head of the sequence, and thus all the elements between the head and nth. it's because you're using def, basically. Ok, I'm

patch: idiot proof error message when compiling to the wrong place

2008-12-09 Thread Stuart Halloway
Provides an error message like: (compile 'com.thinkrelevance.Hello) - java.lang.RuntimeException: Unable to write to /some/bad/loc/ classes/com/thinkrelevance/Hello.class (Hello.clj:1) I used a RuntimeException because the constructor for IOException did not take a cause argument. Cheers,

Re: Lazy sequences without caching?

2008-12-09 Thread harrison clarke
well, the problem with using def is that you're pinning the head of the sequence to a variable. if you wrap it in a fn, then you're making a new sequence each time you call the fn. so the head of the sequence isn't attached to anything, only the function that creates it is. On Tue, Dec 9, 2008

Re: Lazy sequences without caching?

2008-12-09 Thread Stephan Mühlstrasser
On Dec 9, 8:48 pm, Drew Olson [EMAIL PROTECTED] wrote: On Tue, Dec 9, 2008 at 2:28 PM, Stephan Mühlstrasser [EMAIL PROTECTED] wrote: On Dec 9, 12:34 am, harrison clarke [EMAIL PROTECTED] wrote: you're keeping the head of the sequence, and thus all the elements between the head

Re: why can't I set! stuff in user.clj?

2008-12-09 Thread Brian Doyle
Stuart, I have a ~/.cljrc file that has this stuff in there and in my bash (clj) script to start clojure I do: $JAVA -cp $CLOJURE_JARS clojure.lang.Repl ~/.cljrc On Tue, Dec 9, 2008 at 1:12 PM, Stuart Halloway [EMAIL PROTECTED]wrote: Why can't I call set! in user.clj? (And what is the

Re: Lazy sequences without caching?

2008-12-09 Thread Drew Olson
On Tue, Dec 9, 2008 at 3:08 PM, Stephan Mühlstrasser [EMAIL PROTECTED] wrote: On Dec 9, 8:48 pm, Drew Olson [EMAIL PROTECTED] wrote: On Tue, Dec 9, 2008 at 2:28 PM, Stephan Mühlstrasser [EMAIL PROTECTED] wrote: On Dec 9, 12:34 am, harrison clarke [EMAIL PROTECTED] wrote:

Re: Understanding SLIME blog post

2008-12-09 Thread Bill Clementson
Hi Tom, On Tue, Dec 9, 2008 at 12:28 PM, Tom Emerson [EMAIL PROTECTED] wrote: Nice post as always, Bill. Thanks. :) One thing I add to my .emacs for SLIME/Clojure is the following: (global-set-key \C-cs 'slime-selector) (def-slime-selector-method ?l most recently visited clojure-mode

Re: why can't I set! stuff in user.clj?

2008-12-09 Thread Stephen C. Gilardi
user.clj is loaded before thread-local bindings are established. I see you're using Repl.java. You can see the call to pushThreadBindings there to see how it works. user.clj allows you to set up the user namespace, but not set! most vars. With the repl in clojure.main, you can include an

Re: memory issue with nth

2008-12-09 Thread Paul Mooser
This does NOT occur if I do this directly from the repl (ie, java -cp clojure.jar clojure.lang.Repl), but it DOES happen if I am accessing the repl through SLIME. Does anyone know why this might be ? --~--~-~--~~~---~--~~ You received this message because you are

Re: Calling superclass methods from implemented methods

2008-12-09 Thread Matt Revelle
On Dec 9, 2008, at 10:03 AM, Rich Hickey wrote: On Dec 9, 12:24 am, Matt Revelle [EMAIL PROTECTED] wrote: The attached patch adds :super-methods option to generate-class as a map, {local-name [name [param-types] return-type], ...}. The mechanics work as Rich suggested in an earlier

Re: memory issue with nth

2008-12-09 Thread Paul Mooser
I believe my analysis was incorrect. Never mind! On Dec 9, 1:23 pm, Paul Mooser [EMAIL PROTECTED] wrote: This does NOT occur if I do this directly from the repl (ie, java -cp clojure.jar clojure.lang.Repl), but it DOES happen if I am accessing the repl through SLIME. Does anyone know why

Re: why can't I set! stuff in user.clj?

2008-12-09 Thread Brian Doyle
Steve, Could you post your bash shell script that starts Clojure? I would like to see what you have concerning the new options that can be passed to the updated clojure.jar. Thanks. On Tue, Dec 9, 2008 at 1:59 PM, Stephen C. Gilardi [EMAIL PROTECTED] wrote: user.clj is loaded before

Re: Non-NS-qualified hierarchies

2008-12-09 Thread Rich Hickey
On Mon, Dec 8, 2008 at 9:21 AM, J. McConnell [EMAIL PROTECTED] wrote: On Mon, Dec 8, 2008 at 9:05 AM, Rich Hickey [EMAIL PROTECTED] wrote: On Dec 7, 9:01 am, Mibu [EMAIL PROTECTED] wrote: Is it possible to remove the asserts in derive that restrict the parent and child to namespace-qualified

Re: Patch: precompiling Clojure core sources in Ant build script

2008-12-09 Thread MattyDub
I recently tried M-. for the first time with clojure + SLIME and it broke for me (with a Lisp error: (error Synchronous Lisp Evaluation aborted.)); other parts of SLIME work (e.g., C-M-x, or C-x C-e), but this doesn't . I didn't understand the previous messages in this thread: 1) Stephen Gilardi

Re: Patch: precompiling Clojure core sources in Ant build script

2008-12-09 Thread Bill Clementson
Hi Matt, On Tue, Dec 9, 2008 at 4:15 PM, MattyDub [EMAIL PROTECTED] wrote: I recently tried M-. for the first time with clojure + SLIME and it broke for me (with a Lisp error: (error Synchronous Lisp Evaluation aborted.)); other parts of SLIME work (e.g., C-M-x, or C-x C-e), but this

Re: why can't I set! stuff in user.clj?

2008-12-09 Thread Stephen C. Gilardi
On Dec 9, 2008, at 6:13 PM, Brian Doyle wrote: Could you post your bash shell script that starts Clojure? I would like to see what you have concerning the new options that can be passed to the updated clojure.jar. Thanks. Here it is: #!/bin/bash set -o errexit

Re: why can't I set! stuff in user.clj?

2008-12-09 Thread Stephen C. Gilardi
On Dec 9, 2008, at 6:13 PM, Brian Doyle wrote: Could you post your bash shell script that starts Clojure? I would like to see what you have concerning the new options that can be passed to the updated clojure.jar. Thanks. [Reposting with a change and a correction:

Re: why can't I set! stuff in user.clj?

2008-12-09 Thread Randall R Schulz
On Tuesday 09 December 2008 18:10, Randall R Schulz wrote: ... Since I love to share my BASH code (and I anxiously look forward to the day that I'm willing to share my Clojure code), I've attached my clojure-svn script. ... By the way, tab stops are set at 4-column intervals. I forgot to

Re: Patch: precompiling Clojure core sources in Ant build script

2008-12-09 Thread MattyDub
I did an 'svn update' on my clojure (I'm now at revision 1149), and ran ant clean, then ant (the default target). Then I deleted my old swank-clojure directory, and did a git clone of git://github.com/jochu/swank-clojure.git. I made sure my .emacs was correctly pointing to the appropriate

throw-if with no exception class

2008-12-09 Thread Mark Volkmann
The throw-if function from clojure.contrib.except will throw a specified exception type. If none is specified, it throws a java.lang.Exception. I was expecting it would through a java.lang.RuntimeException. Which seems more correct? -- R. Mark Volkmann Object Computing, Inc.

def* froms

2008-12-09 Thread Mark McGranaghan
I generally like the various def* macros from clojure.contrib.def. I was wondering though if it would make sense unify the syntax of all the def* macros from both clojure.contrib.def and clojure.core, especially with respect to doc strings and attr-maps. For example in clojure.core we have defn

Re: Non-NS-qualified hierarchies

2008-12-09 Thread J. McConnell
On Tue, Dec 9, 2008 at 7:05 PM, Rich Hickey [EMAIL PROTECTED] wrote: Thanks. I think it does a bit too much - I only want to relax the requirement for namespace-qualification, not any of the other assertions (e.g. that the participants are either Named or Classes, can't be = etc). Right,

Re: Patch: precompiling Clojure core sources in Ant build script

2008-12-09 Thread Bill Clementson
Hi Matt, On Tue, Dec 9, 2008 at 6:43 PM, MattyDub [EMAIL PROTECTED] wrote: I did an 'svn update' on my clojure (I'm now at revision 1149), and ran ant clean, then ant (the default target). Then I deleted my old swank-clojure directory, and did a git clone of