Re: Newbie: Why does .length work on strings but not .isEmpty ?

2008-11-27 Thread Stephen C. Gilardi
On Nov 27, 2008, at 11:37 PM, samppi wrote: > user=> (.length "") > 0 > user=> (.isEmpty "") > java.lang.IllegalArgumentException: No matching field found: isEmpty > for class java.lang.String (NO_SOURCE_FILE:0) > > Why does .length, but not .isEmpty, work on Strings? You're making method calls

Newbie: Why does .length work on strings but not .isEmpty ?

2008-11-27 Thread samppi
user=> (.length "") 0 user=> (.isEmpty "") java.lang.IllegalArgumentException: No matching field found: isEmpty for class java.lang.String (NO_SOURCE_FILE:0) Why does .length, but not .isEmpty, work on Strings? --~--~-~--~~~---~--~~ You received this message beca

amb

2008-11-27 Thread puzzler
I've only seen continuation-based implementations of the amb operator. Is there an alternative way to code amb that would work in Clojure? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to t

Re: ANT script/task for AOT compiling of clojure files?

2008-11-27 Thread Stephen C. Gilardi
Very cool Stefan, thanks! I'm planning to write a clojure.compile/main in Clojure along the lines of what you came up with. I think the current Compile.java is sufficient for bootstrapping clojure.jar--with the "finally" fix you recommend. Thanks, --Steve On Nov 27, 2008, at 11:29 AM, St

into should take multiple from arguments

2008-11-27 Thread Alec Berryman
I've found myself writing (reduce into coll [coll1 coll2 coll3]) a few times. It would be nice to instead write (into coll coll1 coll2 coll3), like (+ 1 2 3) and other similar forms. I've attached a trivial patch that works for me. --~--~-~--~~~---~--~~ You rece

Re: Distributed concurrent applications in Clojure?

2008-11-27 Thread Eric Sessoms
For kicks, I've uploaded a little wrapper around JInterface to make it a little more lispy. It might make it a little easier for anyone interested in playing around with that option. http://clojure.googlegroups.com/web/erlang.clj On Nov 25, 8:11 am, Rich Hickey <[EMAIL PROTECTED]> wrote: > Jint

Re: Exception on the formatted print method calls

2008-11-27 Thread Kei Suzuki
On Nov 27, 12:07 pm, "Michael Wood" <[EMAIL PROTECTED]> wrote: > On Thu, Nov 27, 2008 at 9:21 PM, Chouser <[EMAIL PROTECTED]> wrote: > > > On Thu, Nov 27, 2008 at 2:12 PM, Kei Suzuki <[EMAIL PROTECTED]> wrote: > > >> Any formatted print method calls like below throw > >> java.lang.ClassCastExcepti

Re: Exception on the formatted print method calls

2008-11-27 Thread Kei Suzuki
On Nov 27, 11:21 am, Chouser <[EMAIL PROTECTED]> wrote: > On Thu, Nov 27, 2008 at 2:12 PM, Kei Suzuki <[EMAIL PROTECTED]> wrote: > > > Any formatted print method calls like below throw > > java.lang.ClassCastException at clojure.lang.Compiler.eval. > > > (.printf System/out "%d" 1) > > (. System/o

fix imports

2008-11-27 Thread Martin DeMello
I've done a bit of Java programming, and one of the reasons I use an IDE (netbeans) rather than plain vim is that I can write code without having to bother about where every class I use comes from, then click 'fix imports' and have netbeans statically examine the code and add import statements. I'

Re: trampoline for mutual recursion

2008-11-27 Thread lpetit
On 27 nov, 18:09, Rich Hickey <[EMAIL PROTECTED]> wrote: > > > (defn trampoline [f] > > >   (let [ret (f)] > > >      (cond f > > >        (fn? ret) (recur ret) > > >        (instance? org.clojure.lang.NoBoingWrapper f) (.returnInstance > > > f) > > >        else ret))) > I considered that, and it

Re: Updated Monads

2008-11-27 Thread budu
Hi, great work! It really put to shame my own pathetic attempt to try to implement monad last summer. ;-) Thanks, I'll certainly learn a lot from this. On Nov 25, 4:40 am, Konrad Hinsen <[EMAIL PROTECTED]> wrote: > I just uploaded an improved version of my monad implementation: > >        http:/

Re: Stubbing macro for isolated unit tests

2008-11-27 Thread James Reeves
On Nov 24, 6:19 pm, Justin Giancola <[EMAIL PROTECTED]> wrote: > So, you need to evaluate all of the args independently when building > the list literals, possibly with: > (defmacro stub [stubs & body] >   (let [stub-maps >         (reduce (fn [acc [[f & args] res]] >                   (assoc-in

Re: clojure contrib testing, fix for macro?, did macro? ever work?

2008-11-27 Thread Stuart Halloway
Hi Steve, Thanks for the explanation, and for the updated version of macro? Cheers, Stuart > On Nov 25, 2008, at 7:28 PM, Stuart Halloway wrote: > >> (1) Did macro? ever work? If it did, I would like to go back and >> understand what change was made to Clojure and why. > > Yes it did work. I be

Re: Exception on the formatted print method calls

2008-11-27 Thread Michael Wood
On Thu, Nov 27, 2008 at 9:21 PM, Chouser <[EMAIL PROTECTED]> wrote: > > On Thu, Nov 27, 2008 at 2:12 PM, Kei Suzuki <[EMAIL PROTECTED]> wrote: >> >> Any formatted print method calls like below throw >> java.lang.ClassCastException at clojure.lang.Compiler.eval. >> >> (.printf System/out "%d" 1) >>

Re: clojure contrib testing, fix for macro?, did macro? ever work?

2008-11-27 Thread Stephen C. Gilardi
On Nov 25, 2008, at 7:28 PM, Stuart Halloway wrote: > (1) Did macro? ever work? If it did, I would like to go back and > understand what change was made to Clojure and why. Yes it did work. I believe the change described here: http://groups.google.com/group/clojure/msg/65b0dd5f0dfeee88 would

Re: Exception on the formatted print method calls

2008-11-27 Thread Chouser
On Thu, Nov 27, 2008 at 2:12 PM, Kei Suzuki <[EMAIL PROTECTED]> wrote: > > Any formatted print method calls like below throw > java.lang.ClassCastException at clojure.lang.Compiler.eval. > > (.printf System/out "%d" 1) > (. System/out (printf "%d" 1)) > (.format System/err java.util.Locale/US "%s"

Exception on the formatted print method calls

2008-11-27 Thread Kei Suzuki
Any formatted print method calls like below throw java.lang.ClassCastException at clojure.lang.Compiler.eval. (.printf System/out "%d" 1) (. System/out (printf "%d" 1)) (.format System/err java.util.Locale/US "%s" "error") (. System/out format nil "%s" "hello, world!\n") Am I missing something?

Re: Trying to make an applet with clojure

2008-11-27 Thread rob
Actually, this is an issue with qualified names, apparently it was necessary to explicitly invoke the clojure.core namespace. On Nov 27, 12:18 pm, rob <[EMAIL PROTECTED]> wrote: > Any news on this?  I'm also interested in getting clojure to work in > an applet.  Right now, I'm testing out the fea

Re: Trying to make an applet with clojure

2008-11-27 Thread rob
Any news on this? I'm also interested in getting clojure to work in an applet. Right now, I'm testing out the feasibility of developing a clojure applet for the Facebook platform (a game). I assume that a certificate will solve the permissions problem, but for now I'm running it locally with a

Re: Poll: Which clojure.contrib libs should be bundled with Clojure?

2008-11-27 Thread Chouser
I've closed the voting -- thanks to everyone who participated. A total of 44 people voted 231 times, for an average of 5.25 votes per person. That comes to about 4.4% participation in the survey (of the 1010 people who are members of this Google Group) -- so I'm sure this is an accurate represen

Re: trampoline for mutual recursion

2008-11-27 Thread jim
Rich, I'm currently working on some code where I'm implementing state machines where each state is a function. To move to another state, the current state returns the function of the next state and trampoline runs the machine through to completion. My next step is to have each state return a va

Re: trampoline for mutual recursion

2008-11-27 Thread Rich Hickey
On Nov 27, 8:37 am, lpetit <[EMAIL PROTECTED]> wrote: > On Nov 27, 1:58 pm, lpetit <[EMAIL PROTECTED]> wrote: > > > and the modification of trampoline along these lines : > > (defn trampoline [f] > > (let [ret (f)] > > (cond f > >(fn? ret) (recur ret) > >(instance? org.clo

Re: AOT/gen-class docs

2008-11-27 Thread Rich Hickey
On Nov 27, 11:42 am, "Michael Reid" <[EMAIL PROTECTED]> wrote: > > gen-class will always create a relationship between the stub class and > > the load (__init) class, as well as the namespace in which the > > implementations will be found, the naming conventions for matching > > etc. It's a high

Re: AOT/gen-class docs

2008-11-27 Thread Michael Reid
> gen-class will always create a relationship between the stub class and > the load (__init) class, as well as the namespace in which the > implementations will be found, the naming conventions for matching > etc. It's a high-level feature with a lot of power, but by no means > represents a univer

Re: ANT script/task for AOT compiling of clojure files?

2008-11-27 Thread Stefan Bodewig
> OK, I skimmed through compile and RT and it seems as if you "just" > needed to construct a proper URLClassLoader with the directories you > need on the classpath, set this one as the context classloader and set > *use-context-classloader* to true before you invoke compile. Yes, works. The attac

Re: Exception reporting

2008-11-27 Thread Timothy Pratley
Hi > -                       throw new CompilerException((String) SOURCE.get > (), (Integer) LINE.get(), e); > +                       throw new CompilerException((String) SOURCE.get > (), (Integer) LINE_AFTER.get(), e); Having dug through the code a bit more, I don't my patch suggestion is quit

Re: ANT script/task for AOT compiling of clojure files?

2008-11-27 Thread Stefan Bodewig
On 2008-11-27, Stephen C. Gilardi <[EMAIL PROTECTED]> wrote: > On Nov 27, 2008, at 7:41 AM, Stefan Bodewig wrote: >> Looks pretty easy and it would probably take me longer to sign and >> send the CA than to put together an antlib.xml file 8-) >> If anybody is interested, let me know. > I'm int

Re: ANT script/task for AOT compiling of clojure files?

2008-11-27 Thread Stefan Bodewig
> On 2008-11-26, Stuart Sierra <[EMAIL PROTECTED]> wrote: >> The Ant task looks like this: >> >> >> >> ... >> > description="Precompile Clojure core sources."> >> > classpath="${build}:${cljsrc}"> >>

Re: AOT/gen-class docs

2008-11-27 Thread Rich Hickey
On Nov 26, 11:06 pm, Chas Emerick <[EMAIL PROTECTED]> wrote: > Looks good so far, Rich. Should be a blissfully smooth transition > from the "legacy" gen-class impl. > > This is only tangentially related to the docs you're writing, but I > won't let that stop me: > > As you know, I have at least

Re: ANT script/task for AOT compiling of clojure files?

2008-11-27 Thread Stephen C. Gilardi
On Nov 27, 2008, at 7:41 AM, Stefan Bodewig wrote: > Looks pretty easy and it would probably take me longer to sign and > send the CA than to put together an antlib.xml file 8-) > > If anybody is interested, let me know. I'm interested in making common developer tasks as easy as possible to ac

Re: trampoline for mutual recursion

2008-11-27 Thread lpetit
On Nov 27, 1:58 pm, lpetit <[EMAIL PROTECTED]> wrote: > and the modification of trampoline along these lines : > (defn trampoline [f] >   (let [ret (f)] >      (cond f >        (fn? ret) (recur ret) >        (instance? org.clojure.lang.NoBoingWrapper f) (.returnInstance > f) >        else ret)))

Re: trampoline for mutual recursion

2008-11-27 Thread lpetit
Thank you for the answer. Could trampoline benefit for being enhanced by allowing an explicit "escaping" for a return value of type function (that could also work for other return types, but would not be necessary for the common case). Something like these : - common usage : as usual user=> (de

Re: ANT script/task for AOT compiling of clojure files?

2008-11-27 Thread Stefan Bodewig
On 2008-11-27, Meikel Brandmeyer <[EMAIL PROTECTED]> wrote: > However I have no experience with ant. So how can I set the > path via an envirnment variable? > Eg. CLOJURE_LIB which is also used by some startup script which was > posted. the value of the environment variable becomes ${prefix.C

Re: ANT script/task for AOT compiling of clojure files?

2008-11-27 Thread Stefan Bodewig
On 2008-11-26, Stuart Sierra <[EMAIL PROTECTED]> wrote: > The Ant task looks like this: > > > > ... > description="Precompile Clojure core sources."> > classpath="${build}:${cljsrc}"> >

Re: ANT script/task for AOT compiling of clojure files?

2008-11-27 Thread Meikel Brandmeyer
Hi, On 27 Nov., 10:59, Meikel Brandmeyer <[EMAIL PROTECTED]> wrote: > However I have no experience with ant. So how can I set the > path via an envirnment variable? Eg. CLOJURE_LIB which is > also used by some startup script which was posted. That would > make a nice fit. Ok. I looked it up:

Re: trampoline for mutual recursion

2008-11-27 Thread Stephen C. Gilardi
On Nov 27, 2008, at 7:13 AM, Stephen C. Gilardi wrote: > interface "fn" that distinguishes The interface is "clojure.lang.Fn". --Steve --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to

Re: trampoline for mutual recursion

2008-11-27 Thread Stephen C. Gilardi
On Nov 27, 2008, at 5:21 AM, Robert Pfeiffer wrote: > If you want to return sets, keywords, maps, or everything that > implements the fn interface this is also an issue. Does trampolining > on keywords make sense? The svn revision that introduced trampoline also introduced a "marker" interface

Re: trampoline for mutual recursion

2008-11-27 Thread Meikel Brandmeyer
Hi, On 26 Nov., 23:40, André Thieme <[EMAIL PROTECTED]> wrote: > Maybe a simple accumulator could work here: > user> (let [acc (ref 0)] >         (defn make-accumulator [n] >           (dosync (ref-set acc n)) >           (fn [i] >             (dosync (alter acc + i) > #'user/make-accumulator

Re: trampoline for mutual recursion

2008-11-27 Thread Robert Pfeiffer
On 26 Nov., 22:38, "Stephen C. Gilardi" <[EMAIL PROTECTED]> wrote: >    [..] Note that if you want to return a fn as a >    final value, you must wrap it in some data structure and unpack it >    after trampoline returns. If you want to return sets, keywords, maps, or everything that implements

Re: ANT script/task for AOT compiling of clojure files?

2008-11-27 Thread Meikel Brandmeyer
Hi, On 26 Nov., 20:53, Stuart Sierra <[EMAIL PROTECTED]> wrote: >                         description="Precompile Clojure core sources."> >                                       classpath="${build}:${cljsrc}"> >                         value="${build}"/> >                         >