Re: concise description of SLIME indentation rules?

2011-03-18 Thread Laurent PETIT
2011/3/18 Ken Wesson > On Thu, Mar 17, 2011 at 6:22 PM, Laurent PETIT > wrote: > > Lee, while we're at it. > > > > I decided to finally give it a try, and so I implemented an alternate > > behaviour for smart indent for ccw : the version of the gist does the > > following : it uses the following

Re: concise description of SLIME indentation rules?

2011-03-18 Thread Ken Wesson
On Fri, Mar 18, 2011 at 4:05 AM, Laurent PETIT wrote: > Sure, this is the target solution. More complex than what I've done, though. > And the gathering of the metadata is not easy, also. Any Clojure IDE that can open a REPL should be able to get at the metadata. Just eagerly spawn a runtime with

Re: concise description of SLIME indentation rules?

2011-03-18 Thread Laurent PETIT
2011/3/18 Ken Wesson > On Fri, Mar 18, 2011 at 4:05 AM, Laurent PETIT > wrote: > > Sure, this is the target solution. More complex than what I've done, > though. > > And the gathering of the metadata is not easy, also. > > Any Clojure IDE that can open a REPL should be able to get at the > metad

Re: concise description of SLIME indentation rules?

2011-03-18 Thread Ken Wesson
On Fri, Mar 18, 2011 at 7:24 AM, Laurent PETIT wrote: >> Ah, you're worried about resolve? > > Not at all. ns-resolve will not discover vars if the namespace hasn't been > required, used or loaded first. It's the user's own damn fault if some things won't indent the way they should because the so

Re: xml parsing

2011-03-18 Thread Vincent
how to parse such xml and build a defrecord ... any help thanks vincent -- 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 - please be patient

Re: xml parsing

2011-03-18 Thread Laurent PETIT
Thanks Alan for the reminder, I had totally forgotten that, and was culprit of thinking that the only way of doing depth-first was postorder. My apologizes, Stu. Cheers, -- Laurent 2011/3/16 Alan > It's one variety of depth-first. Pre-order, post-order, and in-order > are all viable ways of

Re: New Release of the Clojure Debugging Toolkit

2011-03-18 Thread Jeff Bordogna
my apologies George - upon closer inspection, I don't have a tools.jar file - must have been in a daze before...I updated openjdk-6-jdk and it's update included the tools.jar file (not sure why it wasn't there to begin with though)...now I'm happily humming along with CDTthanks for all your

Re: Clojure Editor

2011-03-18 Thread derhase
HI guys, Is there any possibility to run the written Clojure code in the blueFish Ide? thx and regards, derhase -- 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

Can't "recur" from within a "catch" expression.

2011-03-18 Thread Fiel Cabral
Hello Clojure users, This is a dumb question but I'd like to write something equivalent to this in Clojure: public String loop_with_exception(int retries) { for (int n = retries; n > 0; n--) { try { return some_io_operation(); } catch (IOException e) { continue; } } r

ClojureCLR startup times...

2011-03-18 Thread kitofr
Hey All! Just downloaded the CLR version of clojure and are experiencing a pretty awkward boot up time of the ClojureMain.exe (~10 sec) I've tried to ngen the exe and it's dependencies but without any luck. Compiling and Running from within VS2010 it takes approximately the same... Any ideas? Ch

almost abusing the system... defmutabletype

2011-03-18 Thread Sunil S Nandihalli
Hello everybody, I wanted to define a bunch of types which were mutable to be used in defining a cyclic data structure. So, I wrote the following macro .. . (defmacro defmutabletype [type-name members] (let [proto-name (symbol (str "I" (name type-name))) member-setter-names (map #(symbo

Re: almost abusing the system... defmutabletype

2011-03-18 Thread Sunil S Nandihalli
https://gist.github.com/876029 On Fri, Mar 18, 2011 at 6:33 PM, Sunil S Nandihalli < sunil.nandiha...@gmail.com> wrote: > Hello everybody, > I wanted to define a bunch of types which were mutable to be used in > defining a cyclic data structure. So, I wrote the following macro .. . > > (defmacro

Re: ClojureCLR startup times...

2011-03-18 Thread Timothy Baldridge
> Just downloaded the CLR version of clojure and are experiencing a > pretty awkward boot up time of the ClojureMain.exe (~10 sec) > I've tried to ngen the exe and it's dependencies but without any luck. > Compiling and Running from within VS2010 it takes approximately the > same... Sadly, I thin

Re: almost abusing the system... defmutabletype

2011-03-18 Thread Daniel Solano Gomez
On Fri Mar 18 18:33 2011, Sunil S Nandihalli wrote: > I wanted to define a bunch of types which were mutable to be used in > defining a cyclic data structure. So, I wrote the following macro... > > … code sample … > > although not idiomatic clojure .. thought some of you may find it useful. > Sun

Re: almost abusing the system... defmutabletype

2011-03-18 Thread Sunil S Nandihalli
Hi Gomez, Thanks for your response. The goal was to implement the half_edge datastructure .. it is described here . I felt using atoms was not going to serve any extra purpose .. What would you be doing in this situation... So go

Re: Can't "recur" from within a "catch" expression.

2011-03-18 Thread Timothy Baldridge
Notice it says "can't recur from within a catch". So throw the try/catch into it's own function and return nil if the try fails. Then throw a if statement to continue the loop only if the function return nil. Timothy On Thu, Mar 17, 2011 at 8:49 PM, Fiel Cabral wrote: > Hello Clojure users, > T

Re: Can't "recur" from within a "catch" expression.

2011-03-18 Thread Daniel Solano Gomez
On Thu Mar 17 21:49 2011, Fiel Cabral wrote: > Hello Clojure users, > This is a dumb question but I'd like to write something equivalent to this > in Clojure: > > public String loop_with_exception(int retries) > { > for (int n = retries; n > 0; n--) { > try { > return some_io_operation

Re: Can't "recur" from within a "catch" expression.

2011-03-18 Thread Baishampayan Ghose
On Fri, Mar 18, 2011 at 7:19 AM, Fiel Cabral wrote: > public String loop_with_exception(int retries) > { >   for (int n = retries; n > 0; n--) { >     try { >       return some_io_operation(); >     } catch (IOException e) { >       continue; >     } >   } >   return null; > } This is how I would

Re: Can't "recur" from within a "catch" expression.

2011-03-18 Thread Shantanu Kumar
An alternate way of doing it: (defmacro maybe [& body] `(try [(do ~@body) nil] (catch Exception e# [nil e#]))) (defn repeat-exec ([f] (let [run (fn g[] (cons (f) (lazy-seq (g] (run))) ([n f] (take n (repeat-exec f (defmacro try-times [n & body] `(let

Re: Can't "recur" from within a "catch" expression.

2011-03-18 Thread Shantanu Kumar
This of course won't work when the body of code returns nil. Regards, Shantanu On Mar 18, 8:08 pm, Shantanu Kumar wrote: > An alternate way of doing it: > > (defmacro maybe >   [& body] >   `(try [(do ~@body) nil] >      (catch Exception e# >        [nil e#]))) > > (defn repeat-exec >   ([f] >  

Re: Can't "recur" from within a "catch" expression.

2011-03-18 Thread Armando Blancas
Here's a version with a similar simulated exception but caught in the main loop, with a bit of tracing code to show the retries. Clojure 1.2.0 user=> (import java.io.IOException) java.io.IOException user=> user=> (defn some-io-operation [] (let [n (rand-int 30)] (if (> n 10) (throw (I

Re: Can't "recur" from within a "catch" expression.

2011-03-18 Thread Baishampayan Ghose
On Fri, Mar 18, 2011 at 8:44 PM, Shantanu Kumar wrote: > This of course won't work when the body of code returns nil. Mine would :) Regards, BG -- Baishampayan Ghose b.ghose at gmail.com -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to

Re: Can't "recur" from within a "catch" expression.

2011-03-18 Thread Lee Hinman
If you need a library for automatic retry (which it sounds like from your example), I'd check out this sweet library by Joe Gallo: https://github.com/joegallo/robert-bruce (it uses trampolining retries). - Lee -- You received this message because you are subscribed to the Google Groups "Clojure"

Re: ClojureCLR startup times...

2011-03-18 Thread dmiller
core.clj and company are AOT-compiled. The dll's are loaded during startup, not the clojure source. When I run a profiler on it during startup, it reports almost all time being taken by the JITter. I'm open to suggestions on improving this. In particular, more detailed profiling information woul

Re: ClojureCLR startup times...

2011-03-18 Thread Timothy Baldridge
> I'm open to suggestions on improving this.  In particular, more > detailed profiling information would be of interest. Hrm...we have some fairly detailed profilers through my work, so I'll have to fire it up over lunch and see what I get. timothy -- You received this message because you are s

Re: Can't "recur" from within a "catch" expression.

2011-03-18 Thread Shantanu Kumar
On Mar 18, 8:08 pm, Shantanu Kumar wrote: > An alternate way of doing it: > > (defmacro maybe >   [& body] >   `(try [(do ~@body) nil] >      (catch Exception e# >        [nil e#]))) > > (defn repeat-exec >   ([f] >     (let [run (fn g[] (cons (f) (lazy-seq (g] >       (run))) >   ([n f] >  

Re: ClojureCLR startup times...

2011-03-18 Thread Timothy Baldridge
> Hrm...we have some fairly detailed profilers through my work, so I'll > have to fire it up over lunch and see what I get. Yeah, I'm starting to think dmiller is correct. I went over the performance traces several times, and it really seems to all revolve around LoadAssembly, and the time it ta

Re: slime-eval-at-register

2011-03-18 Thread blais
On Mar 17, 9:39 pm, Ken Wesson wrote: > On Thu, Mar 17, 2011 at 7:32 PM, Martin Blais wrote: > > Emacs-using Clojurians may enjoy the following tidbit of > > Slime I just dreamed of: > > > (defun slime-eval-at-register (reg) > >  "Take the cursor to a register's location and eval > >   the expres

Re: ClojureCLR startup times...

2011-03-18 Thread Scott Thoman
On Fri, Mar 18, 2011 at 11:46 AM, Timothy Baldridge wrote: >> I'm open to suggestions on improving this.  In particular, more >> detailed profiling information would be of interest. > > Hrm...we have some fairly detailed profilers through my work, so I'll > have to fire it up over lunch and see wh

Re: ClojureCLR startup times...

2011-03-18 Thread dmiller
No signed assemblies. What got you below the reported JIT activity into the real problem? On Mar 18, 11:37 am, Scott Thoman wrote: > I've had a similar issue unrelated to clojure.  In my case we had some > signed assemblies and the CLR was taking a long time, in certain > environments, to go ou

Re: ClojureCLR startup times...

2011-03-18 Thread Timothy Baldridge
>From what I'm reading about some IronPython tests, it sounds like the .NET x64 JIT is much slower in startup times. Are we all running 64 bit? Timothy > No signed assemblies. > > What got you below the reported JIT activity into the real problem? -- You received this message because you are su

defrecord/defprotocol documentation suggestions

2011-03-18 Thread Seth
I would suggest adding something on the lines of these - it is confusing to newcomers, and it really isnt complete documentation to not include. The crux of the matter is how clojure defines methods when a record has inline protocols, etc. Maybe i missed this in the documentations. 1. extend-prot

Re: Can't "recur" from within a "catch" expression.

2011-03-18 Thread Ken Wesson
On Fri, Mar 18, 2011 at 1:13 PM, Shantanu Kumar wrote: > The `try-times` macro above is buggy (doesn't work when body of code > returns logical false). Fixed version is below: > > (defmacro try-times >  [n & body] {:pre [(posnum? n)]} >  `(let [c# (repeat-exec (dec ~n) #(maybe ~@body)) >         r

Re: ClojureCLR startup times...

2011-03-18 Thread Ken Wesson
On Fri, Mar 18, 2011 at 11:42 AM, dmiller wrote: > core.clj and company are AOT-compiled.  The dll's are loaded during > startup, not the clojure source. > When I run a profiler on it during startup, it reports almost all time > being taken by the JITter. > > I'm open to suggestions on improving t

Re: Strange Loop 2011 - St. Louis - Sept 18-20

2011-03-18 Thread Alex Miller
We do intend to record some or all of the talks. Alex On Mar 16, 10:08 pm, Ambrose Bonnaire-Sergeant wrote: > I'm on the wrong side of the world, will these be recorded? Looks exciting > > > > > > > > On Wed, Mar 16, 2011 at 4:49 AM, Nick Zbinden wrote: > > Man that look awesome not a single t

Re: [ANN] fs - file system utilities for Clojure

2011-03-18 Thread siyu798
Hi Miki, The dirname testcase fails on Window. Does it make sense that even if it's running on window it should still pass? In another word, don't you think that it should not convert the separator implicitly? (deftest dirname-test (is (= (dirname "/a/b/c") "/a/b"))) user=> (fs/dirname "/

Re: [ANN] fs - file system utilities for Clojure

2011-03-18 Thread Miki
Greetings, The dirname testcase fails on Window. Does it make sense that even if > it's running on window it should still pass? In another word, don't you > think that it should not convert the separator implicitly? > I agree with you, and I'll try to fix the test. However I don't have acces

*ns* unexpectedly changing on me, via SwingUtilities/invokeLater

2011-03-18 Thread Nathan Sorenson
I want to examine the namespace within a swing thread, as I want to see if a particular var is defined from another part of the program before operating on it. However, inside the "do-swing" macro (or just using SwingUtilities/invokeLater directly) *ns* will always refer to clojure.core, not the na

Re: *ns* unexpectedly changing on me, via SwingUtilities/invokeLater

2011-03-18 Thread Daniel Solano Gómez
On Fri Mar 18 15:53 2011, Nathan Sorenson wrote: > I want to examine the namespace within a swing thread, as I want to > see if a particular var is defined from another part of the program > before operating on it. However, inside the "do-swing" macro (or just > using SwingUtilities/invokeLater dir

Operations inside associative structures

2011-03-18 Thread Nick
I'm looking to do some operations upon the data in an associative structure. What do you think about this method of hijacking the definition of assoc-in? Is there some better way to do what I'm doing here? user> (defn op-in [op m [k & ks] v] (if ks (assoc m k (op-in o

Re: Operations inside associative structures

2011-03-18 Thread Ken Wesson
On Fri, Mar 18, 2011 at 9:04 PM, Nick wrote: > I'm looking to do some operations upon the data in an associative > structure.  What do you think about this method of hijacking the > definition of assoc-in?  Is there some better way to do what I'm doing > here? > > user> (defn op-in [op m [k & ks]

Re: Can't "recur" from within a "catch" expression.

2011-03-18 Thread Fiel
Thank you to all who posted all the helpful examples. I'm sure these will help other clojure learners too. On Mar 18, 5:27 pm, Ken Wesson wrote: > On Fri, Mar 18, 2011 at 1:13 PM, Shantanu Kumar > > wrote: > > The `try-times` macro above is buggy (doesn't work when body of code > > returns logic

Re: Can't "recur" from within a "catch" expression.

2011-03-18 Thread Kevin Downey
https://github.com/joegallo/robert-bruce for retrying things On Fri, Mar 18, 2011 at 6:36 PM, Fiel wrote: > Thank you to all who posted all the helpful examples. I'm sure these > will help other clojure learners too. > > On Mar 18, 5:27 pm, Ken Wesson wrote: >> On Fri, Mar 18, 2011 at 1:13 PM,

Re: *ns* unexpectedly changing on me, via SwingUtilities/invokeLater

2011-03-18 Thread Nathan Sorenson
That explaination makes sense. Still, it goes against my mental model to think of each thread as a member of only one namespace at a time--I guess in my mind it seems like a lexical, rather than dynamic property. But again, I suppose that might be a sign that operating on *ns* directly is not the b

Re: Operations inside associative structures

2011-03-18 Thread Nick
Dude...that's awesome. I don't know how I completely missed that. I must have gotten lazy by the time I got to the end of the API page. On Mar 18, 8:12 pm, Ken Wesson wrote: > On Fri, Mar 18, 2011 at 9:04 PM, Nick wrote: > > I'm looking to do some operations upon the data in an associative > >

Re: Clojure Editor

2011-03-18 Thread Olivier Lefevre
On 3/13/2011 1:09 PM, WoodHacker wrote: If you are looking for a very good editor for Clojure try Bluefish. It's been around for ever, is very stable, and does everything you would want an editor to do. And it now works with Clojure. Unless I am mistaken it seems to be missing a nice-to-have

Re: Can't "recur" from within a "catch" expression.

2011-03-18 Thread Shantanu Kumar
On Mar 19, 2:27 am, Ken Wesson wrote: > On Fri, Mar 18, 2011 at 1:13 PM, Shantanu Kumar > > wrote: > > The `try-times` macro above is buggy (doesn't work when body of code > > returns logical false). Fixed version is below: > > > (defmacro try-times > >  [n & body] {:pre [(posnum? n)]} > >  `(l

Re: Can't "recur" from within a "catch" expression.

2011-03-18 Thread Ken Wesson
It occurs to me you probably only want the delay between successive retries, so really you want to put the delay in the retrying code, or maybe use interpose in some manner (and make the interposed delay function look like a failure to the surrounding loop). -- You received this message because y

Re: Comparing clojure speed to java speed

2011-03-18 Thread Jarl Haggerty
Is there a reason I can't get this clojure program to compare with the java one? The following code: for(int q = 0;q < 5;q++){ Point2D.Float a = new Point2D.Float(1, 2), b = new Point2D.Float(3, 4); long start = System.currentTimeMillis(); for(int d = 0;d < (int)1e9;d++){ a.ge

Re: Comparing clojure speed to java speed

2011-03-18 Thread David Nolen
On Sat, Mar 19, 2011 at 12:26 AM, Jarl Haggerty wrote: > Is there a reason I can't get this clojure program to compare with the > java one? > > The following code: > > for(int q = 0;q < 5;q++){ > Point2D.Float a = new Point2D.Float(1, 2), b = new > Point2D.Float(3, 4); >long start = System

Re: *print-dup* and subvec

2011-03-18 Thread Carson
Thanks Stuart. Is that a bug that will be fixed in 1.3? I was under the impression that we can rely on print-dup for serialization. Am I wrong about that? Carson -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email t