Re: AOT/gen-class docs

2008-11-26 Thread Chas Emerick
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 one use case where being able to generate gen-class specs from a macro (or

Re: Patch: universal main() with repl/script/compile

2008-11-26 Thread Rich Hickey
On Nov 26, 9:17 pm, "Mark Volkmann" <[EMAIL PROTECTED]> wrote: > This is probably more of a Java question than a Clojure question. I'm > thinking most people will want clojure-contrib in their classpath. I > tried this using SVN 1127 without success. > > java -cp clojure-contrib.jar -jar clojure

Re: Patch: universal main() with repl/script/compile

2008-11-26 Thread Mark Volkmann
This is probably more of a Java question than a Clojure question. I'm thinking most people will want clojure-contrib in their classpath. I tried this using SVN 1127 without success. java -cp clojure-contrib.jar -jar clojure.jar user=> (require 'clojure.contrib.str_utils) This gives me a FileNotF

Re: Patch: universal main() with repl/script/compile

2008-11-26 Thread Perry Trolard
That's great -- happy it's in. Quick impression: I like the improvements to clojure.main, especially that forms from stdin & -e are evaluated after init files are loaded & *command-line-args* is set. Now that clojure.lang.Compile is official, I'll post a cleaned up version of my cljc script (but

AOT/gen-class docs

2008-11-26 Thread Rich Hickey
I've started documenting AOT compilation and the new :gen-class option for ns: http://clojure.org/compilation It's still a work in progress. Feedback welcome. Rich --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "C

Re: Patch: universal main() with repl/script/compile

2008-11-26 Thread Rich Hickey
On Nov 26, 5:13 pm, "Stephen C. Gilardi" <[EMAIL PROTECTED]> wrote: > On Nov 24, 2008, at 11:57 AM, Stephen C. Gilardi wrote: > > > I've uploaded a patch along those lines: > > ant-compile-main.patch,http://tinyurl.com/5azp3u > > based on our recent work on this. This includes Compile.java, >

Re: Distributed concurrent applications in Clojure?

2008-11-26 Thread dokondr
Dave, Sure thing, only immutable values will cross network, no Refs. As for the "wait" problem of, as you put it: "the tricky code won't be the remote equivalent of "send", but rather the remote equivalent of "wait", as that requires keeping track of where the remote sends come from" - this can be

Re: Clojure HTML Documentation

2008-11-26 Thread Mark Volkmann
On Fri, Nov 21, 2008 at 2:17 AM, Mark McGranaghan <[EMAIL PROTECTED]> wrote: > > I've created some experimental HTML docs for Clojure. You can see them > on S3: > http://clj-doc.s3.amazonaws.com/tmp/doc-1116/index.html A really cool addition to this would be to modify the display of the code for

Re: trampoline for mutual recursion

2008-11-26 Thread Mark Volkmann
On Wed, Nov 26, 2008 at 4:40 PM, André Thieme <[EMAIL PROTECTED]> wrote: > > On 26 Nov., 21:26, Chouser <[EMAIL PROTECTED]> wrote: >> On Wed, Nov 26, 2008 at 3:22 PM, Mark Volkmann >> >> <[EMAIL PROTECTED]> wrote: >> >> > I'm curious about this syntax. I thought if #(function-name args) >> > creat

Re: trampoline for mutual recursion

2008-11-26 Thread André Thieme
On 26 Nov., 21:26, Chouser <[EMAIL PROTECTED]> wrote: > On Wed, Nov 26, 2008 at 3:22 PM, Mark Volkmann > > <[EMAIL PROTECTED]> wrote: > > > I'm curious about this syntax. I thought if #(function-name args) > > creates a closure then I can put one in a variable and execute it > > laterI entered t

Re: Patch: universal main() with repl/script/compile

2008-11-26 Thread Stephen C. Gilardi
On Nov 24, 2008, at 11:57 AM, Stephen C. Gilardi wrote: > I've uploaded a patch along those lines: ant-compile-main.patch, > http://tinyurl.com/5azp3u > based on our recent work on this. This includes Compile.java, > main.clj, and modifies build.xml. I've updated this to reflect several of th

Re: Clojure Eclipse plugin progress (clojure-dev)

2008-11-26 Thread lpetit
Hello, In order to help a poor javaish like me go straight to the point with what emacs offers concerning what you say below (sexpr ...), what would you consider the best link to follow and read to understand the functionalities, and have the keyboard shortcuts. Indeed, I intend to (humbly) do s

Re: trampoline for mutual recursion

2008-11-26 Thread Stephen C. Gilardi
On Nov 26, 2008, at 4:32 PM, lpetit wrote: > I've maybe missed something, but will this work if one wants to make > the final return value of the tail call a closure ? Along the same lines of this being a manual way to do TCO, that issue will need to be handled manually as well. Here's what (d

Re: trampoline for mutual recursion

2008-11-26 Thread lpetit
On 25 nov, 15:05, Rich Hickey <[EMAIL PROTECTED]> wrote: > To convert to a trampoline, simply return closures over your tail > calls, rather than direct calls. This is as simple as prepending # I've maybe missed something, but will this work if one wants to make the final return value of the tai

Re: Patch: universal main() with repl/script/compile

2008-11-26 Thread Stephen C. Gilardi
> With that in mind, here ( http://bit.ly/17N0M ) is a patch (against > r1125) that includes all of Stephen & Stuart's additions for the > clojure.main function, plus the modifications to clojure.lang.Compile > for checking if the clojure.compile.path sytem property is on the > classpath. My modifi

Re: Distributed concurrent applications in Clojure?

2008-11-26 Thread Alex Miller
Hi all, I work at Terracotta and I think there are many things about Clojure that make it very interesting as a Terracotta target. The focus on immutable data structures is particularly fascinating and presents some unique challenges for Terracotta. One thing that we spend a lot of time focusing

Re: Patch: universal main() with repl/script/compile

2008-11-26 Thread Perry Trolard
Thanks for untangling the Ant black magic, Stefan. Forking a separate VM seems the simplest way to go. With that in mind, here ( http://bit.ly/17N0M ) is a patch (against r1125) that includes all of Stephen & Stuart's additions for the clojure.main function, plus the modifications to clojure.lang

Re: trampoline for mutual recursion

2008-11-26 Thread Stephen C. Gilardi
On Nov 26, 2008, at 3:22 PM, Mark Volkmann wrote: > I entered this in a REPL. > > (def myClosure #(prn "Hello")) > > How can I execute the closure in myClosure now? Clojure user=> (def myClosure #(prn "Hello")) #'user/myClosure user=> (myClosure) "Hello" nil user=> --Steve --~--~-~--~

Re: trampoline for mutual recursion

2008-11-26 Thread Chouser
On Wed, Nov 26, 2008 at 3:22 PM, Mark Volkmann <[EMAIL PROTECTED]> wrote: > > I'm curious about this syntax. I thought if #(function-name args) > creates a closure then I can put one in a variable and execute it > laterI entered this in a REPL. > > (def myClosure #(prn "Hello")) > > How can I exec

Re: trampoline for mutual recursion

2008-11-26 Thread Mark Volkmann
On Tue, Nov 25, 2008 at 8:05 AM, Rich Hickey <[EMAIL PROTECTED]> wrote: big snip > To convert to a trampoline, simply return closures over your tail > calls, rather than direct calls. This is as simple as prepending # > > (declare bar) > > (defn foo [n] > (if (pos? n) >#(bar (dec n)) I'm c

Error with SLIME and clojure, depending on how I launch SLIME

2008-11-26 Thread Paul Mooser
I've seen a few reports of the following error occurring when people start SLIME with clojure: user=> java.lang.Exception: Unable to resolve symbol: progn in this context (NO_SOURCE_FILE:1) It turns out this occurs when I launch SLIME with "C-u M-x slime RET clojure RET", but I found out that th

Re: commute

2008-11-26 Thread Rich Hickey
On Nov 26, 2:35 pm, "Mark Volkmann" <[EMAIL PROTECTED]> wrote: > On Wed, Nov 26, 2008 at 1:13 PM, Shawn Hoover <[EMAIL PROTECTED]> wrote: > > > On Wed, Nov 26, 2008 at 1:55 PM, Mark Volkmann <[EMAIL PROTECTED]> > > wrote: > > >> The documentation for commute says "Sets the in-transaction-value o

Re: Distributed concurrent applications in Clojure?

2008-11-26 Thread Stuart Sierra
On Nov 26, 11:19 am, Dave Griffith <[EMAIL PROTECTED]> wrote: > Unlike some of the other comments in this thread, I'll say I believe > that remote agents in Clojure could be a very powerful idea, > particularly due to integration with the STM.   Orchestrating in- > memory and eternal communication

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

2008-11-26 Thread Stuart Sierra
On Nov 26, 1:45 pm, BrianS <[EMAIL PROTECTED]> wrote: > I am looking to see if anyone has come up with an ANT task or script > for compiling clojure CLJ files using the clojure compiler. Much > appreciated if anyone has anything to contribute. Hi Brian, The latest Clojure releases (post 1101) us

Re: commute

2008-11-26 Thread Mark Volkmann
On Wed, Nov 26, 2008 at 1:13 PM, Shawn Hoover <[EMAIL PROTECTED]> wrote: > > > On Wed, Nov 26, 2008 at 1:55 PM, Mark Volkmann <[EMAIL PROTECTED]> > wrote: >> >> The documentation for commute says "Sets the in-transaction-value of >> ref ...". This implies to me that when the transaction ends, the

ANT script/task for AOT compiling of clojure files?

2008-11-26 Thread BrianS
I am looking to see if anyone has come up with an ANT task or script for compiling clojure CLJ files using the clojure compiler. Much appreciated if anyone has anything to contribute. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the

Re: commute

2008-11-26 Thread Shawn Hoover
On Wed, Nov 26, 2008 at 1:55 PM, Mark Volkmann <[EMAIL PROTECTED]>wrote: > > The documentation for commute says "Sets the in-transaction-value of > ref ...". This implies to me that when the transaction ends, the ref > will have its previous value. > > (def myRef (ref 19)) > (dosync (commute myRef

Re: agents and hanging clojure.lang.Script

2008-11-26 Thread Shawn Hoover
On Wed, Nov 26, 2008 at 1:41 PM, Vincent Foley <[EMAIL PROTECTED]> wrote: > > I was toying around with agents today, and I got a weird behavior: > agents hang clojure.lang.Script. Here's a simple demo script; if you > run this script, it'll print the vector and the program will be > hung. > The

Re: trampoline for mutual recursion

2008-11-26 Thread Randall R Schulz
Hi, On Tuesday 25 November 2008 06:05, Rich Hickey wrote: > I've added trampoline to ease the conversion/creation of mutually > recursive algorithms in Clojure. > > ... Clojure's new trampolines for mutually recursive functions has caught the attention of the Scala folks. There's a nice thread

Re: trampoline for mutual recursion

2008-11-26 Thread Chouser
On Wed, Nov 26, 2008 at 1:00 PM, dreish <[EMAIL PROTECTED]> wrote: > > My favorite thing about recur is that the compiler tells you > immediately if you accidentally put it somewhere other than in a tail > position. You don't have to wait for the stack to overflow in actual > use because your test

commute

2008-11-26 Thread Mark Volkmann
The documentation for commute says "Sets the in-transaction-value of ref ...". This implies to me that when the transaction ends, the ref will have its previous value. (def myRef (ref 19)) (dosync (commute myRef inc)) -> 20 @myRef -> 20 Why isn't the value of the last line 19? -- R. Mark Volkm

agents and hanging clojure.lang.Script

2008-11-26 Thread Vincent Foley
I was toying around with agents today, and I got a weird behavior: agents hang clojure.lang.Script. Here's a simple demo script; if you run this script, it'll print the vector and the program will be hung. (let [a (agent [])] (doseq [i (range 10)] (send-off a conj i)) (await a) (printl

Re: Distributed concurrent applications in Clojure?

2008-11-26 Thread Dave Griffith
One big issue to note is that, because of Refs, Clojure agent semantics can't simply be remoted the way Erlang processes can be. This is because a message send could include a references to a Ref, thus exposing mutable state remotely. This breaks, well, just about everything. If you restrict th

Re: trampoline for mutual recursion

2008-11-26 Thread dreish
On Nov 26, 11:14 am, Rich Hickey <[EMAIL PROTECTED]> wrote: > There's a very simple reason - such built-in trampolines are > incompatible with interoperability. Anyone can build a trampoline > system into their lang to get tail calls and make sure it is used > consistently within lang - but what d

Re: trampoline for mutual recursion

2008-11-26 Thread Rich Hickey
On Nov 26, 10:28 am, dreish <[EMAIL PROTECTED]> wrote: > Now that you've gone this far, why not do this? > > - class clojure.lang.TailCall contains an AFn > - Compiler checks for a tail call position and instead of calling it, > returns new TailCall(AFn) > - In invoke, while returnvalue instance

Re: map: string keys to symbols

2008-11-26 Thread peg
very elegant ! thanks --~--~-~--~~~---~--~~ 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 unsubscribe from this group, send email to [EMAIL PROTECTED] For

Re: Distributed concurrent applications in Clojure?

2008-11-26 Thread levand
But couldn't you just write some macros to wrap a message-passing framework and have it be part of the language, for all practical purposes? It would seem that this falls under the category "if you want it, just do it". If anything, Clojure is potentially more powerful than Erlang for this kind o

Re: trampoline for mutual recursion

2008-11-26 Thread dreish
Now that you've gone this far, why not do this? - class clojure.lang.TailCall contains an AFn - Compiler checks for a tail call position and instead of calling it, returns new TailCall(AFn) - In invoke, while returnvalue instanceof TailCall, returnvalue = returnvalue.fn.invoke(returnvalue) I con

Re: map: string keys to symbols

2008-11-26 Thread Chouser
On Wed, Nov 26, 2008 at 9:29 AM, peg <[EMAIL PROTECTED]> wrote: > > I wanted to transform string keys to keyword key so I coded that > thing ;-) : > > (defn string2keyword [mapWithStringsAsKeys] >(apply hash-map >(mapcat (fn [_] (list (keyword (first _)) (frest _))) > mapWithStringsAs

map: string keys to symbols

2008-11-26 Thread peg
hi clojurians, I wanted to transform string keys to keyword key so I coded that thing ;-) : (defn string2keyword [mapWithStringsAsKeys] (apply hash-map (mapcat (fn [_] (list (keyword (first _)) (frest _))) mapWithStringsAsKeys))) ; mapcat (1) apply fn to create (:key val) then (2)

Re: Distributed concurrent applications in Clojure?

2008-11-26 Thread dokondr
Rich, I readily acknowledge the diversity of message passing frameworks for Java. Notwithstanding, I think it makes sense to think about distributed message passing mechanism inherent to Clojure language, like the one Erlang has. It is Erlang abstraction of light-weight processes and extreme ease

Re: Exception reporting

2008-11-26 Thread Timothy Pratley
I did some more testing on this and discovered some interesting things... Executive Summary: I propose the following patch Index: src/jvm/clojure/lang/Compiler.java === --- src/jvm/clojure/lang/Compiler.java (revision 1123) +++ src

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

2008-11-26 Thread Daniel Renfer
If you don't like viewing source code at sourceforge, you can always read the code from the git mirror at github. http://github.com/kevinoneill/clojure-contrib/tree/master I find that their servers respond faster for me and it is a bit easier to find the page I am looking for. Also, if you watch

Re: Working with trampoline and map

2008-11-26 Thread Meikel Brandmeyer
Hi, On 26 Nov., 02:08, samppi <[EMAIL PROTECTED]> wrote: > (defn a1 [x] >   #(vector :a (a2 x) :e)) > > What must I change? Your call to a2 is not in tail position. You'll probably have to rewrite your functions, so that this is the case. (Sorry, can't check exactly. Don't have the latest SVN a

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

2008-11-26 Thread Ethan Herdrick
Seconded. As far as I can tell all you can do is go to Sourceforge and poke around in the source code: http://clojure-contrib.svn.sourceforge.net/viewvc/clojure-contrib/trunk/src/clojure/contrib/ On Wed, Nov 26, 2008 at 12:26 AM, Ralf Bensmann <[EMAIL PROTECTED]> wrote: > ? > > On Mon, Nov 24, 2

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

2008-11-26 Thread Ralf Bensmann
? On Mon, Nov 24, 2008 at 4:02 PM, Ralf Bensmann <[EMAIL PROTECTED]> wrote: > Can you provide a "summary" of the libs? Or where can I find a > documentation? > TIA > > > On Mon, Nov 24, 2008 at 3:51 PM, Chouser <[EMAIL PROTECTED]> wrote: > >> >> This just a quick reminder about the poll. We've g