Re: Creating deftype instance from inside a protocol method
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 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Clojure 1.1 release
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 snapshots in a single repo, then a build configured to > grab the latest version will grab a SNAPSHOT and not a release; > probably not what the user intended. I can see the utility of having a stable-only repository, but I don't see the point of keeping stable versions out of the other one. Anyway, I hope to have a stable-only repository available soon on build.clojure.org, I just haven't gotten around to figuring it out yet. -Phil -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: making sense of condp :>>
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/clojure/msg/d9ef152e19f5416b It always interesting when the return value of the testing function is of interest. Eg. with some… (condp some foo #{a b} :>> do-stuff-with-a-or-b #{x y} :>> same-with-x-or-y do-default) So here it is interesting what was actually the match… Sincerely Meikel -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Sequence to Vector
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 return type by passing in a fn > to apply to the sorted array. Unfortunately the above code does not work, because it returns the array and not the vector. (defn sorted-vec [coll] (let [arr (into-array coll)] (java.util.Array/sort arr) (vec arr))) How fast is vec on an array? Isn't there a LazilyPersistentVector which just wraps the array? Sincerely Meikel -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Clojure 1.1 release
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. 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 build configured to grab the latest > version will grab a SNAPSHOT and not a release; probably not what the user > intended. > > 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 it is great >> > to add a link to it to the homepage of Clojure. > > -- > ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ > Brian Schlining > bschlin...@gmail.com > -- ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Brian Schlining bschlin...@gmail.com -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Clojure 1.1 release
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 build configured to grab the latest version will grab a SNAPSHOT and not a release; probably not what the user intended. 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 it is great > > to add a link to it to the homepage of Clojure. -- ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Brian Schlining bschlin...@gmail.com -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: whats the meaning of alias ?
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 function" (is (= 1 (do (c/foo true) 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. > 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: 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 > > ) > > ) > > > (testing "test alias function" > > (is (= 1 > > (do > > (alias 'c 'coretest) > > (c/foo true) > > -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: whats the meaning of alias ?
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 "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: 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 > > ) > > ) > > > (testing "test alias function" > > (is (= 1 > > (do > > (alias 'c 'coretest) > > (c/foo true) > > -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: whats the meaning of alias ?
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: 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 > ) > ) > > (testing "test alias function" > (is (= 1 > (do > (alias 'c 'coretest) > (c/foo true) > -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Clojure + Intellij IDEA: stepping through Clojure implementation code
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 breakpoints if you run it in debug mode (Shift-F9 by default). If you have clojure.jar in one of the libraries you had attached to the module it will be automatically included to the classpath. Normally, when you create a new project clojure.jar is suggested to be downloaded automatically. With best regards, Ilya 2010/1/2 Miron Brezuleanu > 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 there's a free version of IDEA, I downloaded it and successfully > created an IDEA project out of existing Clojure sources. > > 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. > > I did try playing with the module settings and add a 'library' which has a > path to clj/clojure, but I must be doing something wrong, as it doesn't seem > to affect the -cp option of the java invocation (I'm checking this using the > output window). > > Since I am a complete IDEA newbie, I'd be very happy if someone who is > using IDEA to work on Clojure can provide a few pointers. I don't mind > trying this with Eclipse, so Eclipse advice is welcome too. > > Many thanks and Happy New Year everyone, > -- > Miron Brezuleanu > > -- > 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 with > your first post. > To unsubscribe from this group, send email to > clojure+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/clojure?hl=en -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: SLIME/Swank problem with swank.util.sys/get-pid and RuntimeMXBean
"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: etypecase failed: defun, (number cons string) > ` I caught the Emacs debugger trace here: http://paste.lisp.org/display/92936 It looks to be a problem parsing the indentation recommendations sent from Swank. -- Steven E. Harris -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: swank-clojure installation failure via ELPA
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" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: SLIME/Swank problem with swank.util.sys/get-pid and RuntimeMXBean
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 group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: swank-clojure installation failure via ELPA
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 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: swank-clojure installation failure via ELPA
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 I submitted to ELPA. You can hack up your > .emacs.d/elpa.package.el and then reinstall those packages. 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? I used to do something like the following: (swank-clojure-config ;; ... (setq swank-clojure-extra-classpaths (list ;; ... ) ) ) However, swank-clojure-config is no longer recognized. Mike -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Clojure 1.1 release
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 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 (and stable?). >> >> I just added the 1.1.x branch to build.clojure.org, so you can >> usehttp://build.clojure.org/snapshotsto get it. It looks like contrib has >> finally had its version number bumped, though it hasn't had an official >> release, so 1.1.0-master-SNAPSHOT works for it. >> >> -Phil > > -- > 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 with your > first post. > To unsubscribe from this group, send email to > clojure+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/clojure?hl=en -- Howard M. Lewis Ship Creator of Apache Tapestry The source for Tapestry training, mentoring and support. Contact me to learn how I can get you up and productive in Tapestry fast! (971) 678-5210 http://howardlewisship.com -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
whats the meaning of alias ?
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 ) ) (testing "test alias function" (is (= 1 (do (alias 'c 'coretest) (c/foo true) -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Sequence to Vector
> 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. -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Sequence to Vector
> 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 to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Ants: Good Java solution?
> 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 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: swank-clojure installation failure via ELPA
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/elpa.package.el and then reinstall those packages. (defun package-write-file-no-coding (file-name excl) (setq buffer-file-coding-system 'no-conversion) (write-region (point-min) (point-max) file-name nil nil nil excl)) (defun package-unpack-single (file-name version desc requires) "Install the contents of the current buffer as a package." (let* ((dir (file-name-as-directory package-user-dir))) ;; Special case "package". (if (string= file-name "package") -(write-region (point-min) (point-max) (concat dir file-name ".el") - nil nil nil nil) + (package-write-file-no-coding (concat dir file-name ".el") nil) (let ((pkg-dir (file-name-as-directory (concat dir file-name "-" version (make-directory pkg-dir t) -(write-region (point-min) (point-max) - (concat pkg-dir file-name ".el") - nil nil nil 'excl) + (package-write-file-no-coding (concat pkg-dir file-name ".el") 'excl) On Sat, Jan 2, 2010 at 12:35 PM, Mike K wrote: > 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/elpa/package.el... > Wrote c:/mbk/.emacs.d/elpa/package.el > Loading c:/mbk/.emacs.d/elpa/package.el (source)...done > Saving file c:/mbk/_emacs... > Delete excess backup versions of c:/mbk/_emacs? (y or n) > Wrote c:/mbk/_emacs > Contacting host: tromey.com:80 > Reading [text/plain]... 9k of 9k (100%) > Saving file c:/mbk/.emacs.d/elpa/archive-contents... > Wrote c:/mbk/.emacs.d/elpa/archive-contents > Reading [text/plain]... 575 bytes of 563 bytes (102%) > Saving file c:/mbk/.emacs.d/elpa/builtin-packages... > Wrote c:/mbk/.emacs.d/elpa/builtin-packages > Contacting host: tromey.com:80 > Reading [text/plain]... 25k of 25k (100%) > Wrote c:/mbk/.emacs.d/elpa/clojure-mode-1.6/clojure-mode.el > Wrote c:/mbk/.emacs.d/elpa/clojure-mode-1.6/clojure-mode-pkg.el > Warning: defvar ignored because generated-autoload-file is let-bound > Wrote c:/mbk/.emacs.d/elpa/clojure-mode-1.6/clojure-mode-autoloads.el > Generating autoloads for clojure-mode-pkg.el...done > Generating autoloads for clojure-mode.el...done > Saving file c:/mbk/.emacs.d/elpa/clojure-mode-1.6/clojure-mode- > autoloads.el... > Wrote c:/mbk/.emacs.d/elpa/clojure-mode-1.6/clojure-mode-autoloads.el > (No changes need to be saved) > (No files need saving) > Checking c:/mbk/.emacs.d/elpa/clojure-mode-1.6/... [2 times] > Compiling c:/mbk/.emacs.d/elpa/clojure-mode-1.6/clojure-mode- > pkg.el...done > Wrote c:/mbk/.emacs.d/elpa/clojure-mode-1.6/clojure-mode-pkg.elc > Checking c:/mbk/.emacs.d/elpa/clojure-mode-1.6/... > Compiling c:/mbk/.emacs.d/elpa/clojure-mode-1.6/clojure-mode.el...done > Wrote c:/mbk/.emacs.d/elpa/clojure-mode-1.6/clojure-mode.elc > Checking c:/mbk/.emacs.d/elpa/clojure-mode-1.6/... > Done (Total of 2 files compiled, 1 skipped) > Contacting host: tromey.com:80 > Reading [text/plain]... 347k of 347k (100%) > Wrote c:/mbk/.emacs.d/elpa/slime-20091016/slime.el > Wrote c:/mbk/.emacs.d/elpa/slime-20091016/slime-pkg.el > Wrote c:/mbk/.emacs.d/elpa/slime-20091016/slime-autoloads.el > Generating autoloads for slime-pkg.el...done > hack-local-variables: Local variables entry is missing the suffix > > > Here is the contents of *Compile-Log*: > > Compiling file c:/mbk/.emacs.d/elpa/clojure-mode-1.6/clojure-mode- > pkg.el at Sat Jan 02 10:30:21 2010 > > Compiling file c:/mbk/.emacs.d/elpa/clojure-mode-1.6/clojure-mode.el > at Sat Jan 02 10:30:21 2010 > > In clojure-mode: > clojure-mode.el:196:34:Warning: reference to free variable `paredit- > mode' > clojure-mode.el:196:51:Warning: reference to free variable `paredit- > version' > > In clojure-font-lock-extend-region-def: > clojure-mode.el:232:33:Warning: reference to free variable `font-lock- > beg' > clojure-mode.el:239:30:Warning: assignment to free variable `font-lock- > beg' > clojure-mode.el:240:33:Warning: reference to free variable `font-lock- > end' > clojure-mode.el:242:19:Warning: assignment to free variable `font-lock- > end' > > In clojure-font-lock-extend-region-comment: > clojure-mode.el:257:26:Warning: reference to free variable `font-lock- > beg' > clojure-mode.el:254:49:Warning: reference to free variable `font-lock- > end' > clojure-mode.el:258:17:Warning: assignment to free variable `font-lock- > beg' > clojure-mode.el:262:17:Warning: assignment to free variable `font-lock- > end' > > In clojure-indent-function: > clojure-m
Re: Lift equivalent
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 framework. Though, I didn't spend much time with it. > 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. There are no xml files or partial html template languages to learn for Conjure. Everything is written in Clojure. Html templates are like the templates used in Compojure. Configuration files are simply Clojure source files. This does have some disadvantages, but I think keeping everything in the same language will help far more than it will hurt. I've only tentatively looked at Seaside, but I will be looking into adding continuations to Conjure in future versions. Right now, we're working on getting the 0.4 version out the door. > Good question. I'm not a Java person - I looked at it a decade ago, > decided it wasn't mature yet, and have been ignoring it since. I now > find myself thrown into the deep end evaluating Java web frameworks to > see if any can be co-opted for what I have in mind. Seems like the > natural place to start is the ability to build servlets, and those can > be grafted into whatever larger framework the user wants, but another > two days of wading through documentation could change my mind. Conjure uses the following libraries, you may find some of them useful if you create your own framework: clj-html clj-record ring h2 (database) jetty -Matt P.S. We're looking for more contributors to Conjure. If you or someone you know would like to get involved, sign up on our google group at: http://groups.google.com/group/clojure-conjure -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: SLIME/Swank problem with swank.util.sys/get-pid and RuntimeMXBean
> 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 Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: SLIME/Swank problem with swank.util.sys/get-pid and RuntimeMXBean
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 > `connection-info' hasn't completed yet. > Perhaps it would be best to paste such dumps somewhere, rather than mail to the entire list? Thanks, Rich -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Lift equivalent
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 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. I.e. - the simple "hello world" application requires three different files in three different languages (or two, if you consider two different XML schema to be "the same language"). This can hardly be considered simple. Why on earth should it take more than one beyond whatever it takes to connect it to a web framework? > If a similar (or better) web framework is written in Clojure, how will > it be implemented? I've spent the last few days contemplating just this question. More accurately, I've been considering how to build a web framework modeled on Seaside for Clojure. After looking at the Lift documentation, it's clear that Clojure has two major disadvantages when compared to Scala for doing this kind of thing: 1) Support for XML as a primitive type. That's just way cool. 2) The web has a natural mapping to OO concepts, so the mixed functional/oo model in Scala helps a lot. Basically, the issues I've been dealing with for Clojure become trivial with Scala. > Which existing Java libraries can be used to save time? Good question. I'm not a Java person - I looked at it a decade ago, decided it wasn't mature yet, and have been ignoring it since. I now find myself thrown into the deep end evaluating Java web frameworks to see if any can be co-opted for what I have in mind. Seems like the natural place to start is the ability to build servlets, and those can be grafted into whatever larger framework the user wants, but another two days of wading through documentation could change my mind. http://www.mired.org/consulting.html Independent Network/Unix/Perforce consultant, email for more information. O< ascii ribbon campaign - stop html mail - www.asciiribbon.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 Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: swank-clojure installation failure via ELPA
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/elpa/package.el... Wrote c:/mbk/.emacs.d/elpa/package.el Loading c:/mbk/.emacs.d/elpa/package.el (source)...done Saving file c:/mbk/_emacs... Delete excess backup versions of c:/mbk/_emacs? (y or n) Wrote c:/mbk/_emacs Contacting host: tromey.com:80 Reading [text/plain]... 9k of 9k (100%) Saving file c:/mbk/.emacs.d/elpa/archive-contents... Wrote c:/mbk/.emacs.d/elpa/archive-contents Reading [text/plain]... 575 bytes of 563 bytes (102%) Saving file c:/mbk/.emacs.d/elpa/builtin-packages... Wrote c:/mbk/.emacs.d/elpa/builtin-packages Contacting host: tromey.com:80 Reading [text/plain]... 25k of 25k (100%) Wrote c:/mbk/.emacs.d/elpa/clojure-mode-1.6/clojure-mode.el Wrote c:/mbk/.emacs.d/elpa/clojure-mode-1.6/clojure-mode-pkg.el Warning: defvar ignored because generated-autoload-file is let-bound Wrote c:/mbk/.emacs.d/elpa/clojure-mode-1.6/clojure-mode-autoloads.el Generating autoloads for clojure-mode-pkg.el...done Generating autoloads for clojure-mode.el...done Saving file c:/mbk/.emacs.d/elpa/clojure-mode-1.6/clojure-mode- autoloads.el... Wrote c:/mbk/.emacs.d/elpa/clojure-mode-1.6/clojure-mode-autoloads.el (No changes need to be saved) (No files need saving) Checking c:/mbk/.emacs.d/elpa/clojure-mode-1.6/... [2 times] Compiling c:/mbk/.emacs.d/elpa/clojure-mode-1.6/clojure-mode- pkg.el...done Wrote c:/mbk/.emacs.d/elpa/clojure-mode-1.6/clojure-mode-pkg.elc Checking c:/mbk/.emacs.d/elpa/clojure-mode-1.6/... Compiling c:/mbk/.emacs.d/elpa/clojure-mode-1.6/clojure-mode.el...done Wrote c:/mbk/.emacs.d/elpa/clojure-mode-1.6/clojure-mode.elc Checking c:/mbk/.emacs.d/elpa/clojure-mode-1.6/... Done (Total of 2 files compiled, 1 skipped) Contacting host: tromey.com:80 Reading [text/plain]... 347k of 347k (100%) Wrote c:/mbk/.emacs.d/elpa/slime-20091016/slime.el Wrote c:/mbk/.emacs.d/elpa/slime-20091016/slime-pkg.el Wrote c:/mbk/.emacs.d/elpa/slime-20091016/slime-autoloads.el Generating autoloads for slime-pkg.el...done hack-local-variables: Local variables entry is missing the suffix Here is the contents of *Compile-Log*: Compiling file c:/mbk/.emacs.d/elpa/clojure-mode-1.6/clojure-mode- pkg.el at Sat Jan 02 10:30:21 2010 Compiling file c:/mbk/.emacs.d/elpa/clojure-mode-1.6/clojure-mode.el at Sat Jan 02 10:30:21 2010 In clojure-mode: clojure-mode.el:196:34:Warning: reference to free variable `paredit- mode' clojure-mode.el:196:51:Warning: reference to free variable `paredit- version' In clojure-font-lock-extend-region-def: clojure-mode.el:232:33:Warning: reference to free variable `font-lock- beg' clojure-mode.el:239:30:Warning: assignment to free variable `font-lock- beg' clojure-mode.el:240:33:Warning: reference to free variable `font-lock- end' clojure-mode.el:242:19:Warning: assignment to free variable `font-lock- end' In clojure-font-lock-extend-region-comment: clojure-mode.el:257:26:Warning: reference to free variable `font-lock- beg' clojure-mode.el:254:49:Warning: reference to free variable `font-lock- end' clojure-mode.el:258:17:Warning: assignment to free variable `font-lock- beg' clojure-mode.el:262:17:Warning: assignment to free variable `font-lock- end' In clojure-indent-function: clojure-mode.el:397:33:Warning: reference to free variable `calculate-lisp-indent-last-sexp' In clojure-slime-config: clojure-mode.el:574:11:Warning: assignment to free variable `swank-clojure-classpath' In end of data: clojure-mode.el:684:1:Warning: the following functions are not known to be defined: imenu--generic-function, inferior-lisp-proc, switch-to-lisp, slime-setup, swank-clojure-slime-mode-hook Mike -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Clojure + Intellij IDEA: stepping through Clojure implementation code
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 there's a free version of IDEA, I downloaded it and successfully > created an IDEA project out of existing Clojure sources. > 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. > I did try playing with the module settings and add a 'library' which has a > path to clj/clojure, but I must be doing something wrong, as it doesn't seem > to affect the -cp option of the java invocation (I'm checking this using the > output window). > Since I am a complete IDEA newbie, I'd be very happy if someone who is using > IDEA to work on Clojure can provide a few pointers. I don't mind trying this > with Eclipse, so Eclipse advice is welcome too. > Many thanks and Happy New Year everyone, > -- I developed Clojure in IntelliJ and still do (the Java part). In your Run/Debug configuration: Main class: clojure.main VM Parameters: -server -cp clojure-slim.jar Working directory: /wherever/you/put/clojure Before launch: Run Ant target 'clojure-slim' This will give you REPL in IntelliJ's IDE. That's not a great REPL, but will let you walk through Clojure internals. With La Clojure you can also break in .clj files. Rich -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: import as a macro; dynamic imports?
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 to import. The only way is to use > undocumented Java functions, like: > > (defn import-name > "Import a class named c (a String) into namespace n." > [n c] > (.importClass n (clojure.lang.RT/classForName c))) > > Of course, I can write a macro that evaluates the strings, but that's > not really what I want. I want the equivalent of clojure.core/intern > for classes. Is there a better way? > Your example highlights the problem addressed by making import a macro. Basically, Class.forName can't be proxied, i.e. any indirection (such as wrapping it in a helper function like you did) breaks the magic hack inside Class.forName that finds the classloader of the caller by walking a fixed distance on the stack. Thus, such proxied imports don't play well with specialized modular classloading architectures (like OSGi etc) that expect you to be calling Class.forName for any dynamic use. In such cases, you will be seeing what the classloader of the wrapping function can see, rather than what the caller can see. On the path towards fixing this, I've added a (currently undocumented) special op - clojure.core/import*, which will emit bytecode for a call to Class.forName at the point of call (plus all the other stuff needed to bind in the current namespace). This will ensure correct resolution in the classloader of the caller. import expands into calls to import*. Note it is String-based. This too is critical. user=> (clojure.core/import* "java.util.List") java.util.List user=> List java.util.List Note that, as a special op, import* still is not a function. The bottom line is no ordinary function or method can do this job. If you want to use import* as a workaround, please consider it alpha and subject to change. Rich -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Processing list more elegantly
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' > reductions for the 3 argument form: > foo=> (reductions + 0 [3 5 10 1 2 7]) > (0 3 8 18 19 21 28) > foo=> (reductions2 + 0 [3 5 10 1 2 7]) > (3 8 18 19 21 28) > > Which output is more correct? The former. > On the one hand supplying a preserved > 'initial value' from outside does not make much sense, but on the > other hand perhaps it is more in step with 3 argument reduce. > > Does it matter? Probably not. It does provide an interesting case > study. The 3 argument form could be considered just a helper to > achieve the 2 argument form, but because it is part of the public > interface people may chose to rely on it: > (defn left-total3 [coll] > (map list coll (reductions + 0 coll))) > might have been better written as > (defn left-total3 [coll] > (map list coll (cons 0 (reductions + coll > So is exposing the 3 argument version a bad thing? It is not very > idiomatic to use the alternatives: > (let-fn [(reducer [f acc coll] ...)] > (defn reductions [f coll] ... reducer ...)) > And then again if I can call (reduce + 3 [1 2]) maybe it is reasonable > to call (reductions + 3 [1 2]) > I'm over analyzing what is really a non-issue, but just found it > thought provoking. > > Back to more practical concerns, attached is a modified version for > consideration which preserves the old behavior but is faster. Happy to > supply a git patch if on the right track - let me know what is best :) > > Great - thanks. Rich -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Small problem with sets documentation.
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 new clojure.set namespace. > Fixed - thanks. Rich -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Creating deftype instance from inside a protocol method
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 performance > benefit of defining methods right in the type definition. > > After looking at the deftype code, I came up with the following > solution: > > (defprotocol Foo > (foo [x])) > > (deftype Bar > [i] > Foo > (foo [] (new Bar (inc i > > (foo (Bar 0)) > > > Its drawback is relying on an undocumented feature: the value of Foo > inside the methods is the class Foo being defined. > 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)." Rich -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Creating deftype instance from inside a protocol method
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? For dynamic it's Bar_123 or so. Concerning the performance impact: When used in a homogeneous environment, the extend version will be almost as fast as the directly defined method, if I understood Rich correctly. Sincerely Meikel -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Creating deftype instance from inside a protocol method
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 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 definition. > > After looking at the deftype code, I came up with the following > solution: > > (defprotocol Foo > (foo [x])) > > (deftype Bar > [i] > Foo > (foo [] (new Bar (inc i > > (foo (Bar 0)) > > > Its drawback is relying on an undocumented feature: the value of Foo > inside the methods is the class Foo being defined. > > Konrad. > > -- > 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 with your > first post. > To unsubscribe from this group, send email to > clojure+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/clojure?hl=en -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Ants: Good Java solution?
> … 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 > concurrency. 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 then go in to process this and produce the report on another thread after releasing the lock. This is why persistent data structures are so cool: you gain the ability to look at consistent snapshots of the world for free. Cheers, Ian. -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: SLIME/Swank problem with swank.util.sys/get-pid and RuntimeMXBean
"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 Clojure REPL will unblock the Swank thread and make the connection complete. For example, I've tried calling java.util.concurrent.Executors#newSingleThreadExecutor() java.util.Collections#emptySet() java.lang.Math#max() and both work to unblock the Swank thread, but this one does not: java.lang.Integer#parseInt() 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: etypecase failed: defun, (number cons string) ` Those errors messages come from the ELisp evaluator. Strangely, I can't find any etypecase or typecase form in file slime.el that tolerates all three of those types (number, cons, and string), so it's hard to figure out where the error is arising. -- Steven E. Harris -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Clojure/SLIME/Emacs questions
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, adding jline to your classpath is redundant >> if you're using slime. > > Where do you see "several pages"? I don't like this error-prone manual > work, but so far only this work for me, that's why I showed this. Sorry, I didn't mean to be dismissive, just to suggest that you try to communicate with him to solve this problem as I believe the solution he's working on is the cleanest for moving forward. -Phil -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: swank-clojure installation failure via ELPA
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 installed emacs 23.1.1 on Windows 7. I > have a blank .emacs file and no elpa subdirectory under .emacs.d. > > I install elpa and do a package-list-packages. I mark swank-clojure > 1.1.0 for installation and install it. I restart emacs and type M-x > slime. I get "[No match]". Package-list-packages indicates that > slime, slime-repl, clojure-mode, and swank-clojure are all installed. > Huh? > > Please advise. > > Thanks, > Mike > > -- > 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 with > your first post. > To unsubscribe from this group, send email to > clojure+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/clojure?hl=en -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: SLIME/Swank problem with swank.util.sys/get-pid and RuntimeMXBean
"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: == 2010-01-02 10:55:39 Full thread dump Java HotSpot(TM) Client VM (14.3-b01 mixed mode, sharing): "RMI TCP Connection(4)-192.168.1.35" daemon prio=6 tid=0x02e43000 nid=0x15f8 runnable [0x0377f000] java.lang.Thread.State: RUNNABLE at java.net.SocketInputStream.socketRead0(Native Method) at java.net.SocketInputStream.read(Unknown Source) at java.io.BufferedInputStream.fill(Unknown Source) at java.io.BufferedInputStream.read(Unknown Source) - locked <0x23215700> (a java.io.BufferedInputStream) at java.io.FilterInputStream.read(Unknown Source) at sun.rmi.transport.tcp.TCPTransport.handleMessages(Unknown Source) at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(Unknown Source) at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) Locked ownable synchronizers: - <0x2321c928> (a java.util.concurrent.locks.ReentrantLock$NonfairSync) "RMI TCP Connection(idle)" daemon prio=6 tid=0x02f74c00 nid=0x121c waiting on condition [0x0372f000] java.lang.Thread.State: TIMED_WAITING (parking) at sun.misc.Unsafe.park(Native Method) - parking to wait for <0x231df420> (a java.util.concurrent.SynchronousQueue$TransferStack) at java.util.concurrent.locks.LockSupport.parkNanos(Unknown Source) at java.util.concurrent.SynchronousQueue$TransferStack.awaitFulfill(Unknown Source) at java.util.concurrent.SynchronousQueue$TransferStack.transfer(Unknown Source) at java.util.concurrent.SynchronousQueue.poll(Unknown Source) at java.util.concurrent.ThreadPoolExecutor.getTask(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) Locked ownable synchronizers: - None "JMX server connection timeout 22" daemon prio=6 tid=0x02f70400 nid=0x324 in Object.wait() [0x036df000] java.lang.Thread.State: TIMED_WAITING (on object monitor) at java.lang.Object.wait(Native Method) - waiting on <0x231e31d8> (a [I) at com.sun.jmx.remote.internal.ServerCommunicatorAdmin$Timeout.run(Unknown Source) - locked <0x231e31d8> (a [I) at java.lang.Thread.run(Unknown Source) Locked ownable synchronizers: - None "RMI Scheduler(0)" daemon prio=6 tid=0x02b4e000 nid=0x1430 waiting on condition [0x0368f000] java.lang.Thread.State: TIMED_WAITING (parking) at sun.misc.Unsafe.park(Native Method) - parking to wait for <0x231b9ae0> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject) at java.util.concurrent.locks.LockSupport.parkNanos(Unknown Source) at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(Unknown Source) at java.util.concurrent.DelayQueue.take(Unknown Source) at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(Unknown Source) at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(Unknown Source) at java.util.concurrent.ThreadPoolExecutor.getTask(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) Locked ownable synchronizers: - None "RMI TCP Connection(idle)" daemon prio=6 tid=0x02e4b400 nid=0x1608 waiting on condition [0x0363f000] java.lang.Thread.State: TIMED_WAITING (parking) at sun.misc.Unsafe.park(Native Method) - parking to wait for <0x231df420> (a java.util.concurrent.SynchronousQueue$TransferStack) at java.util.concurrent.locks.LockSupport.parkNanos(Unknown Source) at java.util.concurrent.SynchronousQueue$TransferStack.awaitFulfill(Unknown Source) at java.util.concurrent.SynchronousQueue$TransferStack.transfer(Unknown Source) at java.util.concurrent.SynchronousQueue.poll(Unknown Source) at java.util.concurrent.ThreadPoolExecutor.getTask(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) Locked ownable synchronizers: - None "RMI TCP Accept-0" daemon prio=6 tid=0x02b2e800 nid=0x128c runnable [0x035cf000] java.lang.Thread.State: RUNNABLE at java.net.PlainSocketImpl.socketAccept(Native Method) at java.net.PlainSocketImpl.accept(Unknown Source) - locked <0x231c
Re: SLIME/Swank problem with swank.util.sys/get-pid and RuntimeMXBean
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." "14.3-b01") user=> (map #(System/getProperty %) ["os.name" "os.version" "os.arch"]) ("Windows XP" "5.1" "x86") > Have you tried by any chance two different Java versions with the same > result? No, that's the only one I have installed. In a few days when I return to the office, I can try it against version 1.6.0_14 as well. In the meantime, I'll continue the investigation. -- Steven E. Harris -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: SLIME/Swank problem with swank.util.sys/get-pid and RuntimeMXBean
"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 GNU Emacs 23.1.1 > > o Windows XP 32-bit Unfortunately I have no idea what is the reason of this problem, but I'm curious what Java version are you using? Have you tried by any chance two different Java versions with the same result? user> (map #(System/getProperty %) ["java.version" "java.vendor" "java.vm.version"]) ("1.5.0_17" "Sun Microsystems Inc." "1.5.0_17-b04") user> (map #(System/getProperty %) ["os.name" "os.version" "os.arch"]) ("Linux" "2.6.26-1-486" "i386") Br, Rob -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Lift equivalent
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 implemented? Which existing Java libraries can be used to save time? -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: SLIME/Swank problem with swank.util.sys/get-pid and RuntimeMXBean
"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 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: SLIME/Swank problem with swank.util.sys/get-pid and RuntimeMXBean
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" command to the Swank back-end, asking it to invoke the `connection-info' function. At this point, the SLIME front-end has reported that it's trying to connect. The Swank back-end receives the REX request, invokes the `connection-info' method on some thread separate from the thread servicing the Clojure REPL, and hangs in its call to `get-pid'. Because the Swank back-end thread servicing the call to `connection-info' hasn't responded, the SLIME front-end is hung waiting for its REX to complete to gather the `connection-info' result. Not until the SLIME front-end has received that result will it finally announce that it succeeded connecting and present the SLIME REPL. It's not just the SLIME REPL that won't work until that `connection-info' REX completes. Any buffers that attempt to submit forms to Clojure for evaluation will not receive a result; the requests are merely queued because the SLIME front-end has not completed its connection and initial handshake. The call to `get-pid' hangs on its call to RuntimeMXBean#getName() which is part of the first path taken by `get-pid': , | (.. java.lang.management.ManagementFactory | (getRuntimeMXBean) | (getName) | (split "@")) ` Now, I found a way to unblock that hung call to RuntimeMXBean#getName(): In the Clojure REPL available in the *inferior-lisp* buffer, I can evaluate the following form: , | (.. java.lang.management.ManagementFactory (getRuntimeMXBean) (getName) ` That evaluation takes place in the thread servicing the Clojure REPL, which is a different thread from the one blocked in the REX call to `connection-info' and, transitively, `get-pid'. The above form evaluates immediately in he Clojure REPL and, as a side-effect I don't yet understand, /also/ causes the call blocked in the Swank REX-servicing thread to complete as well. Hence, `get-pid' completes, the `connection-info' completes, then the SLIME front-end receives its reply and finally sets up the SLIME REPL. From then on, all is well. I've been searching the Web looking for similar complaints about such a call hanging, and so far I've come up blank. Again, note that calling ManagementFactory#getRuntimeMXBean() from the Clojure REPL is not sufficient to unblock the other thread hung in `get-pid'; it takes calling RuntimeMXBean#get() -- actually using the RuntimeMXBean instance -- to unblock the other thread. Perhaps there's some lazy initialization going on in Sun's RuntimeMXBean implementation. > Does it occur with the latest version of swank-clojure? Yes. I'm tracking the tip of the "master" branch via Git. 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 GNU Emacs 23.1.1 o Windows XP 32-bit -- Steven E. Harris -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
making sense of condp :>>
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 false 2 ) ) (testing "ternary clause" (is (= 1 (condp = 25 1 :>> foo 25 :>> foo 42 ) )) ) -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Clojure 1.1 release
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 (and stable?). > > I just added the 1.1.x branch to build.clojure.org, so you can > usehttp://build.clojure.org/snapshotsto get it. It looks like contrib has > finally had its version number bumped, though it hasn't had an official > release, so 1.1.0-master-SNAPSHOT works for it. > > -Phil -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: New Year and New Library
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 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 version to clojars to make it easy to integrate > into anybody's project. > > Tests are forthcoming though running it at the repl, I haven't spotted > any problems. > > Feedback and comments much appreciated, > Mark > > -- > 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 with > your first post. > To unsubscribe from this group, send email to > clojure+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/clojure?hl=en -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
swank-clojure installation failure via ELPA
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 and do a package-list-packages. I mark swank-clojure 1.1.0 for installation and install it. I restart emacs and type M-x slime. I get "[No match]". Package-list-packages indicates that slime, slime-repl, clojure-mode, and swank-clojure are all installed. Huh? Please advise. Thanks, Mike -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: strange typecheck error
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: java.lang.IllegalArgumentException: recur .S> arg for primitive local: x must be matching primitive (NO_SOURCE_FILE: .S> 57) .S> user=> .S> If the compiler detects that a loop binding evaluates to a primitive, .S> it insists that the corresponding recur argument be a reducible to a .S> primitive as well. You can short-circuit that logic with a type hint, .S> like this: .S> user=> (loop [x #^Object (byte 0)] .S> (if (< x 10) (recur (inc x .S> nil .S> user=> .S> It's ugly but it works. If you change line 65 in your example from .S> "char (.read ireader)]" to "char #^Object (.read ireader)]", the .S> compile error should go away. The example in my previous posting .S> didn't have that problem because 0 by itself is an Integer object, not .S> an int primitive. -- With best wishes, Alex Ott, MBA http://alexott.blogspot.com/http://xtalk.msk.su/~ott/ http://alexott-ru.blogspot.com/ -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Creating deftype instance from inside a protocol method
(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 patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Clojure + Intellij IDEA: stepping through Clojure implementation code
> 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 you using the La Clojure plugin? You can start a REPL console from the tools menu (Tools ->Clojure REPL -> Add New, bound to CTRL-ALT-A by default). If not, the best thing would be to install it: 1. go to File -> Settings 2. select the Plugins section from the list on the left 3. type clojure into the plugin search box 4. select the La Clojure plugin (it'll be under the "available" tab 5. click on the "install" button at the top left of the plugins page > I did try playing with the module settings and add a 'library' which has a > path to clj/clojure, but I must be doing something wrong, as it doesn't seem > to affect the -cp option of the java invocation (I'm checking this using the > output window). The REPL that LaClojure gives you will have the same class path as your clojure project - so you should have both Clojure & Clojure Contrib available, as well as any libraries that your project has defined. Hope this helps! Cheers, Ian. -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Proposal: clojure.io
> > 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. > Overall I think this is a good idea, but I get the feeling duck- > streams isn't quite ready, at least not today. However, this isn't to > say that it couldn't be ready if we worked hard on it over the next > few months. Well, this would be a fairly large change so I'm guessing that it wouldn't hit master until 1.2 at least, which gives us some time to work with. > Also, there's a bigger question of how Clojure will support IO. This > becomes very platform specific, at least part of it do. Rich/the > community will have to decide how to handle IO on multiple platforms, > or to stick w/ the JVM for now. I think that sticking with the JVM is the way to go, at least for the time being. Running atop the JVM is one of Clojure's real strengths, and not something that we should discard lightly (no offence meant to the folks working on the CLI port of course!). Cheers, Ian. -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
New Year and New Library
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 version to clojars to make it easy to integrate into anybody's project. Tests are forthcoming though running it at the repl, I haven't spotted any problems. Feedback and comments much appreciated, Mark -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Clojure + Intellij IDEA: stepping through Clojure implementation code
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/counterclockwise/wiki/Documentation#Install_Counterclockwise_plugin HTH, -- Laurent 2010/1/1 Miron Brezuleanu : > 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 there's a free version of IDEA, I downloaded it and successfully > created an IDEA project out of existing Clojure sources. > 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. > I did try playing with the module settings and add a 'library' which has a > path to clj/clojure, but I must be doing something wrong, as it doesn't seem > to affect the -cp option of the java invocation (I'm checking this using the > output window). > Since I am a complete IDEA newbie, I'd be very happy if someone who is using > IDEA to work on Clojure can provide a few pointers. I don't mind trying this > with Eclipse, so Eclipse advice is welcome too. > Many thanks and Happy New Year everyone, > -- > Miron Brezuleanu > > -- > 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 with your > first post. > To unsubscribe from this group, send email to > clojure+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/clojure?hl=en -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Ants: Good Java solution?
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 demonstrate how difficult it is to do the same job in Java. Rich already said that is very hard to do that. For example, he states that you need to lock the whole world (all cells and ants) 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 concurrency. So my question is: Has anybody tried to port the ants demo to Java? Any experiences? Thanks, Andi -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Creating deftype instance from inside a protocol method
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 definition. After looking at the deftype code, I came up with the following solution: (defprotocol Foo (foo [x])) (deftype Bar [i] Foo (foo [] (new Bar (inc i (foo (Bar 0)) Its drawback is relying on an undocumented feature: the value of Foo inside the methods is the class Foo being defined. Konrad. -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Clojure/SLIME/Emacs questions
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 the >>> current prompt with one click) >>> - Also in his screencasts, Lau Jensen types something like g-i-v, then hits >>> some key combination and gets an expansion like get-integer-value >>> >>> I can't seem to find out how to get these to work, any hint would be >>> appreciated. >> >> I did it like this (I assume that clojure-mode.el has been installed): >> >> 1. downloaded slime and swank-clojure > > You can get this to work, but as you can see it's very manual and > error-prone. The basic slime REPL is working using automated The question was not about "basic" slime REPL. > 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, adding jline to your classpath is redundant > if you're using slime. Where do you see "several pages"? I don't like this error-prone manual work, but so far only this work for me, that's why I showed this. Sorry if it is a pain for you to read. Rob -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: update-in and get-in why no default?
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=> ((fnil-2 + 1) nil 2 3 4 5) 1 ; I think this should result in 15, but that's just an implementation detail. -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: update-in and get-in why no default?
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 using: (defn fnil "Creates a new function that if passed nil as an argument, operates with supplied arguments instead. The function must be passed as the last argument." [& more] (fn [& m] (apply (last more) (map #(if (nil? %1) %2 %1) m (concat (butlast more) (drop (count (butlast more)) m)) Relating to your examples: user=> (def nil+ (fnil 0 1 2 3 4 5 6 +)) user=> (nil+ 0 0 0 0 0 0 nil) 6 user=> (nil+ 0 0 0 0 0 0 0 nil) java.lang.NullPointerException (NO_SOURCE_FILE:0) user=> ((fnil 1 +) nil 2 3 4 5) 15 ; note fnil-2 does not handle the last case, though of course it could easily if you wanted it to: 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) ; in principle I don't think one form is any more restrictive than the other, it just comes down to a matter of preference which is the key part I wanted to generate discussion about. > matches the signature of partial better, which I personally prefer. Yes that is precisely why it catches me out to write (fnil + 1) because it looks like a partial application. Partial applications are actually very common even when partial is not explicitly used: user=> (swap! (atom 1) + 1) 2 So I'm used to seeing arguments to the right of a function get absorbed so to speak, and used to seeing conditionals occur in the middle of the form. Again just clarifying that I too like partial application style but have the opposite reaction in this case of wanting to contrast that for fnil as it is not a partial application. This of course is just my preference and I'm glad to hear reasoning for the other style. Regards, Tim. -- 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 with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en