Re: Does 'require' with the :reload option have a tendency to build up memory?
Have you tried class unloading options of JVM? CMSClassUnloadingEnabled and TraceClassUnloading HTH, Hubert. On Sat, Sep 11, 2010 at 9:19 PM, Rayne wrote: > As it turns out, this wasn't a memory leak at all. I decided to see if > I could max sexpbot's memory out by reloading. I got it to rise around > 20-30 megs and then it stabilized and eventually jumped down 10 megs > and didn't rise again (gave up 10 reloads later). I don't know how > this stuff works, but I suppose maybe the memory just remained > reserved or something. GCing does absolutely nothing. For a smaller- > scale test, you can just try requiring clojure.java.io or some other > namespace about 100-500 times and watch memory while doing so. It'll > grow pretty substantially. > > Anyway, it's doesn't appear to be a real problem at all. > > -- > 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: how to use leiningen install
Woops, i left out a 0 on the version number, so i did ".1" instead of "0.1"! Now it works! Also, is there any way to use a library from the local maven repository in a fresh clojure repl. By fresh, i mean i have set up emacs to run a new clojure repl not related to previous projects. Is there any way so that all libraries in the local maven repository are located in the java class loading path so i can do (import 'helloworld). -- 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
ns-unmap-all
Hi, The following function has been a real _lifesaver_ lately in debugging symbol collisions in (ns) directives when developing with SLIME in a long-running VM: (defn ns-unmap-all "Unmap all the symbols (except 'ns' and 'in-ns')." ([] (ns-unmap-all *ns*)) ([ns] (map #(ns-unmap ns %) (keys (ns-map ns) May I kindly suggest the inclusion of something similar along with all the other core namespace functions? It's quite nice (IMHO: necessary) to be able to get back to a clean environment when you face a collision error. (I'm guessing may of you have something similar already defined in your environments.) cheers, -- 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
Problem installing slime
Hey! I am trying to set up clojure for emacs. I use ubuntu and gnu emacs 23. I followed this guide http://riddell.us/ClojureWithEmacsSlimeSwankOnUbuntu.html In particular, I did: ~$ cd opt ~/opt$ git clone git://github.com/jochu/clojure-mode.git ~/opt$ git clone git://git.boinkor.net/slime.git ~/opt$ git clone git://github.com/jochu/swank-clojure.git And then I appended the following to my ~/.emacs: ;; clojure-mode (add-to-list 'load-path "~/opt/clojure-mode") (require 'clojure-mode) ;; swank-clojure (add-to-list 'load-path "~/opt/swank-clojure/src/emacs") (setq swank-clojure-jar-path "~/.clojure/clojure.jar" swank-clojure-extra-classpaths (list "~/opt/swank-clojure/src/main/clojure" "~/.clojure/clojure-contrib.jar")) (require 'swank-clojure-autoload) ;; slime (eval-after-load "slime" '(progn (slime-setup '(slime-repl (add-to-list 'load-path "~/opt/slime") (require 'slime) (slime-setup) However, when I start emacs I can't do M-x slime. What did I do wrong? Just so you know, I just switched to ubuntu from windows today, and I'm a beginner at clojure, git, linux, emacs... you name it. :) -- 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
clojurescript and 1.2.0
Dear all, I cannot manage to make ClojureScript work from clojure 1.2.0. It seems that *compiler-analyse-only* used to exist but do not exist anymore. Does someone know what it was and what replaced it? Best regards, Nicolas. -- 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: clojurescript and 1.2.0
Oooops. Ansered my question. Haven't seen the patch in the git repository. Will try to apply it to clojure 1.2. On Sun, Sep 12, 2010 at 1:52 PM, Nicolas Oury wrote: > Dear all, > > I cannot manage to make ClojureScript work from clojure 1.2.0. > > It seems that *compiler-analyse-only* used to exist but do not exist anymore. > > Does someone know what it was and what replaced it? > > Best regards, > > Nicolas. > -- Sent from an IBM Model M, 15 August 1989. -- 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
Interesting Paper on Macros
HI Clojurians - I found a reference to this interesting paper on macros on Lamda the Ultimate. An interesting read by the our old friend Matthias Felleisen who helped many of us learn Lisp. http://www.ccs.neu.edu/scheme/pubs/icfp10-cf.pdf -- 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: Interesting Paper on Macros
Here's the teaser, er, I mean abstract: "Existing macro systems force programmers to make a choice between clarity of specification and robustness. If they choose clarity, they must forgo validating significant parts of the specification and thus produce low-quality language extensions. If they choose robustness, they must write in a style that mingles the implementation with the specification and therefore obscures the latter. "This paper introduces a new language for writing macros. With the new macro system, programmers naturally write robust language extensions using easy-to-understand specifications. The system translates these specifications into validators that detect misuses—including violations of context-sensitive constraints—and automatically synthesize appropriate feedback, eliminating the need for ad hoc validation code." Haven't read the whole thing yet, but it seems promising. On Sep 12, 9:29 am, Base wrote: > HI Clojurians - > > I found a reference to this interesting paper on macros on Lamda the > Ultimate. An interesting read by the our old friend Matthias > Felleisen who helped many of us learn Lisp. > > http://www.ccs.neu.edu/scheme/pubs/icfp10-cf.pdf -- 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: how to use leiningen install
On Sat, Sep 11, 2010 at 4:45 PM, Seth wrote: > Woops, i left out a 0 on the version number, so i did ".1" instead of > "0.1"! Now it works! > > Also, is there any way to use a library from the local maven > repository in a fresh clojure repl. By fresh, i mean i have set up > emacs to run a new clojure repl not related to previous projects. Is > there any way so that all libraries in the local maven repository are > located in the java class loading path so i can do (import > 'helloworld). I think this is something you would do with cljr: http://github.com/liebke/cljr -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: Problem installing slime
On Sat, Sep 11, 2010 at 7:55 PM, Oskar wrote: > I am trying to set up clojure for emacs. I use ubuntu and gnu emacs > 23. I followed this guide > http://riddell.us/ClojureWithEmacsSlimeSwankOnUbuntu.html Those instructions are a lot more complicated since they have you install everything by hand. If you follow the README for swank-clojure it's much less error-prone: http://github.com/technomancy/swank-clojure/blob/master/README.md -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: ns-unmap-all
This will help with collisions, but note that other namespaces may still hold references to the values of the un-mapped Vars. -S On Sep 11, 9:48 pm, blais wrote: > Hi, > The following function has been a real _lifesaver_ lately in debugging > symbol collisions in (ns) directives when developing with SLIME in a > long-running VM: > > (defn ns-unmap-all > "Unmap all the symbols (except 'ns' and 'in-ns')." > ([] (ns-unmap-all *ns*)) > ([ns] (map #(ns-unmap ns %) (keys (ns-map ns) > > May I kindly suggest the inclusion of something similar along with all > the other core namespace functions? > It's quite nice (IMHO: necessary) to be able to get back to a clean > environment when you face a collision error. > (I'm guessing may of you have something similar already defined in > your environments.) > > cheers, -- 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: ns-unmap-all
There's also "remove-ns" in core, which, when followed by "ns", will have the same effect. -S On Sep 11, 9:48 pm, blais wrote: > Hi, > The following function has been a real _lifesaver_ lately in debugging > symbol collisions in (ns) directives when developing with SLIME in a > long-running VM: > > (defn ns-unmap-all > "Unmap all the symbols (except 'ns' and 'in-ns')." > ([] (ns-unmap-all *ns*)) > ([ns] (map #(ns-unmap ns %) (keys (ns-map ns) > > May I kindly suggest the inclusion of something similar along with all > the other core namespace functions? > It's quite nice (IMHO: necessary) to be able to get back to a clean > environment when you face a collision error. > (I'm guessing may of you have something similar already defined in > your environments.) > > cheers, -- 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: ns-unmap-all
On Sat, Sep 11, 2010 at 6:48 PM, blais wrote: > The following function has been a real _lifesaver_ lately in debugging > symbol collisions in (ns) directives when developing with SLIME in a > long-running VM: > > (defn ns-unmap-all > "Unmap all the symbols (except 'ns' and 'in-ns')." > ([] (ns-unmap-all *ns*)) > ([ns] (map #(ns-unmap ns %) (keys (ns-map ns) > > May I kindly suggest the inclusion of something similar along with all > the other core namespace functions? > It's quite nice (IMHO: necessary) to be able to get back to a clean > environment when you face a collision error. > (I'm guessing may of you have something similar already defined in > your environments.) I've had this on my todo list for swank-clojure for a while now; would love to see a patch that integrates it. Not sure it belongs in clojure.core though. -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
Line numbers for forms embedded in macros
In my test framework, Midje, http://github.com/marick/Midje, a test written in the most heavily syntactically-sugared form might look like this: (facts (complicated-function ...some-integer...) => 5 (provided (simple-function ...some-integer...) => 2 (other-function ...some-integer...) => 3 ...some-integer... => even?) ...) A test failure could be associated with any point where there's an arrow. Because (fact) is a macro, the straightforward way of getting the line number gets the line number of the very beginning of the form. Is there a clever way to get the line number of the arrows? (There's no hook into the reader, is there?) What I'm going to do unless you save me is two things: 1) the failure messages will tell you the failure is associated with, say, the 3rd arrow. 2) When emacs sends the form down to the interpreter, I'll have it annotate it with the correct line numbers. That way, a simple keyboard gesture will take me to the failing line. Better ideas for fallbacks? - Brian Marick, independent consultant Mostly on agile methods with a testing slant Author of /Programming Cocoa with Ruby/ www.exampler.com, www.exampler.com/blog, www.twitter.com/marick -- 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: Problem installing slime
Oskar: I once did installations like this of SLIME for interaction with SBCL on my computers, and I did it once for Clojure about a year ago, but when I tried to upgrade that SLIME/Clojure interaction software recently, I had trouble trying to do so in a similar way that I had done it in the past. In particular, look at the section labeled "swank-clojure.el" near the end of this page: http://github.com/technomancy/swank-clojure I decided to abandon my little-understood section of my .emacs file from my previous installs, and try to install it using the currently- recommended method. Below are the steps I've gone through on a couple of Macs, and one Ubuntu 10.4 virtual machine, starting from I think nothing but an Emacs and Clojure 1.2 installation. You might not even need Clojure installed anywhere in order for this to work, since the 'lein deps' step downloads jars for Clojure and contrib. Andy Source of these instructions: http://github.com/technomancy/leiningen/blob/master/README.md http://github.com/technomancy/swank-clojure Short version of how to do the install on a new Mac: Backup your current .emacs file, just in case. % cp -p ~/.emacs ~/.emacs.bak Install Leiningen (use a web browser for the first step, if you do not have curl). ~/bin already exists on my system, and is in my command path. You should use whatever directory you wish in place of that. % curl http://github.com/technomancy/leiningen/raw/stable/bin/lein > ~/ bin/lein % chmod 755 ~/bin/lein % lein self-install Make a brand new Clojure project using Leiningen. Again, modify the directory from my ~/sw/new-clj-proj to suit you. THe name of the project in the 'lein new' command is also pretty arbitrary. The only use you will likely make of this project is to start a java process with the Clojure jar(s) and able to interact with SLIME. % mkdir -p ~/sw/new-clj-proj % cd ~/sw/new-clj-proj % lein new new-clj-proj . Use a text editor to edit project.clj. Remove ')' from end of file, then add this new last line: :dev-dependencies [[swank-clojure "1.2.1"]]) Save the file and quit editor. % lein deps That takes about 30 seconds to complete. From now on, you can do this to start a Clojure process that listens for connections from SLIME. % cd ~/sw/new-clj-proj % lein swank Now to install clojure-mode and slime-repl packages in Emacs. Fire up emacs. Copy and paste the Elisp code below into a buffer. Select it as a region, and use M-x eval-region to evaluate it. (let ((buffer (url-retrieve-synchronously "http://tromey.com/elpa/package-install.el";))) (save-excursion (set-buffer buffer) (goto-char (point-min)) (re-search-forward "^$" nil 'move) (eval-region (point) (point-max)) (kill-buffer (current-buffer Now do this in Emacs: M-x package-list-packages Use arrow keys or n/p to move cursor to lines for clojure-mode package and slime-repl package, and press 'i' key on each one to mark them for installation. Then hit 'x' to execute those markings. Use 'h' for brief help in the bottom of the Emacs window. Mark these two packages with 'i': clojure-mode slime-repl Press 'x' to execute the installation. From now on, use this command to start a SLIME session connected to a Clojure process, after doing the 'lein swank' command above. M-x slime-connect On Sep 11, 2010, at 7:55 PM, Oskar wrote: Hey! I am trying to set up clojure for emacs. I use ubuntu and gnu emacs 23. I followed this guide http://riddell.us/ClojureWithEmacsSlimeSwankOnUbuntu.html In particular, I did: ~$ cd opt ~/opt$ git clone git://github.com/jochu/clojure-mode.git ~/opt$ git clone git://git.boinkor.net/slime.git ~/opt$ git clone git://github.com/jochu/swank-clojure.git And then I appended the following to my ~/.emacs: ;; clojure-mode (add-to-list 'load-path "~/opt/clojure-mode") (require 'clojure-mode) ;; swank-clojure (add-to-list 'load-path "~/opt/swank-clojure/src/emacs") (setq swank-clojure-jar-path "~/.clojure/clojure.jar" swank-clojure-extra-classpaths (list "~/opt/swank-clojure/src/main/clojure" "~/.clojure/clojure-contrib.jar")) (require 'swank-clojure-autoload) ;; slime (eval-after-load "slime" '(progn (slime-setup '(slime-repl (add-to-list 'load-path "~/opt/slime") (require 'slime) (slime-setup) However, when I start emacs I can't do M-x slime. What did I do wrong? Just so you know, I just switched to ubuntu from windows today, and I'm a beginner at clojure, git, linux, emacs... you name it. :) -- 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
Re: how to use leiningen install
tried it out, looks good! except i accidently broke it by doing cljr install /home/seth/.m2/helloworld 0.1, from then on it didn't work so i had to reinstall it :( (i though i could directly give address to repository) -- 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: how to use leiningen install
take that back, all i had to do was go to project.clj and remove the offending entry! -- 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: ns-unmap-all
shouldn't we rename remove-ns to ns-remove to keep it in line with the other ns functions? --Robert McIntyre On Sun, Sep 12, 2010 at 4:18 PM, Phil Hagelberg wrote: > On Sat, Sep 11, 2010 at 6:48 PM, blais wrote: >> The following function has been a real _lifesaver_ lately in debugging >> symbol collisions in (ns) directives when developing with SLIME in a >> long-running VM: >> >> (defn ns-unmap-all >> "Unmap all the symbols (except 'ns' and 'in-ns')." >> ([] (ns-unmap-all *ns*)) >> ([ns] (map #(ns-unmap ns %) (keys (ns-map ns) >> >> May I kindly suggest the inclusion of something similar along with all >> the other core namespace functions? >> It's quite nice (IMHO: necessary) to be able to get back to a clean >> environment when you face a collision error. >> (I'm guessing may of you have something similar already defined in >> your environments.) > > I've had this on my todo list for swank-clojure for a while now; would > love to see a patch that integrates it. Not sure it belongs in > clojure.core though. > > -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 -- 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
JavaFX alternative languages talk at JavaOne
I have no idea how many of you both care at all about JavaFX and are planning to go to the JavaOne conference tomorrow Monday in San Francisco, but there's apparently going to be a talk about using the JavaFX platform from alternative languages, particularly Clojure, at 4 PM. I myself can't go, but I am interested in JavaFX, so it'd be great if someone goes and reports on it. http://steveonjava.com/javafx-your-way-building-javafx-applications-with-alternative-languages/ -- 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
Possible bug in with-symbol-macros, interacts badly with case
I wrote a test case: (use 'clojure.contrib.macro-utils) (defn bug? [] (with-symbol-macros (case 0 0 1))) The REPL prints: java.lang.ClassCastException: clojure.lang.PersistentVector cannot be cast to clojure.lang.MapEntry (NO_SOURCE_FILE:4) Can anyone confirm this, please? -- 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
Editing Assembla Wiki
Hey all, I'm just starting out with Clojure and was wondering about making some edits to the Clojure wiki on assembla. I was going to note that it seems you have to uninstall clojure-mode from elpa in order to install swank-clojure. This requires pressing "d" on clojure-mode in elpa to uninstall the clojure-mode package. Thought I'd run the change by people and also ask about editing on assembla. Does anybody know the process for this? I made an account and I'm watching the wiki, but I don't have edit rights. -- Fred Concklin -- 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
possible bug
Hello, I am relatively new to clojure and lispy languages in general. I wrote a small program that manipulated thread vars using the binding macro and I am seeing what seems to be strange behavior. To illustrate, here is another small program that reproduces what I am seeing (without all the distraction of the original). There is a reason for the nested bindings in the original code where it seems a bit contrived here. Regardless, if it is something I am doing wrong, please let me know. (declare x y) (def rnd1 (java.util.Random.)) (def rnd2 (java.util.Random.)) (defn throw-random-exception [c] (let [value (.nextInt rnd1 100)] (if (= value 50) (throw (Exception. (str "Random Exception after count = " c)) (defn change-value-of-thread-local-var [] (set! x (conj x (.nextInt rnd2 100 (defn test-binding [] (binding [x [0 1 2 3 4 5 6]] (try (loop [c 0] (do (change-value-of-thread-local-var) (throw-random-exception c)) (recur (inc c))) (catch Exception e (println (str x "\n" (.getMessage e))) (defn test-nested-binding [] (binding [x [0 1 2 3 4 5 6]] (try (loop [c 0] (binding [y [7 8 9]] (do (change-value-of-thread-local-var) (throw-random-exception c)) (recur (inc c (catch Exception e (println (str x "\n" (.getMessage e))) If I load this as a file at the REPL and then run "(test-binding)" the value of x is unbound when the function returns. However if you run "(test-nested-binding)" then the value of BOTH x and y have a bound value when the function returns. Is this a bug? If so, where do I report it? If not, what am I doing wrong? I have also moved the binding of x inside the "try" and it has the same behavior. thanks, take care, 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: Possible bug in with-symbol-macros, interacts badly with case
I found a workaround: (use 'clojure.contrib.macro-utils) (defsymbolmacro one 1) (defn bug1 [] (with-symbol-macros (bug2))) (defn bug2 (case 0 0 one))) The "one" symbol macro is there just to show that everything works as expected. -- 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
Quirk of Map destructuring
I just noticed this unexpected result for Map destructuring with an :or directive: user=> (def guys-name-map {:f-name "Guy" :l-name "Steele"}) #'user/guys-name-map user=> (let [{:keys [f-name m-name l-name] :or {:m-name "CL"}} guys- name-map] (str l-name ", " f-name "+" m-name)) "Steele, Guy+" user=> (let [{:keys [f-name m-name l-name] :or {m-name "CL"}} guys- name-map] (str l-name ", " f-name "+" m-name)) "Steele, Guy+CL" Note that the :or directive does not seem to respect/ use the preceeding :keys directive and appears to be doing its lookup using symbols only. Was this the intended behavior? Wouldn't it be more useful to extend the behavior of :or to use the same lookup method (:keys, :strs, or :syms) as specified in the (same) preceeding map context? -- 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: Line numbers for forms embedded in macros
On Sun, Sep 12, 2010 at 4:22 PM, Brian Marick wrote: > In my test framework, Midje, http://github.com/marick/Midje, a test written > in the most heavily syntactically-sugared form might look like this: > > (facts > (complicated-function ...some-integer...) => 5 > (provided > (simple-function ...some-integer...) => 2 > (other-function ...some-integer...) => 3 > ...some-integer... => even?) > ...) > > A test failure could be associated with any point where there's an arrow. > Because (fact) is a macro, the straightforward way of getting the line number > gets the line number of the very beginning of the form. Is there a clever way > to get the line number of the arrows? (There's no hook into the reader, is > there?) > > What I'm going to do unless you save me is two things: > > 1) the failure messages will tell you the failure is associated with, say, > the 3rd arrow. > > 2) When emacs sends the form down to the interpreter, I'll have it annotate > it with the correct line numbers. That way, a simple keyboard gesture will > take me to the failing line. > > Better ideas for fallbacks? In your macro, try printing out your input forms with *print-meta* on. (defmacro print-meta [& args] (binding [*print-meta* true] (prn args))) I think you'll find some useful data in there. There won't be line numbers on your arrows, but will be on the preceding forms. --Chouser http://joyofclojure.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: Quirk of Map destructuring
I've been bitten by this before. Unless there's a good reason for :or to work the way it does I think that would be a good idea, since then you can define "default" maps somewhere else and use those both with the :or keyword or when calling the function itself. Maybe the :or map can just be underlaid with the actual map being used to call the function? --Robert McIntyre On Sun, Sep 12, 2010 at 9:21 PM, Tom Hicks wrote: > I just noticed this unexpected result for Map destructuring with an > :or directive: > > > user=> (def guys-name-map {:f-name "Guy" :l-name > "Steele"}) > #'user/guys-name-map > > user=> (let [{:keys [f-name m-name l-name] :or {:m-name "CL"}} guys- > name-map] (str l-name ", " f-name "+" m-name)) > "Steele, Guy+" > > user=> (let [{:keys [f-name m-name l-name] :or {m-name "CL"}} guys- > name-map] (str l-name ", " f-name "+" m-name)) > "Steele, Guy+CL" > > > Note that the :or directive does not seem to respect/ > use the preceeding :keys directive and appears to be doing its lookup > using symbols only. Was this the intended behavior? > > Wouldn't it be more useful to extend the behavior of :or quote> to use the same lookup method (:keys, :strs, or :syms) as > specified in the (same) preceeding map context? > > -- > 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: Editing Assembla Wiki
On Sun, Sep 12, 2010 at 3:04 PM, ephcon wrote: > I'm just starting out with Clojure and was wondering about making some > edits to the Clojure wiki on assembla. > > I was going to note that it seems you have to uninstall clojure-mode > from elpa in order to install swank-clojure. This requires pressing > "d" on clojure-mode in elpa to uninstall the clojure-mode package. > > Thought I'd run the change by people and also ask about editing on > assembla. Does anybody know the process for this? I made an account > and I'm watching the wiki, but I don't have edit rights. Don't worry about it--that bug has been fixed in the latest package.el, plus using swank-clojure.el is deprecated/unnecessary, so the instructions on the wiki are actually the up-to-date ones. There's a link to the swank-clojure readme that explains this in more detail. -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: clojurescript and 1.2.0
On Sun, Sep 12, 2010 at 9:04 AM, Nicolas Oury wrote: > Oooops. > > Ansered my question. > > Haven't seen the patch in the git repository. > Will try to apply it to clojure 1.2. I imagine you'll have some difficulty with that. ClojureScript was last updated to work with Clojure 1.0 (with the patch applied) ... or perhaps even an earlier version than that. I've given up working on it until more of Clojure-in-Clojure is complete, which will make bringing ClojureScript up to date and keeping it there dramatically easier. --Chouser http://joyofclojure.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: Quirk of Map destructuring
Hi, On 13 Sep., 04:30, Robert McIntyre wrote: > Unless there's a good reason for :or to work the way it does I think > that would be a good idea, since then you can define "default" maps > somewhere else and use those both with the :or keyword or when > calling the function itself. The default map specifies the default for the symbols which are bound, not the source of the values. (let [{foo :some-key bar "some-other-key" :or {foo 1}} ] ...) If you want to provide defaults from outside the function use merge. (fn-which-does-destructuring (merge defaults-map payload-map)) 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: drop-while and (pred item) returns nil?
By the way, I cloned the Clojure repo and have adjusted the docs for this function, but I can't figure out how to get Github to submit it for approval, or for a pull request or whatever it is. If someone wants to take this patch and check it in for me, that would be fine too. diff --git a/src/clj/clojure/core.clj b/src/clj/clojure/core.clj index eaab3aa..ef05ccb 100644 --- a/src/clj/clojure/core.clj +++ b/src/clj/clojure/core.clj @@ -2451,7 +2451,7 @@ (defn drop-while "Returns a lazy sequence of the items in coll starting from the first - item for which (pred item) returns nil." + item for which (pred item) returns logical false." {:added "1.0" :static true} [pred coll] On Sep 9, 11:46 pm, Jacek Laskowski wrote: > On Fri, Sep 10, 2010 at 1:08 AM, Alan wrote: > > I'm not 100% sure what you're asking, but I think I understand you, > > and in that case you can refer to > >http://groups.google.com/group/clojure/browse_thread/thread/9c7f72670..., > > in which I ask this very question and get the answers I am looking > > for. > > Hi Alan, > > That was my point exactly - the reference to nil in the docstring for > drop-while. It's a bit confusing to me and I'd expect a boolean > reference instead. > > Jacek > > -- > Jacek Laskowski > Notatnik Projektanta Java EE -http://jaceklaskowski.pl -- 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: drop-while and (pred item) returns nil?
Hi, On 13 Sep., 08:22, Alan wrote: > By the way, I cloned the Clojure repo and have adjusted the docs for > this function, but I can't figure out how to get Github to submit it > for approval, or for a pull request or whatever it is. If someone > wants to take this patch and check it in for me, that would be fine > too. The usual approach is detailed here: http://clojure.org/patches. 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