Re: gui repl

2010-01-03 Thread Albert Cardona
I built a Swing REPL for clojure some time ago, it's part of Fiji. Launch from "Plugins - Scripting - Clojure Interpreter" menu command. http://pacific.mpi-cbg.de Code here: http://pacific.mpi-cbg.de/cgi-bin/gitweb.cgi?p=fiji.git;a=blob;f=src-plugins/Clojure/Clojure_Interpreter.java;hb=HEAD Alb

Re: am i the only one with deftype/defprotocol problems?

2010-01-03 Thread Konrad Hinsen
On 4 Jan 2010, at 05:37, Raoul Duke wrote: > i've only heard crickets so far, am i really the only one who can't > get this to work? help? :-} thanks. i figure i must be doing something > dirt simple wrong? > > Clojure 1.1.0-new-SNAPSHOT > user=> (defprotocol p (foo [this])) > p > user=> (deftype

am i the only one with deftype/defprotocol problems?

2010-01-03 Thread Raoul Duke
hi, i've only heard crickets so far, am i really the only one who can't get this to work? help? :-} thanks. i figure i must be doing something dirt simple wrong? Clojure 1.1.0-new-SNAPSHOT user=> (defprotocol p (foo [this])) p user=> (deftype a [f] [p] (.foo [this])) java.lang.RuntimeException: j

Re: Brainstorming new sequence functions

2010-01-03 Thread Timothy Pratley
2010/1/4 Tom Hicks : > All the other code is there to parallel the functionality in 'subvec'. Ah right, I see what you mean. Calling count in the two argument form will realize the entire sequence unnecessarily. Take and drop are already lazy so no need to call lazy-seq... so if you wanted to expl

Re: Brainstorming new sequence functions

2010-01-03 Thread Tom Hicks
On Jan 3, 7:06 pm, Timothy Pratley wrote: > 2010/1/4 Tom Hicks : > > > Comments and code review welcome > > Hi Tom, > > Some interesting additions. Regarding sub-sequence it might also be > written like so: > > (defn subseq2 >   [coll start end] >   (take (- end start) (drop start coll))) > ; (su

Re: Brainstorming new sequence functions

2010-01-03 Thread Sean Devlin
Tom, The reason you couldn't find a parallel posting is because I didn't make one :) I like the two fns you described, they look useful. You can find all of the sequence fns I'd propose in the two libs below Simple collection fns http://github.com/francoisdevlin/devlinsf-clojure-utils/blob/maste

Re: Brainstorming new sequence functions

2010-01-03 Thread Timothy Pratley
2010/1/4 Tom Hicks : > Comments and code review welcome Hi Tom, Some interesting additions. Regarding sub-sequence it might also be written like so: (defn subseq2 [coll start end] (take (- end start) (drop start coll))) ; (subseq2 [0 1 2 3 4] 1 3) ; = (1 2) There is a clash with core's exis

Re: Clojure + Redis

2010-01-03 Thread Tom Hicks
Have you looked at Neo4J? I have no experience with it but someone in the forum just announced a Clojure wrapper for it: http://groups.google.com/group/clojure/browse_thread/thread/9628c622784ff45a# cheers, -t On Jan 1, 2:07 pm, Julian Morrison wrote: > I've just recently been poking arou

gui repl

2010-01-03 Thread Kevin Downey
I have been playing with a gui repl for clojure: http://github.com/hiredman/Repl instructions are light, but you can check it out, and use lien to jar it up, it is gen-class'ed (but does not require AOt'ing) and has a -main function so you can run it from an uberjar. http://www.thelastcitadel.com/

Re: Sequence to Vector

2010-01-03 Thread Gabi
But that does not exclude the fact that sorted-vec-2 is about %75 times faster than sort On Jan 3, 11:26 pm, Gabi wrote: > It turns out I run the client version. > When running the server version (-server) the performance of sort is 4 > times better. > > On Jan 3, 11:20 pm, Gabi wrote: > > > "1.

Re: Sequence to Vector

2010-01-03 Thread Gabi
It turns out I run the client version. When running the server version (-server) the performance of sort is 4 times better. On Jan 3, 11:20 pm, Gabi wrote: > "1.6.0_17" .It doesn't support this flag: > Unrecognized VM option '+DoEscapeAnalysis' > > On Jan 3, 11:04 pm, Aaron Cohen wrote: > > > W

Re: Sequence to Vector

2010-01-03 Thread Gabi
"1.6.0_17" .It doesn't support this flag: Unrecognized VM option '+DoEscapeAnalysis' On Jan 3, 11:04 pm, Aaron Cohen wrote: > What JVM 6 sub-version are you using? > > Does it make any difference if you specify -XX:+DoEscapeAnalysis at > the command line? Various JVM 6 sub-versions enable and dis

Brainstorming new sequence functions

2010-01-03 Thread Tom Hicks
A couple weeks ago Sean Devlin posted a blog entry asking for thoughts on new sequence functions (and posting many useful proposed functions himself). http://fulldisclojure.blogspot.com/2009/12/new-seq-utilities.html I searched for, but didn't find, a parallel posting in this forum (even though I

Re: Sequence to Vector

2010-01-03 Thread Aaron Cohen
What JVM 6 sub-version are you using? Does it make any difference if you specify -XX:+DoEscapeAnalysis at the command line? Various JVM 6 sub-versions enable and disable it by default and it can make a pretty hefty difference if it isn't enabled. -- Aaron On Sun, Jan 3, 2010 at 4:00 PM, Gabi

Re: Sequence to Vector

2010-01-03 Thread Gabi
I've double checked on my machine (Vista. JVM 6. Clojure 1.1.0). Clojure's sort is is 4 to 5 times slower than sorted-vec2 Maybe somebody with a Vista machine double check this? On Jan 3, 5:51 pm, ianp wrote: > > More findings: The reason that the Clojure's original sort is  8 times > > slower

Re: Lift equivalent

2010-01-03 Thread Andrew Boekhoff
> > As for the OO vs functional . . . a web server is a function from a > > request to a response. How is that functional view any less natural > > than an OO view? > > I think someone steeped in the controller/action viewpoint (a la > Rails) would disagree: they see requests as being parameteriz

Re: Ants: Good Java solution?

2010-01-03 Thread ianp
> In this particular case, the STM system is more important than the > fact that it uses persistent data structures. A Java solution that > didn't have persistent data structures but still had an equivalent STM > could use copy-on-write: it would certainly be slower, but I think it > would work jus

Re: Ants: Good Java solution?

2010-01-03 Thread ianp
> > This is why persistent data structures are so cool: you gain the > > ability to look at consistent snapshots of the world for free. > > it is not impossible to use persistent data structures with plain old > java, by the way :-) True, true, but it's not (yet?) common and there are no persisten

Re: Sequence to Vector

2010-01-03 Thread ianp
> More findings: The reason that the Clojure's original sort is  8 times slower I don’t see that on my machine. I’m running 1.1.0-master-SNAPSHOT with Apple’s Java 6 VM in case that has anything to do with it, but here's what I get (after running the tests several times to warm up hotspot): user=

Re: Sequence to Vector

2010-01-03 Thread ianp
> BTW we have state here (the native Java array). Is it thread safe ? Well, the state doesn’t escape the function so it’s similar to transients in that regard (although without the guarantees that transients provide, but I think that for a fn this short it’s OK). -- You received this message bec

Re: Lift equivalent

2010-01-03 Thread Richard Newman
> Enlive is about as clean as you could ask for in this respect, > though, even cleaner than Lift, so I don't think this is inherently a > language issue. Aye. XML literals aren't really a substitute for templates IMO. > As for the OO vs functional . . . a web server is a function from a > reques

Re: whats the meaning of alias ?

2010-01-03 Thread Richard Newman
> Maybe the reader does _not_ eagerly resolve "c/foo" when the top-level > enclosing form is a "do", but it _does_ eagerly resolve "c/foo" when > the top-level enclosing form is a function? The two forms read are very similar: coretest=> (read-string "(= 1 (do (alias 'c 'coretest)

Re: making sense of condp :>>

2010-01-03 Thread Richard Newman
> thanks for the answer, but I still have a problem understanding why > (or when) I want to use ::>>. The thing I don't understand is, that > the function after :>> is an unary function with the result of the > matching as an argument. But the result of the match will alway be > true, oth

Re: Clojure + Intellij IDEA: stepping through Clojure implementation code

2010-01-03 Thread Miron Brezuleanu
Hello, and thanks everyone for the information. I have this Visual Studio + ClojureCLR + Emacs (last one to run a REPL in a *shell* buffer) setup that I use to experiment with ClojureCLR. What I do is have the REPL in Emacs, attach to it from Visual Studio, set breakpoints, use Immediate Mode etc

Re: Clojure + Intellij IDEA: stepping through Clojure implementation code

2010-01-03 Thread Miron Brezuleanu
Hi Rich, On Sat, Jan 2, 2010 at 7:13 PM, Rich Hickey wrote: > On Fri, Jan 1, 2010 at 5:16 PM, Miron Brezuleanu wrote: > > Hello, > > In order to get a better understanding of how some things happen in > Clojure, > > I'd like to step through Clojure code (and I mean the Java code used to > > imp

Re: whats the meaning of alias ?

2010-01-03 Thread Roger Gilliar
Hi ! Now that you understand it, can you explain it me? :) - I said it makes sense not that I understand it ;-) The make sense part is: Calling alias inside a do is something I probably won't do in production code. It would make more sense to cal

Re: Lift equivalent

2010-01-03 Thread cody koeninger
On Jan 2, 11:50 am, Mike Meyer wrote: > There are definitely some good ideas there - and I agree with most of > the goals. But Lift, like most other page-centric web frameworks, > seems to break one of the fundamental rules of good API design: Simple > things should be simple. Having implemented

Re: SLIME/Swank problem with swank.util.sys/get-pid and RuntimeMXBean

2010-01-03 Thread Steven E. Harris
Rob Wolfe writes: > Do you use "slime-indentation.el" in your configuration? Yes. It turns out that I have another Lisp-related initialization file that contained the following form: , | (slime-setup '(slime-fancy |slime-asdf |slime-fontifying-fu |

Russian speaking members of Clojure community?

2010-01-03 Thread Alex Ott
Hello all I want to ask Russian speaking of Clojure community to contact with me - I'm currently writing article about Clojure for Russian journal of functional programming (http://fprog.ru) and want to ask peoples to review my article when it will finished (i think, during next 10-15 days) -- W

Re: newbie clojure/eclipse question

2010-01-03 Thread Andreas Wenger
Im running counterclockwise too, without this problem. I'm sure the people at the counterclockwise users group can help you, since this here is a more general Clojure discussion group. http://groups.google.com/group/clojuredev-users -- You received this message because you are subscribed to the

newbie clojure/eclipse question

2010-01-03 Thread brian
Hi all, I installed counterclockwise 0.43 in eclipse following the website instructions precisely . Everything seems fine, I created a simple clojure project, when I run it, I get: Could not locate Clojure resource on classpath: x.clj where x.clj is the file I am running (as REPL ) I looked

Re: Sequence to Vector

2010-01-03 Thread Meikel Brandmeyer
Hi, Am 03.01.2010 um 09:29 schrieb Gabi: > BTW we have state here (the native Java array). Is it thread safe ? > >> (defn sorted-vec >> [coll] >> (let [arr (into-array coll)] >> (java.util.Array/sort arr) >> (vec arr))) Since the array is not accessible from outside the function I w

Re: whats the meaning of alias ?

2010-01-03 Thread Mike Hogye
Maybe the reader does _not_ eagerly resolve "c/foo" when the top-level enclosing form is a "do", but it _does_ eagerly resolve "c/foo" when the top-level enclosing form is a function? On Jan 3, 10:02 am, Mike Hogye wrote: > Now that you understand it, can you explain it me? :) > > This simplified

Re: whats the meaning of alias ?

2010-01-03 Thread Mike Hogye
Now that you understand it, can you explain it me? :) This simplified version of your snippet still throws the "No such namespace: c" exception: (ns coretest) (defn foo [x] x) (= 1 (do (alias 'c 'coretest) (c/foo true))) But the following completes without any exceptions:

Re: whats the meaning of alias ?

2010-01-03 Thread Mike Hogye
Wait, I'm an idiot. Ignore my last message ... On Jan 3, 9:39 am, Mike Hogye wrote: > Roger, > > What Clojure version are you using? When I run your snippet with HEAD, > I get: > > FAIL in clojure.lang.persistentlist$emptyl...@1 (blah2.clj:11) > test alias function > expected: (= 1 (do (alias (qu

Re: whats the meaning of alias ?

2010-01-03 Thread Mike Hogye
Roger, What Clojure version are you using? When I run your snippet with HEAD, I get: FAIL in clojure.lang.persistentlist$emptyl...@1 (blah2.clj:11) test alias function expected: (= 1 (do (alias (quote c) (quote coretest actual: (not (= 1 nil)) Which is presumably what you want to see. On

Re: whats the meaning of alias ?

2010-01-03 Thread Roger Gilliar
> As I understand it, the Clojure reader expects to be able to resolve > namespace references as soon as it sees them. Since "alias" is a > function, the "c" alias doesn't exist until sometime after the reader > has already run. I think you will encounter a similar problem with > the import macro

Re: making sense of condp :>>

2010-01-03 Thread Roger Gilliar
Hi thanks for the answer, but I still have a problem understanding why (or when) I want to use ::>>. The thing I don't understand is, that the function after :>> is an unary function with the result of the matching as an argument. But the result of the match will alway be true, otherwise the

Re: Sequence to Vector

2010-01-03 Thread Gabi
More findings: The reason that the Clojure's original sort is 8 times slower than sorted-vec2 is only because Clojure uses its own comparator by default, instead of using Java's default comparator. Otherwise it's same performance. ;Modified clojure.core.clj sort (defn sort2 "Returns a sorted s

Re: Sequence to Vector

2010-01-03 Thread Gabi
I investigated a little bit more. Seems that (into-array) is slows things down because it seqs (un-necessarily?) that vector before passing to clojure.lang.RT/seqToTypedArray. I almost doubled the speed of sorted-vec by using clojure.lang.RT/ toArray: (defn sorted-vec2 [coll] (let [arr (cloju

Re: SLIME/Swank problem with swank.util.sys/get-pid and RuntimeMXBean

2010-01-03 Thread Rob Wolfe
"Steven E. Harris" writes: > "Steven E. Harris" writes: > >> Now get this: Right before the SLIME-Swank connection completes, Emacs >> beeps and prints the following two lines in the *Messages* buffer: >> >> , >> | error in process filter: cond: etypecase failed: defun, (number cons >> stri

Re: Ants: Good Java solution?

2010-01-03 Thread Krukow
On Jan 2, 4:03 pm, ianp wrote: > Yes, exactly. This is the problem with a Java based version (at least > with one that uses the standard collections libraries). At the very > least your reporting function would have to make a complete copy of > the world state while holding the lock, it could t

Re: Sequence to Vector

2010-01-03 Thread Gabi
The sorted-vec is ~4 times faster than Clojure's sort (on my humble old machine): user=> (def v (vec (take 1 (repeatedly #(rand-int 10) #'user/v user=> (time(dotimes [_ 1000] (sort v))) "Elapsed time: 23945.682336 msecs" nil user=> (time(dotimes [_ 1000] (sorted-vec v))) "Elapsed time: