Re: eclipse/counterclockwise/maven question
Hi, On 01.04.2010, at 20:00, Stuart Halloway wrote: (2) When I import the project, the package explorer shows JRE System Library J2SE 1.4. The Clojure REPL then bombs needing Java 1.5 features. I can edit the project properties after the import, but shouldn't there be some way to say this in pom.xml so that Eclipse choose 1.5 during the import? AFAIR, 1.4 is the default for Maven's javac-plugin. If you add the snippet described in http://maven.apache.org/general.html#Compiling-J2SE-5 to the pom.xml, the specified version will be used; Eclipse (via m2eclipse or mvn eclipse:eclipse) picks this up correctly. Regards, --Chris -- 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 To unsubscribe, reply using remove me as the subject.
Re: Why can't :let be first in a for
Dear all, I've got a re-implementation of the for-macro sitting around here that removes this limitation (and others, the vector can't be empty either, if I remember correctly). The implementation also adds the sorting and grouping functionality described in Wadler and Jones' paper comprehensive comprehensions (http://research.microsoft.com/~simonpj/ papers/list-comp/list-comp.pdf). I'd be happy to post the code if anyone's interested, however: - it's based on an old version of Clojure (Dec '08, pre lazier seqs), so it might need some work. - I implemented a complete parser (Hutton's monadic parser combinators, http://www.cs.nott.ac.uk/~gmh/bib.html#monparsing) to parse the binding vector and I'm not sure if that would make sense in clojure.core (Although I think so, since `for` isn't the only macro in core with a custom mini-parser). Regards, --Chris On 23 Okt., 21:18, Chouser chou...@gmail.com wrote: On Fri, Oct 23, 2009 at 3:16 PM, Howard Lewis Ship hls...@gmail.com wrote: I like to try and keep my level of nesting under control, and this often involves hiding or re-structuring the let macro. The for macro can implicitly assemble a let macro for you, but with a limitation that the :let clause can't be first: 1:5 user= (for [:let [z [:foo :bar]] x z] (name x)) java.lang.IllegalStateException: Can't pop empty vector (repl-1:5) 1:6 user= (for [x [:foo :bar] :let [z (name x)]] z) (foo bar) 1:7 user= Is this limitation intentional? Could the error message be improved? It's not an intentional limitation. One hint of this is that :let, :while, and :when all work perfectly fine at the beginning of a doseq. Improving the error message would be easy. On the other hand, a patch to support them at the beginning of a 'for' should be possible. I think it might be worthwhile, particulary for macros that generate 'for' forms. The machinery inside a 'for' expansion is hard to do yourself. Rich, would you consider a patch to support this? --Chouser --~--~-~--~~~---~--~~ 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: ANN: Full, continuously updated documentation for clojure.contrib
Tom, thanks, that's great! I think it would be really useful if the overview appeared as a link on the contrib landing page. all the best, --Chris On 04.05.2009, at 08:41, Tom Faulhaber wrote: Hello everybody, As many of you know, I have been working on a contrib autodoc robot for the last little while. It is now up and running and you can use the results here: http://code.google.com/p/clojure-contrib/wiki/OverviewOfContrib It includes: * An overview of each namespace in contrib (including the author and shortcut links to documentation for each of the functions). * An API page for each name space that includes the doc string for each function or variable in the namespace and a direct link to the source for that function or variable. * An index of all the documented functions and variables so that you can find them by name. * A JSON file that allows other tools to build off this information (at http://clojure-contrib.googlecode.com/svn/wiki/ApiDocIndex.json - still very much under development). Each page has a sidebar to allow for quick access from place to place. All the pages are stored in the wiki on the google code home for clojure-contrib. This is both a blessing and a curse, since the google code wiki is a little brain-dead. As a result, the formatting is not as awesome as I would like. The goal of this project is to make contrib a more open and accessible resource for the community. Please take advantage of this to see and understand the great stuff that folks have added to contrib for your programming pleasure. I will be making sure it is kept up-to-date (eventually that will be automated, but for now I have to type ant once in a while). To contrib authors: I have added metadata to your namespaces. Please update and correct it as you would like. The updates will be propagated to the site. Also, please review the doc for your contributions to make sure it is complete and correct in general. Let me know if anything doesn't seem to be going through the wringer correctly. Happy perusing! Tom --~--~-~--~~~---~--~~ 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 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: constructing maps
Hi Nathan, On 04.05.2009, at 15:47, Nathan Hawkins wrote: On Mon, 4 May 2009 06:16:14 -0700 (PDT) Drew Raines aarai...@gmail.com wrote: Whoops, that (seq) is a debugging artifact. You can remove that: (let [test-str foo=1;bar=2;baz=3] (reduce conj {} (map #(apply hash-map (.split % =)) (.split test-str ; Ok, my example seems to have misled. You're missing the point a little bit: 1. I was trying to avoid the (reduce conj {} ...), by having the map function do it. Why even build a list that's only going to get thrown away when I want a hash-map at the end? you're not actually building a list. The function map returns a (lazy) *sequence*, which is an instance of ISeq. This just means you're getting something that supports the operations first and rest. So, since map returns a sequence and you want a Map (i.e. key/value data structure), you'll have to turn it into one by using (conj {} ...) or (into {} ...). hth, --Chris --~--~-~--~~~---~--~~ 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 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: shortcut for for comprehension
On 21.04.2009, at 00:19, Michael Hunger wrote: Is it possible to use :while to shortcut a for macro when a certain number of yiels have happened? e.g. (for [x (range 1000) :when (= (rem x) 1) :while (number of yields = 10)] so i want only the first 10 results. you could: (def zip (partial map vector)) and then use: user (for [[i x] (zip (iterate inc 0) (range 10 -10 -1)) :while ( i 5)] x) (10 9 8 7 6) Or should I just use (take 10 ) on the for ? that's probably more readable and works just as well ;). hth, --Chris --~--~-~--~~~---~--~~ 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 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 emulate lisp's labels functionality?
On 15.02.2009, at 06:26, Chouser wrote: On Sat, Feb 14, 2009 at 11:32 PM, GS gsincl...@gmail.com wrote: On Feb 14, 12:21 pm, Chouser chou...@gmail.com wrote: (defn count-instances [obj lsts] (let [instances-in (fn thisfn [lst] (if (seq lst) (+ (if (= (first lst) obj) 1 0) (thisfn (rest lst))) 0))] (map instances-in lsts))) Notwithstanding your more idiomatic implementation (snipped), wouldn't recur be better than thisfn? (defn count-instances [obj lsts] (let [instances-in (fn [lst] (if (seq lst) (+ (if (= (first lst) obj) 1 0) (recur (rest lst))) 0))] (map instances-in lsts))) Yes, you're absolutely right. however, the recur isn't in tail position, so it doesn't work: user= (defn count-instances [obj lsts] (let [instances-in (fn [lst] (if (seq lst) (+ (if (= (first lst) obj) 1 0) (recur (rest lst))) 0))] (map instances-in lsts))) java.lang.UnsupportedOperationException: Can only recur from tail position (NO_SOURCE_FILE:12) all the best, --Chris --~--~-~--~~~---~--~~ 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 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: thanks, errata, and one gaffe
Stuart, I'd be very interested to see something on Ties (http://www.bitbucket.org/achimpassen/clojure-ties/wiki/Home ), which while not being in clojure-contrib, shows lots of promise. all the best, --Chris On 17.11.2008, at 15:13, Stuart Halloway wrote: Hi Brian, The libraries chapter will cover a bunch of different libraries in Clojure-Contrib and elsewhere. Obviously, being only one chapter, it won't go terribly deep. I'd love to hear what folks want to see. I am planning on at least: * db * web apps * testing/BDD * zipper Stuart: I read through the table of contents. Are you planning on addressing interacting with a database (preferably postgres or mysql) in Clojure? Maybe the Working with Java chapter will be sufficient, but one of the benefits of Clojure is batteries included, so helping folks get up to speed with a db example would be great. Brian --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~--~~~~--~~--~--~---
Re: Can't get rlwrap to work
Hi, On 12.11.2008, at 22:38, Giacecco wrote: Hi all, I am trying setting up clojure to use rlwrap as described at http://en.wikibooks.org/wiki/Clojure_Programming#Enhancing_Clojure_REPL_with_rlwrap on a MacOS 10.5.5. I have prepared the clj-completions.clj the instructions describe, but it fails on the second of the three commands. If I run it from the console, I see the following: gianfranco-cecconis-macbook-pro:clojure giacecco$ clj Clojure user= (defmacro with-out-file [pathname body] `(with-open stream# (new java.io.FileWriter ~pathname) (binding [*out* stream#] [EMAIL PROTECTED]))) nil user= (def completions (keys (ns-publics (find-ns 'clojure java.lang.NullPointerException (NO_SOURCE_FILE:5) on the most recent clojure SVN, I get this error, too. This is because the funcions that used to be in the NS clojure have been moved to clojure.core. (def completions (keys (ns-publics (find-ns 'clojure.core works for me. all the best, --Chris --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~--~~~~--~~--~--~---
Re: offtopic - where are you come from? (poll)
another German here, but from Berlin :) On 17.10.2008, at 14:07, mb wrote: Frankfurt am Main, Germany --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~--~~~~--~~--~--~---