Re: update-in and get-in why no default?

2010-01-02 Thread Timothy Pratley
2010/1/2 Sean Devlin : > I don't think your version of the signature supports variadic defaults well. Hi Sean, Thanks for commenting. Just by way of clarification, taking the function as the last argument seems to work fine in my experiments. I'm sure it could be better but here what I've been u

Re: update-in and get-in why no default?

2010-01-02 Thread Timothy Pratley
2010/1/2 Timothy Pratley : > user=> ((fnil-2 1 +) nil 2 3 4 5) > java.lang.ClassCastException: java.lang.Integer cannot be cast to > clojure.lang.IFn (NO_SOURCE_FILE:0) Correction, I just realized of course it doesn't work if I specify the arguments around the wrong way! I should have done: user=>

Re: Clojure/SLIME/Emacs questions

2010-01-02 Thread Rob Wolfe
Phil Hagelberg writes: > Rob Wolfe writes: > >> Stefan Tilkov writes: >> >>> Two quick Emacs/Clojure questions I can't seem to find the answer to: >>> >>> - In his screencasts, Sean Devlin moves the mouse over an item in his >>> REPL history and it becomes highlighted (and he can paste it to th

Re: Creating deftype instance from inside a protocol method

2010-01-02 Thread Konrad Hinsen
On 01.01.2010, at 23:56, Hugo Duncan wrote: >> I want to create a new instance of a deftype from inside one of its >> methods. > > I ended-up using extend-type for this case. That's probably the cleanest solution, but you lose the performance benefit of defining methods right in the type defini

Ants: Good Java solution?

2010-01-02 Thread Andreas Wenger
Hi, for seminar talk at my university I have to prepare a demo program showing Clojure's concurrency features. I stumbled upon the ants demo presented in Rich Hickey's "Clojure Concurrency" talk ( http://blip.tv/file/812787 ) which I like very much. I began to port the program to Java to demonstr

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

2010-01-02 Thread Laurent PETIT
Don't know about the current IDEA "La Clojure" clojure plugin status. But concerning Eclipse (and its counterclockwise plugin), what you describe here works well AFAIK. It's also possible to place breakpoints on your own .clj files. You can quickly start from here : http://code.google.com/p/coun

New Year and New Library

2010-01-02 Thread Mark Baran
Hey Clojurians, To kick off the New Year, I'm releasing my neo4j wrapper. It has both a comprehensive low level api that lets you deal with nodes and relationships and a higher level api that uses nested hashmaps. Check it out at: http://bitbucket.org/mebaran/appledelhi2 I've also uploaded a v

Re: Proposal: clojure.io

2010-01-02 Thread ianp
> > I wonder if it would be a good idea to include a clojure.io > > namespace in Clojure itself. +1. > > read-lines was left out since ... On the basis that it's less painful to add new stuff in later than to remove stuff I agree that erring on the side of caution in the correct approach. > Ove

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

2010-01-02 Thread ianp
> Now when I try to get a REPL (by using clojure.main as the startup class), I > get an error about clojure/core.clj not being on the classpath. While a very > rough solution would be to just move clj/clojure somewhere on the path, I'd > like to know how to change the classpath for a module. Are y

Re: Creating deftype instance from inside a protocol method

2010-01-02 Thread Jonas Enlund
(note the .) (deftype Bar [i] Foo (foo [] (Bar. (inc i /Jonas -- 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 patien

Re: strange typecheck error

2010-01-02 Thread Alex Ott
Many thanks to you Bill - it works! .Bill Smith at "Fri, 1 Jan 2010 10:44:37 -0800 (PST)" wrote: .S> Happy New Year to you, Alex. .S> I reproduced the problem as follows: .S> user=> (loop [x (byte 0) count 0] .S> (if (< count 10) (recur 0 (inc count .S> java.lang.RuntimeException: ja

swank-clojure installation failure via ELPA

2010-01-02 Thread Mike K
Hi all, I'm trying to get all the latest and greatest swank-clojure 1.1.0 goodness via ELPA, but no joy. I'm starting with an absolutely clean slate. I'm running a freshly installed emacs 23.1.1 on Windows 7. I have a blank .emacs file and no elpa subdirectory under .emacs.d. I install elpa an

Re: New Year and New Library

2010-01-02 Thread Tobias Ivarsson
Cool stuff Mark! Hope you don't mind me forwarding this to the Neo4j community. Happy new year! /Tobias On Fri, Jan 1, 2010 at 5:16 PM, Mark Baran wrote: > Hey Clojurians, > > To kick off the New Year, I'm releasing my neo4j wrapper. It has both a > comprehensive low level api that lets you d

Re: Clojure 1.1 release

2010-01-02 Thread ngocdaothanh
If http://build.clojure.org/snapshots is official, I think it is great to add a link to it to the homepage of Clojure. On Jan 2, 3:01 pm, Phil Hagelberg wrote: > Howard Lewis Ship writes: > > > Is this available via a Maven repo yet and, if so, what version of > > clojure-contrib is compatible

making sense of condp :>>

2010-01-02 Thread Roger Gilliar
Hi, I'm just trying to understand why I would use :>> in a condp expression. The followjg code shows how I tried to write a test for condp, but the question remains. Why would I want to use :>> ? Regards Roger (defn foo [x] (println x) (condp = x true 1

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

2010-01-02 Thread Steven E. Harris
Phil Hagelberg writes: > But I'm not quite following on the exact problem and specific repro > case; could you clarify? Yes. When I start SLIME, the Swank back-end starts and presents the Clojure REPL in the *inferior-lisp* buffer. Right after that, the SLIME front-end sends an "Emacs REX" comma

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

2010-01-02 Thread Steven E. Harris
"Steven E. Harris" writes: > it takes calling RuntimeMXBean#get() -- actually using the > RuntimeMXBean instance -- to unblock the other thread. I meant RuntimeMXBean#getName() there. My typing is poor this morning. -- Steven E. Harris -- You received this message because you are subscribed

Lift equivalent

2010-01-02 Thread ngocdaothanh
Scala has Lift with many advanced features: http://blog.lostlake.org/index.php?/archives/16-Web-Framework-Manifesto.html http://blog.lostlake.org/index.php?/archives/25-Why-the-world-needs-another-web-framework.html If a similar (or better) web framework is written in Clojure, how will it be imple

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

2010-01-02 Thread Rob Wolfe
"Steven E. Harris" writes: [...] > Here's the stack: > > o swank-clojure > Git head. > > o SLIME > Both CVS head and git://git.boinkor.net/slime.git head behave the same > way, as the offending calls are in swank-clojure. > > o Clojure 1.1.0 > Downloaded Jar from code.google.com. > > o G

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

2010-01-02 Thread Steven E. Harris
Rob Wolfe writes: > Unfortunately I have no idea what is the reason of this problem, That makes two of us. > but I'm curious what Java version are you using? user=> (map #(System/getProperty %) ["java.version" "java.vendor" "java.vm.version"]) ("1.6.0_17" "Sun Microsystems Inc." "1

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

2010-01-02 Thread Steven E. Harris
"Steven E. Harris" writes: > In the meantime, I'll continue the investigation. Here are two thread dumps of the Java process running Clojure and Swank, which, at this time, has a live Clojure REPL, but the Swank call to `connection-info' hasn't completed yet. This first one comes via jvisualvm:

Re: swank-clojure installation failure via ELPA

2010-01-02 Thread Shawn Hoover
Hi Mike, Is there anything useful going on in *messages*? On Sat, Jan 2, 2010 at 9:07 AM, Mike K wrote: > Hi all, > > I'm trying to get all the latest and greatest swank-clojure 1.1.0 > goodness via ELPA, but no joy. I'm starting with an absolutely clean > slate. I'm running a freshly install

Re: Clojure/SLIME/Emacs questions

2010-01-02 Thread Phil Hagelberg
Rob Wolfe writes: >> installation from ELPA, and William Douglas is working on adding fuzzy >> completion to that. It's highly recommended that you follow this > > I will, if it will work. > >> approach rather than copying and pasting several pages of one-off >> configuration. For instance, addin

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

2010-01-02 Thread Steven E. Harris
"Steven E. Harris" writes: > In the meantime, I'll continue the investigation. And yet more information: Apparently it's not critical to call on the RuntimeMXBean#getName() method specifically to kick the Swank thread out of its blocking call; just about /any call on a Java method/ from the Cloj

Re: Ants: Good Java solution?

2010-01-02 Thread ianp
> … if you want > to create a report with a consistent view of the program's state in a > certain point of time. What does that mean in Java? Do we need a > "global lock" for that? But then, I have to use the same global lock > on all writing operations, too? This results in destroying all > concur

Re: Creating deftype instance from inside a protocol method

2010-01-02 Thread Jonas Enlund
Sorry, I think my reply got lost... Inside deftype methods the symbol "Bar" is the name of the class. You can use the constructor (Bar. (inc i)) instead. Again, note the "." after Bar. On Sat, Jan 2, 2010 at 1:23 PM, Konrad Hinsen wrote: > On 01.01.2010, at 23:56, Hugo Duncan wrote: > >>> I want

Re: Creating deftype instance from inside a protocol method

2010-01-02 Thread Meikel Brandmeyer
Hi, Am 02.01.2010 um 12:23 schrieb Konrad Hinsen: > (deftype Bar > [i] > Foo > (foo [] (new Bar (inc i > > Its drawback is relying on an undocumented feature: the value of Foo > inside the methods is the class Foo being defined. Isn't this only the case for AOT compiled deftype? F

Re: Processing list more elegantly

2010-01-02 Thread Rich Hickey
On Wed, Dec 30, 2009 at 4:07 AM, Timothy Pratley wrote: > 2009/12/30 Rich Hickey : >> This was discussed before, the new version never made it into a patch: >> http://groups.google.com/group/clojure/msg/43de40f078a291cc > > Great! > > The 'old' reductions behaves slightly different from the 'new'

Re: Small problem with sets documentation.

2010-01-02 Thread Rich Hickey
On Tue, Dec 29, 2009 at 8:06 PM, Nicolas Buduroi wrote: > Hi, just to warn that there's a small problem with sets documentation > in the data structures page of Clojure's website. The hyperlinks to > set operations and pseudo-relational algebra are broken as they > haven't followed the move to the

Re: Creating deftype instance from inside a protocol method

2010-01-02 Thread Rich Hickey
On Sat, Jan 2, 2010 at 6:23 AM, Konrad Hinsen wrote: > On 01.01.2010, at 23:56, Hugo Duncan wrote: > >>> I want to create a new instance of a deftype from inside one of its >>> methods. >> >> I ended-up using extend-type for this case. > > That's probably the cleanest solution, but you lose the pe

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

2010-01-02 Thread Rich Hickey
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 > implement Clojure). Basically, just debug a REPL, set breakpoints etc. > Since

Re: import as a macro; dynamic imports?

2010-01-02 Thread Rich Hickey
On Fri, Jan 1, 2010 at 2:58 PM, Stuart Sierra wrote: > I should have brought this up before 1.1 was released, but I'm > bothered by the change of clojure.core/import from a function to a > macro. > > If I'm creating a namespace dynamically, I can't evaluate the name of > the class I want to pass t

Re: swank-clojure installation failure via ELPA

2010-01-02 Thread Mike K
On Jan 2, 9:13 am, Shawn Hoover wrote: > Hi Mike, > > Is there anything useful going on in *messages*? Here is the contents of *Messages*: Contacting host: tromey.com:80 Reading [text/plain]... 4k of 4k (100%) Reading... done. Reading [text/plain]... 54k of 54k (100%) Saving file c:/mbk/.emacs.d

Re: Lift equivalent

2010-01-02 Thread Mike Meyer
On Sat, 2 Jan 2010 07:01:20 -0800 (PST) ngocdaothanh wrote: > Scala has Lift with many advanced features: > http://blog.lostlake.org/index.php?/archives/16-Web-Framework-Manifesto.html > http://blog.lostlake.org/index.php?/archives/25-Why-the-world-needs-another-web-framework.html There are defi

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

2010-01-02 Thread Rich Hickey
On Sat, Jan 2, 2010 at 11:03 AM, Steven E. Harris wrote: > "Steven E. Harris" writes: > >> In the meantime, I'll continue the investigation. > > Here are two thread dumps of the Java process running Clojure and Swank, > which, at this time, has a live Clojure REPL, but the Swank call to > `connec

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

2010-01-02 Thread Richard Newman
> Perhaps it would be best to paste such dumps somewhere, rather than > mail to the entire list? Might I suggest http://paste.lisp.org/ ? -- 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

Re: Lift equivalent

2010-01-02 Thread Matt
The closest thing to Lift in Clojure right now is probably Conjure: http://github.com/macourtney/Conjure Tutorial on Conjure: http://wiki.github.com/macourtney/Conjure/hello-world-tutorial It's closer to Rails than Lift. I've looked at Lift and didn't see much advantage of it over a Rails like f

Re: swank-clojure installation failure via ELPA

2010-01-02 Thread Shawn Hoover
I believe you're running into the same coding issue that I did with ELPA on Windows. slime.el declares in its local variables that it has unix line endings, but ELPA's download process is saving it with windows line endings. Here's the pseudopatch I submitted to ELPA. You can hack up your .emacs.d

Re: Ants: Good Java solution?

2010-01-02 Thread Raoul Duke
> 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 :-) -- You received this message because you are subscribed to the Google Gro

Re: Sequence to Vector

2010-01-02 Thread ianp
> A bit uglier, but ought to be quite fast. It doesn't need to be that ugly: (defn sorted-vec [coll] (doto (into-array coll) (java.util.Arrays/sort) (vec))) looks OK to me at least. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post

Re: Sequence to Vector

2010-01-02 Thread ianp
> A bit uglier, but ought to be quite fast. Doesn't need to be that ugly, this looks OK to me at least: (defn sorted-vec [coll] (doto (into-array coll) (java.util.Arrays/sort) (vec))) It'd also be possible to generalise the return type by passing in a fn to apply to the sorted array.

whats the meaning of alias ?

2010-01-02 Thread Roger Gilliar
Hi ! Given the code below, I'm wondering why I get No such namespace: c It would be nice if some could explain to me what I'm doing wrong. Regards Roger (ns coretest (:use [clojure.test]) ) (defn foo [x] (condp = x true 1 false 2

Re: Clojure 1.1 release

2010-01-02 Thread Howard Lewis Ship
Generally with Maven you want to seperate snapshots from final releases; I'd be more confortable with http://build.clojure.org/repo or http://build.clojure.org/maven as the root path. On Sat, Jan 2, 2010 at 6:23 AM, ngocdaothanh wrote: > If http://build.clojure.org/snapshots is official, I think

Re: swank-clojure installation failure via ELPA

2010-01-02 Thread Mike K
On Jan 2, 12:18 pm, Shawn Hoover wrote: > I believe you're running into the same coding issue that I did with ELPA on > Windows. slime.el declares in its local variables that it has unix line > endings, but ELPA's download process is saving it with windows line endings. > > Here's the pseudopatch

Re: swank-clojure installation failure via ELPA

2010-01-02 Thread Phil Hagelberg
Mike K writes: > That did the trick, but now I have another question. How do I set up > additional entries on my classpath now that I've installed via elpa > and moved to 1.1.0? Check the swank-clojure readme. What you're probably looking for is M-x swank-clojure-project. -Phil -- You receiv

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

2010-01-02 Thread Steven E. Harris
Rich Hickey writes: > Perhaps it would be best to paste such dumps somewhere, rather than > mail to the entire list? I'll do that next time. Sorry for the noise. -- Steven E. Harris -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this

Re: swank-clojure installation failure via ELPA

2010-01-02 Thread Mike K
I'm up and running again. Thank you very much Shawn and Phil! Phil: For the sake of other Windows users, I suggest adding a pointer to the patched package.el in the readme until the issue is resolved. Mike -- You received this message because you are subscribed to the Google Groups "Clojure

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

2010-01-02 Thread Steven E. Harris
"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 string) > | error in process filter: etypecas

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

2010-01-02 Thread Ilya Sergey
Hello, Miron. to debug your Clojure scripts in IntelliJ with the appropriate plugin installed, just create new run configuration for .clj file. It may be created automatically via Ctrl(Meta)-Shift-F10 default shortcut. After this you can run it in REPL mode or as a standalone script and put break

Re: whats the meaning of alias ?

2010-01-02 Thread Mike Hogye
I can't seem to find the explanation I once saw for this. It's something like: "c/foo" is resolved when the "do" form is _read_ ... at which point the alias hasn't happened yet. On Jan 2, 3:14 pm, Roger Gilliar wrote: > Hi ! > > Given the code below, I'm wondering why I get > > No such namespace:

Re: whats the meaning of alias ?

2010-01-02 Thread Mike Hogye
Here's what I was thinking of: http://groups.google.com/group/clojure/browse_thread/thread/c093ac2c7e7302ab I believe it's the same phenomenon. On Jan 2, 8:03 pm, Mike Hogye wrote: > I can't seem to find the explanation I once saw for this. It's > something like: "c/foo" is resolved when the "d

Re: whats the meaning of alias ?

2010-01-02 Thread .Bill Smith
Mike, are you referring to this: http://groups.google.com/group/clojure/browse_thread/thread/b4704108d85693d0/84dd4b690b6d7afd?lnk=gst&q=alias#84dd4b690b6d7afd ? Roger, I realize this invalidates your test, but if do this instead, the error goes away: (alias 'c 'coretest) (testing "test alias fun

Re: Clojure 1.1 release

2010-01-02 Thread Brian Schlining
Howard's correct. Generally, SNAPSHOTs and releases are kept in separate repositories. It's not required, but it allows a user to configure their maven pom to grab the latest release of a dependency (for example using syntax like [1.0, ) . If you mix releases and snapshots in a single repo, then a

Re: Clojure 1.1 release

2010-01-02 Thread Brian Schlining
p.s. Here's a little example of using different repos at Google's official maven repo: http://code.google.com/p/google-maven-repository/wiki/ProjectSetup On Sat, Jan 2, 2010 at 12:47, Brian Schlining wrote: > Howard's correct. Generally, SNAPSHOTs and releases are kept > in separate repositories

Re: Sequence to Vector

2010-01-02 Thread Meikel Brandmeyer
Hi, Am 02.01.2010 um 20:17 schrieb ianp: >> A bit uglier, but ought to be quite fast. > > Doesn't need to be that ugly, this looks OK to me at least: > > (defn sorted-vec [coll] > (doto (into-array coll) >(java.util.Arrays/sort) >(vec))) > > It'd also be possible to generalise the ret

Re: making sense of condp :>>

2010-01-02 Thread Meikel Brandmeyer
Hi, Am 02.01.2010 um 15:23 schrieb Roger Gilliar: > I'm just trying to understand why I would use :>> in a condp expression. The > followjg code shows how I tried to write a test for condp, but the question > remains. Why would I want to use :>> ? See here: http://groups.google.com/group/cloju

Re: Clojure 1.1 release

2010-01-02 Thread Phil Hagelberg
Brian Schlining writes: > Howard's correct. Generally, SNAPSHOTs and releases are kept > in separate repositories. It's not required, but it allows a user to > configure their maven pom to grab the latest release of a dependency > (for example using syntax like [1.0, ) . If you mix > releases and

Re: Creating deftype instance from inside a protocol method

2010-01-02 Thread Konrad Hinsen
On 02.01.2010, at 18:16, Rich Hickey wrote: > That's documented: > > ;from (doc deftype) > > "In the method bodies, the (unqualified) name can be used to name the > class (for calls to new, instance? etc)." Thanks, that solves the problem perfectly well! Konrad. -- You received this message b