Re: lazy-xml returns 503 from w3.org
Turn off validation. Google around, you will find the parameters to do so. On Mar 19, 2010, at 7:19 PM, Wilson MacGyver wmacgy...@gmail.com wrote: Hi, In trying to use clojure.cotrib.lazy-xml to parse a xml file. I get java.io.IOException: Server returned HTTP response code: 503 for URL: http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd because w3c blocks access to that dtd now. Is there any work around? Thanks, -- Omnem crede diem tibi diluxisse supremum. -- 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 from this group, send email to clojure +unsubscribegooglegroups.com or reply to this email with the words REMOVE ME as the subject. -- 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 from this group, send email to clojure+unsubscribegooglegroups.com or reply to this email with the words REMOVE ME as the subject.
questions on extending protocols
The questions below refer to the gist at https://gist.github.com/336674/9ab832a86d203731c6379404d20afded79fe5f5b and to protocols in general: (1) Clojure automatically types hints the first argument when extending a protocol to an interface or class, which is great. But you cannot override this with your own type hint. Wanting to do this would be very unusual, but see the RandomAccess/List case in the example where one interface signifies the performance characteristics but a different interface has the methods you want. Should it be possible to override the type hint? (2) The code for chop is repeated across multiple classes. What is the idiomatic way to DRY this? Should I drop down to using raw extend with maps, or is there more mixin support to come? (3) The code for slice is also repeated, but only for one arity. Does that change the answer to #2? (4) Extending to two different interfaces that a single class implements results in one class winning arbitrarily (e.g. IPersistentVector/RandomAccess). This should also be a fairly unusual case, but is there any plan for specifying precedence? (5) It appears that the overhead for calling a protocol adds a hash lookup (find-protocol-method) over the method invocation itself. Is that the right way to summarize the performance implications? Thanks, Stu -- 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 from this group, send email to clojure+unsubscribegooglegroups.com or reply to this email with the words REMOVE ME as the subject.
Re: Sequential vs. divide and conquer algorithm
On 19 March 2010 17:53, Andrzej ndrwr...@googlemail.com wrote: I've been toying with various implementations of reduce-like functions, trying to do something smarter than a simple iteration over a collection of data. This hasn't worked out very well, my implementation is a lot (~50x) slower than a simple loop. Could anyone point out any bottlenecks in this algorithm and advise me on possible ways of improving it? Well, you're calling subvec about twice as many times (I guess) as there are elements in your input vector. Then you're calling count at least once for each of the intermediate vectors (and twice for those which will be split further). Even with O(1) operations like those, that's certainly going to slow you down significantly if you don't derive a big concurrency-related benefit from it. Ultimately, if what you're trying to do is to perform a reduce-like operation in a non-sequential fashion so that it may be better parallelised (taking advantage of the fact that you're dealing with a commutative operation), perhaps it would be best to split the input sequence into, say, twice as many chunks as you have execution contexts (please tweak this figure, of course), then run a simple reduce on each chunk in separation, with a final combining step at the end? Even with an approach similar to your first take above, perhaps the case of short vectors ( 10 elements, say, or whatever seems to yield the best results) could be handed off to reduce. An example implementation: (defn chunked-commutative-vector-reduce [n f v] (let [cnt (count v) split-points (concat (range 0 cnt (/ cnt n)) [cnt]) subvs (map #(subvec v %1 %2) split-points (rest split-points))] (reduce f (pmap #(reduce f %) subvs Some simplistic benchmarking. For simple addition this seems to be somewhat slower than regular reduce: user (dotimes [_ 5] (time (reduce + (vec (range 10) Elapsed time: 27.575505 msecs Elapsed time: 25.05 msecs Elapsed time: 39.06125 msecs Elapsed time: 25.237215 msecs Elapsed time: 24.404847 msecs user (dotimes [_ 5] (time (chunked-commutative-vector-reduce 4 + (vec (range 10) Elapsed time: 44.034438 msecs Elapsed time: 45.27503 msecs Elapsed time: 50.472547 msecs Elapsed time: 51.770968 msecs Elapsed time: 51.145611 msecs With my convoluted-op the chunked version is somewhat faster (though some particularly slow runs do happen occasionally for whatever reason): (defn convoluted-op [x y] (inc (Long. (Math/round (Math/pow (rem (* x x y y) (+ x y 1)) 8) user (chunked-commutative-vector-reduce 4 convoluted-op (vec (range 10))) 9223372036854775808 user (reduce convoluted-op (vec (range 10))) 9223372036854775808 user (dotimes [_ 5] (time (reduce convoluted-op (vec (range 10) Elapsed time: 459.935904 msecs Elapsed time: 489.130463 msecs Elapsed time: 489.130463 msecs Elapsed time: 479.653072 msecs Elapsed time: 436.05228 msecs Elapsed time: 431.632579 msecs nil user (dotimes [_ 5] (time (chunked-commutative-vector-reduce 4 convoluted-op (vec (range 10) Elapsed time: 332.564412 msecs Elapsed time: 279.848551 msecs Elapsed time: 312.854074 msecs Elapsed time: 301.574794 msecs Elapsed time: 276.898379 msecs nil With + changed to convoluted-op, your sum_tree function takes just under 3,5 s to complete the same calculation on my box. Also, the chunked reduce function basically degenerates into the standard reduce (with minor complications) when called with an initial argument of 1, so the single-threaded runtime is pretty much the same. That's just my initial take... Probably far from the best that one could do. Ideally the number-of-chunks argument would not be necessary at all -- I think there's a system property available on the JVM from which one can obtain the number of available processors and perhaps some day we'll be able to use Grand Central Dispatch or something for things like this. (But note that benchmarking with more work-intensive functions inside the reduce is important in any case.) Oh, one more thing. The presentation by Guy Steele at ICFP 2009, Organizing Functional Code for Parallel Execution; or, foldl and foldr Considered Slightly Harmful, is interesting in this context; links to the presentation video as well as the slides deck are available here: http://lambda-the-ultimate.org/node/3616 By the way, this gave a me an idea which I might be able to put to good use, so -- thanks! :-) Sincerely, Michał -- 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 from this group, send email to clojure+unsubscribegooglegroups.com or reply to this email with
lazy-cons
Hey all, I am working through the problems on project euler. On question number 11 (http://projecteuler.net/index.php?section=problemsid=11), I was unable to come up with a solution, so I cheated and looked at some other people's answer's here: http://clojure-euler.wikispaces.com/Problem+011 Unfortunately, I am so dumb I cannot even understand the solutions very well...hahhaha. The first solution on that page defines the following function: (defn select-dir [array x y ncol span fnx fny] (when (not (zero? span)) (lazy-cons (array-get array x y ncol) (select-dir array (fnx x) (fny y) ncol (dec span) fnx fny Right off the bat, I am wondering what is lazy-cons? I could not find it in the api. -- 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 from this group, send email to clojure+unsubscribegooglegroups.com or reply to this email with the words REMOVE ME as the subject.
Re: For loop question
On Mar 20, 2010, at 13:05 , WoodHacker wrote: When I run the following: (for [y (range 4)] (for [x (range 4)] (println x y))) I get what I expect - 0 0, 1 0, 2 0, 3 0 etc., but at the end of each y loop I also get 4 nils. ((0 0 1 0 2 0 3 0 nil nil nil nil) (0 1 1 1 2 1 3 1 nil nil nil nil) (0 2 What's going on? And how do I fix it?Adding a :when to test for nil does not seem to do anything. what you see is (and I pull it apart here) STDOUT: 0 0 1 0 2 0 3 0 0 1 1 1 2 1 3 1 on the repl output (return value of your expression you see: ((nil nil nil nil) (nil nil nil nil)) which is because the return value of println. Best regards, Heinz -- 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 from this group, send email to clojure+unsubscribegooglegroups.com or reply to this email with the words REMOVE ME as the subject.
Re: lazy-cons
Hi Glen, it's lazy-seq now. Regards, alux Glen Rubin schrieb: Hey all, I am working through the problems on project euler. On question number 11 (http://projecteuler.net/index.php?section=problemsid=11), I was unable to come up with a solution, so I cheated and looked at some other people's answer's here: http://clojure-euler.wikispaces.com/Problem+011 Unfortunately, I am so dumb I cannot even understand the solutions very well...hahhaha. The first solution on that page defines the following function: (defn select-dir [array x y ncol span fnx fny] (when (not (zero? span)) (lazy-cons (array-get array x y ncol) (select-dir array (fnx x) (fny y) ncol (dec span) fnx fny Right off the bat, I am wondering what is lazy-cons? I could not find it in the api. -- 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 from this group, send email to clojure+unsubscribegooglegroups.com or reply to this email with the words REMOVE ME as the subject.
Re: lazy-cons
On Mar 20, 1:52 pm, Glen Rubin rubing...@gmail.com wrote: Hey all, I am working through the problems on project euler. On question number 11 (http://projecteuler.net/index.php?section=problemsid=11), I was unable to come up with a solution, so I cheated and looked at some other people's answer's here: http://clojure-euler.wikispaces.com/Problem+011 Unfortunately, I am so dumb I cannot even understand the solutions very well...hahhaha. The first solution on that page defines the following function: (defn select-dir [array x y ncol span fnx fny] (when (not (zero? span)) (lazy-cons (array-get array x y ncol) (select-dir array (fnx x) (fny y) ncol (dec span) fnx fny Right off the bat, I am wondering what is lazy-cons? I could not find it in the api. That's because it has been removed. It became obsoleted by seq behaviour changes sometime before 1.0 was released. a more up-to-date version of that would be: (defn select-dir [array x y ncol span fnx fny] (when-not (zero? span) (lazy-seq (cons (array-get array x y ncol) (select-dir array (fnx x) (fny y) ncol (dec span) fnx fny) Another approach that is common when constructing lazy seqs, forming a closure over the constant parameters: (defn s-dir [array x y ncol span fnx fny] (letfn [(worker [x y span] (when-not (zero? span) (lazy-seq (cons (array-get array x y ncol) (worker (fnx x) (fny y) (dec span))] (worker x y span))) -- 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 from this group, send email to clojure+unsubscribegooglegroups.com or reply to this email with the words REMOVE ME as the subject.
Re: lazy-cons
And array-get seems to be aget by now. a. Jarkko Oranen schrieb: On Mar 20, 1:52 pm, Glen Rubin rubing...@gmail.com wrote: Hey all, I am working through the problems on project euler. On question number 11 (http://projecteuler.net/index.php?section=problemsid=11), I was unable to come up with a solution, so I cheated and looked at some other people's answer's here: http://clojure-euler.wikispaces.com/Problem+011 Unfortunately, I am so dumb I cannot even understand the solutions very well...hahhaha. The first solution on that page defines the following function: (defn select-dir [array x y ncol span fnx fny] (when (not (zero? span)) (lazy-cons (array-get array x y ncol) (select-dir array (fnx x) (fny y) ncol (dec span) fnx fny Right off the bat, I am wondering what is lazy-cons? I could not find it in the api. That's because it has been removed. It became obsoleted by seq behaviour changes sometime before 1.0 was released. a more up-to-date version of that would be: (defn select-dir [array x y ncol span fnx fny] (when-not (zero? span) (lazy-seq (cons (array-get array x y ncol) (select-dir array (fnx x) (fny y) ncol (dec span) fnx fny) Another approach that is common when constructing lazy seqs, forming a closure over the constant parameters: (defn s-dir [array x y ncol span fnx fny] (letfn [(worker [x y span] (when-not (zero? span) (lazy-seq (cons (array-get array x y ncol) (worker (fnx x) (fny y) (dec span))] (worker x y span))) -- 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 from this group, send email to clojure+unsubscribegooglegroups.com or reply to this email with the words REMOVE ME as the subject.
Re: For loop question
On 20 March 2010 13:05, WoodHacker ramsa...@comcast.net wrote: What's going on? And how do I fix it? Adding a :when to test for nil does not seem to do anything. You'll want to use 'doseq' in place of 'for'. It uses exactly the same syntax as for, but is used solely for side effects (the return value is nil). In contrast, for is a sequence comprehension, meaning that it is to be used primarily for the purpose of building up a sequence of values (like the nils your printlns return). Check out (doc for) and (doc doseq) for more details. Sincerely, Michał -- 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 from this group, send email to clojure+unsubscribegooglegroups.com or reply to this email with the words REMOVE ME as the subject.
Re: Translation from Common Lisp 1
Hello Christophe, this one I like ;-) Thanks regards, alux Christophe Grand schrieb: If you really wan't to go that way you can also choose to remove the namespaces: (defn describe-path [[where what]] (map (comp symbol name) `(there is a ~what going ~where from here.))) On Fri, Mar 19, 2010 at 8:17 AM, alux alu...@googlemail.com wrote: But using symbols for something like this is a bit contrived anyway. Yes, But sometimes it needs contrived examples to get the message. Especially if you have misleading preconceptions. And to me, symbols had always been a way to refer to stuff. And only that. That had to be shaken an is now. (Like the old hastable example: A consistent implementation is returning a constant. Thats slow and doesnt scale, but it's consistent. To me thats been illuminating.) Many thanks to all for the discussion. alux On 18 Mrz., 23:21, Richard Newman holyg...@gmail.com wrote: But using symbols for something like this is a bit contrived anyway. Maybe, but I've seen it in other Common Lisp books/tutorials before. e.g. I'm sure PAIP was one of them. Part of the motivation is that CL symbols always compare with EQ and EQL, whilst strings are not required to do so: cl-user(9): (eq (concatenate 'string foo bar) foobar) nil This means you can use nice constructs such as CASE with symbols, but you need to roll your own using string-equal or string= to handle strings. (Using symbols also saves you typing all those double-quote characters, as well as saving memory and computation during comparison: symbols are interned, unlike strings.) In Clojure (thanks to Java's immutable interned strings) strings compare efficiently with = just like everything else, so there's less motivation. -- 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.comclojure%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en To unsubscribe from this group, send email to clojure+ unsubscribegooglegroups.com or reply to this email with the words REMOVE ME as the subject. -- Professional: http://cgrand.net/ (fr) On Clojure: http://clj-me.cgrand.net/ (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 To unsubscribe from this group, send email to clojure+unsubscribegooglegroups.com or reply to this email with the words REMOVE ME as the subject.
indexing only some elements of a sequence...
Hello all, I'm new to clojure, but not lisp. I'm looking for a functional way to index/number only some items of a list. For example, I know I can do this (indexed is from the contrib seq_utils library): (using a short example to keep it readable) (indexed Now is) - ([0 \N] [1 \o] [2 \w] [3 \space] [4 \i] [5 \s]) What I would like to do is only index those elements that satisfy some predicate, such as: (indexed-pred vowel? Now is) - ([\N] [0 \o] [\w] [\space] [1 \i] [\s]) I want the counter to only increment when the predicate is true, so just filtering out the index on a fully indexed list isn't what I need, it will leave holes in the numbering. I'd be OK with the return result being: ([nil \N] [0 \o] [nil \w] [nil \space] [1 \i] [nil \s]) since a simple map could strip the nils out. I can't help feeling that the solution is just on the edge of my peripheral vision, but I can't see it. Thanks, -Doug P.S. I want to use this to number the instructions in a road rally, where the sequence of instructions are interspersed with other notes and items. Numbering the vowels in a string is a nice simplification. -- 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 from this group, send email to clojure+unsubscribegooglegroups.com or reply to this email with the words REMOVE ME as the subject.
Clojure related project at the Google Summer of Code 2010
Hello. OMII-UK is running a Clojure related project as part of this year's GSoC. http://www.omii.ac.uk/wiki/OgsaDaiDqpClojure Please consider applying. Cheers, Bartek -- 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 from this group, send email to clojure+unsubscribegooglegroups.com or reply to this email with the words REMOVE ME as the subject.
Re: overrding function from other namespace
Hi Kevin, On 20 Mrz., 00:34, Kevin Downey redc...@gmail.com wrote: why are you def'ing your functions in the mock namespace? why are you juggling namespaces at all? Because clojure.contrib.mock says so. The only way that worked for me was switching the namespace. Without switching the namespace I get: Name conflict, can't def report-problem because namespace: apfloattest refers to:#'clojure.contrib.mock/report-problem I'm not sure why you ask me why I'm using a bad solution when I'm asking for a better one.. ;-)) -- Martin -- 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 from this group, send email to clojure+unsubscribegooglegroups.com or reply to this email with the words REMOVE ME as the subject.
Re: overrding function from other namespace
Hi, yes, better than my solution. :) Wrapping the with-bindings around the run-tests I can drop the namespace switch. (with-bindings {#'clojure.contrib.mock/report-problem #'my-report- problem} (run-tests)) The only issue left is that when running the test with leiningen (lein test) I don't have control of the run-tests call. Oh, I just tried this one: (with-bindings {#'clojure.contrib.mock/report-problem #'my-report- problem} (deftest test-sqrtf (expect [apf (times 2 (returns (apf 5)))] (sqrtf 5))) (run-tests) ) which works too. So I can simply wrap all my deftest's inside the with- binding which also works when running the tests with lein test (removing the run-tests to avoid running the test twice). Thanks! -- Martin -- 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 from this group, send email to clojure+unsubscribegooglegroups.com or reply to this email with the words REMOVE ME as the subject.
Re: Installation issues on slack 13.0 (ant?)
On Mar 20, 2:44 pm, Tim Johnson t...@johnsons-web.com wrote: Let me focus the attention of anyone who might be reading this to the file named: `readme.txt' at the top of the directory unzipped from `clojure-1.1.0.zip' The following instructions (and ONLY the following instructions) are present To Run: java -cp clojure.jar clojure.main To Build: ant Unless you're hacking on clojure itself you don't need to build it, there's a pre-built jar file in the zip you downloaded (clojure.jar). So you won't need ant (ant is a like make for Java). So you can just do what it suggests at To Run to launch a REPL. Reading the getting started page on the website will get you further still : http://clojure.org/getting_started If you do need ant then a more modern distro will make your life much easier (eg. apt-get install ant). Before I procede o: Installation must be made easier o: Instructions must be made easier o: Methods for deployments must be made easier. Docs can always be improved, however if you're stuck at the ant step you haven't really done enough with clojure to comment on it's deployment story. - Steve -- 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 from this group, send email to clojure+unsubscribegooglegroups.com or reply to this email with the words REMOVE ME as the subject.
Re: For loop question
I guess you want this: (for [x (range 4) y (range 4)] (str x y)) -- DmitriKo On Mar 20, 2:05 pm, WoodHacker ramsa...@comcast.net wrote: When I run the following: (for [y (range 4)] (for [x (range 4)] (println x y))) I get what I expect - 0 0, 1 0, 2 0, 3 0 etc., but at the end of each y loop I also get 4 nils. ((0 0 1 0 2 0 3 0 nil nil nil nil) (0 1 1 1 2 1 3 1 nil nil nil nil) (0 2 What's going on? And how do I fix it? Adding a :when to test for nil does not seem to do anything. Bill -- 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 from this group, send email to clojure+unsubscribegooglegroups.com or reply to this email with the words REMOVE ME as the subject.
Re: indexing only some elements of a sequence...
Learn to love scan: http://gist.github.com/338682 -Per On Sat, Mar 20, 2010 at 12:13 PM, Douglas Philips d...@mac.com wrote: Hello all, I'm new to clojure, but not lisp. I'm looking for a functional way to index/number only some items of a list. For example, I know I can do this (indexed is from the contrib seq_utils library): (using a short example to keep it readable) (indexed Now is) - ([0 \N] [1 \o] [2 \w] [3 \space] [4 \i] [5 \s]) What I would like to do is only index those elements that satisfy some predicate, such as: (indexed-pred vowel? Now is) - ([\N] [0 \o] [\w] [\space] [1 \i] [\s]) I want the counter to only increment when the predicate is true, so just filtering out the index on a fully indexed list isn't what I need, it will leave holes in the numbering. I'd be OK with the return result being: ([nil \N] [0 \o] [nil \w] [nil \space] [1 \i] [nil \s]) since a simple map could strip the nils out. I can't help feeling that the solution is just on the edge of my peripheral vision, but I can't see it. Thanks, -Doug P.S. I want to use this to number the instructions in a road rally, where the sequence of instructions are interspersed with other notes and items. Numbering the vowels in a string is a nice simplification. -- 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 from this group, send email to clojure+unsubscribegooglegroups.com or reply to this email with the words REMOVE ME as the subject. -- 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 from this group, send email to clojure+unsubscribegooglegroups.com or reply to this email with the words REMOVE ME as the subject.
Re: lazy-xml returns 503 from w3.org
On Mar 20, 2010, at 7:20 , Brian Sletten wrote: Turn off validation. Google around, you will find the parameters to do so. I read a article about this some while ago. the java XML parser aheads the standard definition be downloading the DTD from the w3c. While the w3c made up this silly guideline in their standard they are now pretty unhappy that their servers get tied down by thousands of requests to their servers from code that gets DTD's It is arguable of this behavior makes sense, the DTD will never change. So it might be a good idea to include some of the more often used DTD's directly in the library, that will A) take load of the w3c and make clojure programs work offline without modification, alliteratively we could make the library work in non DTD validating mode by default? Regards, Heinz -- 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 from this group, send email to clojure+unsubscribegooglegroups.com or reply to this email with the words REMOVE ME as the subject.
Re: indexing only some elements of a sequence...
Which looks the same as clojure.contrib.seq/reductions to me... -Steve On 20 Mar 2010, at 13:54, Per Vognsen wrote: Learn to love scan: http://gist.github.com/338682 -Per On Sat, Mar 20, 2010 at 12:13 PM, Douglas Philips d...@mac.com wrote: Hello all, I'm new to clojure, but not lisp. I'm looking for a functional way to index/number only some items of a list. For example, I know I can do this (indexed is from the contrib seq_utils library): (using a short example to keep it readable) (indexed Now is) - ([0 \N] [1 \o] [2 \w] [3 \space] [4 \i] [5 \s]) What I would like to do is only index those elements that satisfy some predicate, such as: (indexed-pred vowel? Now is) - ([\N] [0 \o] [\w] [\space] [1 \i] [\s]) I want the counter to only increment when the predicate is true, so just filtering out the index on a fully indexed list isn't what I need, it will leave holes in the numbering. I'd be OK with the return result being: ([nil \N] [0 \o] [nil \w] [nil \space] [1 \i] [nil \s]) since a simple map could strip the nils out. I can't help feeling that the solution is just on the edge of my peripheral vision, but I can't see it. Thanks, -Doug P.S. I want to use this to number the instructions in a road rally, where the sequence of instructions are interspersed with other notes and items. Numbering the vowels in a string is a nice simplification. -- 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 from this group, send email to clojure+unsubscribegooglegroups.com or reply to this email with the words REMOVE ME as the subject. -- 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 from this group, send email to clojure+unsubscribegooglegroups.com or reply to this email with the words REMOVE ME as the subject. -- 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 from this group, send email to clojure+unsubscribegooglegroups.com or reply to this email with the words REMOVE ME as the subject.
Re: How to use Clojure with Robocode
On Mar 19, 2010, at 8:56 , ubolonton wrote: Hi, Has anyone been able to use Clojure with Robocode? I've followed this http://www.fatvat.co.uk/2009/05/clojure-and-robocode.html but got the error Hi, I hope that in a week or two I am able to release a 'mini game' as a tech demo for something some friends and me are working on, if you're interested in Robocode you might like it. It will be a tournament game where two fleets fight each other. The user will be able to assemble the ships from different modules and script their AI giving them a high level of customizability. Let me know if you're interesting, I'll be offering a few beta logins on the list too :) (the game will be 100% free and open source (at least at some point), no advertising or anything). Regards, Heinz -- 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 from this group, send email to clojure+unsubscribegooglegroups.com or reply to this email with the words REMOVE ME as the subject.
Re: indexing only some elements of a sequence...
Aha! I Googled for scan in seq-utils and didn't find anything. It would be nice if people stuck to standard terminology that has a continuous history going back to the early 60s. -Per On Sat, Mar 20, 2010 at 9:40 PM, Steve Purcell st...@sanityinc.com wrote: Which looks the same as clojure.contrib.seq/reductions to me... -Steve On 20 Mar 2010, at 13:54, Per Vognsen wrote: Learn to love scan: http://gist.github.com/338682 -Per On Sat, Mar 20, 2010 at 12:13 PM, Douglas Philips d...@mac.com wrote: Hello all, I'm new to clojure, but not lisp. I'm looking for a functional way to index/number only some items of a list. For example, I know I can do this (indexed is from the contrib seq_utils library): (using a short example to keep it readable) (indexed Now is) - ([0 \N] [1 \o] [2 \w] [3 \space] [4 \i] [5 \s]) What I would like to do is only index those elements that satisfy some predicate, such as: (indexed-pred vowel? Now is) - ([\N] [0 \o] [\w] [\space] [1 \i] [\s]) I want the counter to only increment when the predicate is true, so just filtering out the index on a fully indexed list isn't what I need, it will leave holes in the numbering. I'd be OK with the return result being: ([nil \N] [0 \o] [nil \w] [nil \space] [1 \i] [nil \s]) since a simple map could strip the nils out. I can't help feeling that the solution is just on the edge of my peripheral vision, but I can't see it. Thanks, -Doug P.S. I want to use this to number the instructions in a road rally, where the sequence of instructions are interspersed with other notes and items. Numbering the vowels in a string is a nice simplification. -- 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 from this group, send email to clojure+unsubscribegooglegroups.com or reply to this email with the words REMOVE ME as the subject. -- 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 from this group, send email to clojure+unsubscribegooglegroups.com or reply to this email with the words REMOVE ME as the subject. -- 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 from this group, send email to clojure+unsubscribegooglegroups.com or reply to this email with the words REMOVE ME as the subject. -- 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 from this group, send email to clojure+unsubscribegooglegroups.com or reply to this email with the words REMOVE ME as the subject.
Re: Maven clojure:repl
Hi, On Sat, Mar 20, 2010 at 04:56:39AM -0700, alux wrote: [INFO] The plugin 'org.apache.maven.plugins:maven-clojure-plugin' does not exist or no valid version could be found I dont know where to search for a solution, so I ask here. Just guessing: you don't have clojure-maven plugin installed? 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 To unsubscribe from this group, send email to clojure+unsubscribegooglegroups.com or reply to this email with the words REMOVE ME as the subject.
Re: clojure naming convention for accessors vs. local variables
Well, even in this case how do lisp programmers typically name their structs vs their variables? In java I could make an Employee class and then an employee object and it was easy to distinguish between the two. If it's not kosher to uppercase a struct, what's the convention for something like that? On Mar 19, 6:38 pm, ataggart alex.tagg...@gmail.com wrote: As the doc for 'accessor notes, you should really eschew this stuff altogether, and be more idiomatic by just using the keyword. If you absolutely know that you need that (slightly) more efficient access, thennamingthe struct with an uppercase first letter works, and isn't too uncommon; besides this is a special-case performance issue, right? On Mar 19, 4:36 pm, strattonbrazil strattonbra...@gmail.com wrote: If am creating accessors to access structures, how should they be named? (defstruct employer :employee) (defstruct employee :employer) (def employee-name (accessor employee :employer)) (def employer-name (accessor employer :employee)) In a situation where one struct is pointing to the other, is that the best accessor name? Since structs are lower case do they clash with variables and accessors ever? I could easily see myself doing (def employee (...)) Here, I assume it won't have any problems, but does it become problematic later? Especially since it seems that accessors can be in either order. (defstruct vert :id :edgeId) (defstruct edge :id :vertId) (def vert (accessor edge :vert)) (def edge (accessor vert :edge)) I know this could be easily resolved by changing the accessor definitions to get-vert and get-edge, but I was hoping it wouldn't be necessary. Once again, I'm bound to have a variable somewhere in my code called vert and edge. Java and Scala don't seem to have this problem. Especially using Scala's builtin getter setter feature, which has strick ordering like edge.vert // returns the vert for this edge vert.edge // returns the edge for this vert Is there a betternamingconvention to follow? get-vert and get- edge? Should structures ever be uppercase to distinguish them? That doesn't seem to be the lisp convention. In these cases it seems the struct name would never be a problem, but it seems I'm stuck between making a convenient accessor name and easily stomping over if making a convenient variable name. -- 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 from this group, send email to clojure+unsubscribegooglegroups.com or reply to this email with the words REMOVE ME as the subject.
Re: indexing only some elements of a sequence...
Yeah, I was being a bit too glib. One of my favorite things about Clojure is definitely what you mention. As for the matter at hand, the name 'reductions' is perhaps more descriptive but the con is that it less standard and almost three times as long as 'scan'. The importance of descriptiveness in names is often overstated. Someone who has never seen this function before might perhaps see the name and correctly guess a relationship of some sort with 'reduce'. But that does not help him much in his quest to understanding the code if he has no experience with scans. I find recognizability and memorability is usually a more important metric. Anyway, I don't want to derail this thread any further. :) -Per On Sat, Mar 20, 2010 at 10:16 PM, Meikel Brandmeyer m...@kotka.de wrote: Hi, On Sat, Mar 20, 2010 at 09:50:12PM +0700, Per Vognsen wrote: Aha! I Googled for scan in seq-utils and didn't find anything. It would be nice if people stuck to standard terminology that has a continuous history going back to the early 60s. So we use names like car and cdr? This is one of my favorite non-technical points pro clojure: It blows of the musty smell of the last 50 years. (Whether scan falls in this category is a different question. But the others use bad names, so we should too is not a good argument.) 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 To unsubscribe from this group, send email to clojure+unsubscribegooglegroups.com or reply to this email with the words REMOVE ME as the subject. -- 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 from this group, send email to clojure+unsubscribegooglegroups.com or reply to this email with the words REMOVE ME as the subject.
Re: indexing only some elements of a sequence...
One last thing: On Sat, Mar 20, 2010 at 10:16 PM, Meikel Brandmeyer m...@kotka.de wrote: Hi, On Sat, Mar 20, 2010 at 09:50:12PM +0700, Per Vognsen wrote: Aha! I Googled for scan in seq-utils and didn't find anything. It would be nice if people stuck to standard terminology that has a continuous history going back to the early 60s. So we use names like car and cdr? Perhaps if we were still programming with cons cells as fundamental building blocks. Cons cells are decidedly not linked list nodes but binary tree nodes that can be used to build right-leaning cons lists, left-leaning snoc lists, a-lists and anything in between. In that hypothetical case, yes, maybe car and cdr would not be so bad, everything considered. They are short, symmetric (3 characters, one middle character difference) and memorable once learned. At this point in time, rejecting them based on their half-forgotten origins in a computer architecture of yore is a little like rejecting a name on the basis of its Greek etymology. Every name is a more or less conventional sign. Convention isn't everything but neither is it nothing. For a sequence abstraction though, first and rest are infinitely better choices. Fortunately that is what Clojure uses them for. In Common Lisp, they are mere synonyms for car and cdr, though with admittedly useful connotations. -Per -- 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 from this group, send email to clojure+unsubscribegooglegroups.com or reply to this email with the words REMOVE ME as the subject.
Re: separating ui and content in clojure
On Sat, 20 Mar 2010 08:11:49 -0700 (PDT) strattonbrazil strattonbra...@gmail.com wrote: I'd like to separate my ui Swing/JOGL from the content, so my code is relatively unaware of the UI around it. For example, I create a global context that holds on my content. I then make a UI that when the user does some interaction like a mouse click or drag, the UI creates a new context. My OO instincts would be to create a context and pass it to all my UI objects that receive events and mutate them, but if I'm dealing with an immutable class if I pass it to each UI object, when one UI object makes a new context, it isn't reflected in the other UIs. Basically I want all UIs pointing to the same context and each UI being able to create a new context that each UI points to. It seems that when one UI updates the global context reference with a 'def', the others are still using the old one. You need to update shared data, and that doesn't seem avoidable. In clojure, you do that with either a ref or an atom holding the data, depending on how you need to update it. This will make it thread safe if/when you start running your UI objects in different threads. mike -- Mike Meyer m...@mired.org 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 To unsubscribe from this group, send email to clojure+unsubscribegooglegroups.com or reply to this email with the words REMOVE ME as the subject.
Re: Maven clojure:repl
Hm. Wer lesen kann, ist klar im Vorteil ;-) Well, so I hope there is THE plugin, and not some plugins, and try the first google shows: git clone git://github.com/talios/clojure-maven-plugin cd clojure-maven-plugin mvn install back to incanter, try again. Still the same. Sad, I had hope thats enough. Seems I need to do more to the plugin than mvn install. Do I have to put some entries in the incanter pom, or in my myvan init file? Thank you for you answer, alux Meikel Brandmeyer schrieb: Hi, On Sat, Mar 20, 2010 at 04:56:39AM -0700, alux wrote: [INFO] The plugin 'org.apache.maven.plugins:maven-clojure-plugin' does not exist or no valid version could be found I dont know where to search for a solution, so I ask here. Just guessing: you don't have clojure-maven plugin installed? 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 To unsubscribe from this group, send email to clojure+unsubscribegooglegroups.com or reply to this email with the words REMOVE ME as the subject.
Re: clojure naming convention for accessors vs. local variables
On Sat, Mar 20, 2010 at 11:03 AM, strattonbrazil strattonbra...@gmail.comwrote: Well, even in this case how do lisp programmers typically name their structs vs their variables? In java I could make an Employee class and then an employee object and it was easy to distinguish between the two. If it's not kosher to uppercase a struct, what's the convention for something like that? In Clojure people tend to keep everything lowercase. The presence of camelcase or capitalized things tend to denote the use of Java. There's little incentive to distinguish structs in Clojure with the ubiquity of immutable values. David -- 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 from this group, send email to clojure+unsubscribegooglegroups.com or reply to this email with the words REMOVE ME as the subject.
Re: For loop question
On Sat, Mar 20, 2010 at 8:05 AM, WoodHacker ramsa...@comcast.net wrote: When I run the following: (for [y (range 4)] (for [x (range 4)] (println x y))) I get what I expect - 0 0, 1 0, 2 0, 3 0 etc., but at the end of each y loop I also get 4 nils. ((0 0 1 0 2 0 3 0 nil nil nil nil) (0 1 1 1 2 1 3 1 nil nil nil nil) (0 2 What's going on? And how do I fix it?Adding a :when to test for nil does not seem to do anything. Bill for is not a for loop as pointed out by Michael, it's a list comprehension (similar to Python and Haskell). It produces a lazy sequence. You can do what you want with the following: (doseq [[x y] (for [y (range 4) x (range 4)] [x y])] (println x y)) -- 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 from this group, send email to clojure+unsubscribegooglegroups.com or reply to this email with the words REMOVE ME as the subject.
Re: clojure naming convention for accessors vs. local variables
This will change in Clojure 1.2, with defstruct superseded by deftype, and with capitalization for defprotocols and deftypes. You might want to compare this Clojure example: http://github.com/relevance/labrepl/blob/master/src/solutions/rock_paper_scissors.clj to the OO solutions at http://www.rubyquiz.com/quiz16.html If you download the labrepl project you can run it to get instructions for building the rock/paper/scissors example step-by-step. Stu Well, even in this case how do lisp programmers typically name their structs vs their variables? In java I could make an Employee class and then an employee object and it was easy to distinguish between the two. If it's not kosher to uppercase a struct, what's the convention for something like that? On Mar 19, 6:38 pm, ataggart alex.tagg...@gmail.com wrote: As the doc for 'accessor notes, you should really eschew this stuff altogether, and be more idiomatic by just using the keyword. If you absolutely know that you need that (slightly) more efficient access, thennamingthe struct with an uppercase first letter works, and isn't too uncommon; besides this is a special-case performance issue, right? On Mar 19, 4:36 pm, strattonbrazil strattonbra...@gmail.com wrote: If am creating accessors to access structures, how should they be named? (defstruct employer :employee) (defstruct employee :employer) (def employee-name (accessor employee :employer)) (def employer-name (accessor employer :employee)) In a situation where one struct is pointing to the other, is that the best accessor name? Since structs are lower case do they clash with variables and accessors ever? I could easily see myself doing (def employee (...)) Here, I assume it won't have any problems, but does it become problematic later? Especially since it seems that accessors can be in either order. (defstruct vert :id :edgeId) (defstruct edge :id :vertId) (def vert (accessor edge :vert)) (def edge (accessor vert :edge)) I know this could be easily resolved by changing the accessor definitions to get-vert and get-edge, but I was hoping it wouldn't be necessary. Once again, I'm bound to have a variable somewhere in my code called vert and edge. Java and Scala don't seem to have this problem. Especially using Scala's builtin getter setter feature, which has strick ordering like edge.vert // returns the vert for this edge vert.edge // returns the edge for this vert Is there a betternamingconvention to follow? get-vert and get- edge? Should structures ever be uppercase to distinguish them? That doesn't seem to be the lisp convention. In these cases it seems the struct name would never be a problem, but it seems I'm stuck between making a convenient accessor name and easily stomping over if making a convenient variable name. -- 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 from this group, send email to clojure +unsubscribegooglegroups.com or reply to this email with the words REMOVE ME as the subject. -- 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 from this group, send email to clojure+unsubscribegooglegroups.com or reply to this email with the words REMOVE ME as the subject.
Re: Maven clojure:repl
So, I found a file: %repo%\org\apache\maven\plugins\maven-clojure-plugin\maven-metadata- central.xml containing ?xml version=1.0 encoding=UTF-8? metadata groupIdorg.apache.maven.plugins/groupId artifactIdmaven-clojure-plugin/artifactId /metadata No, I dont know where it comes from. a. alux schrieb: Hm. It cant be an incanter problem. In an empty directory, I get: D:\projekts\testmvn clojure:swank [INFO] Scanning for projects... [INFO] Searching repository for plugin with prefix: 'clojure'. [INFO] [ERROR] BUILD ERROR [INFO] [INFO] The plugin 'org.apache.maven.plugins:maven-clojure-plugin' does not exist or no valid version could be found ... I dont knwo what to do. Thanks regards, alux alux schrieb: Um, thats been copy and paste, yes. (side remark, I read on about the plugin, and now I installed the needed swank file too) Thanks and greetings, alux liebke schrieb: Ah, you're right, only the bin/swank script calls maven the clj and clj.bat scripts are stand-alone, I thought I had changed them (but it's better that they're stand-alone). Was the following the actual error? [ERROR] BUILD ERROR [INFO] [INFO] The plugin 'org.apache.maven.plugins:maven-clojure-plugin' does not exist or no valid version could be found The Clojure Maven plugin should be called clojure-maven-plugin, not maven-clojure-plugin, did you change the pom file? David On Mar 20, 7:56 am, alux alu...@googlemail.com wrote: Hello, I'm just go through the Incanter getting-startedhttp://data-sorcery.org/2009/12/20/getting-started/ There I find, that I can use mvn clojure:repl But that doesnt work. [ERROR] BUILD ERROR [INFO] [INFO] The plugin 'org.apache.maven.plugins:maven-clojure-plugin' does not exist or no valid version could be found I dont know where to search for a solution, so I ask here. Thanks for any help, alux -- 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 from this group, send email to clojure+unsubscribegooglegroups.com or reply to this email with the words REMOVE ME as the subject.
Re: Maven clojure:repl
deleting it doesnt help, it seems to be reloaded when I run clojure:swank a. alux schrieb: So, I found a file: %repo%\org\apache\maven\plugins\maven-clojure-plugin\maven-metadata- central.xml containing ?xml version=1.0 encoding=UTF-8? metadata groupIdorg.apache.maven.plugins/groupId artifactIdmaven-clojure-plugin/artifactId /metadata No, I dont know where it comes from. a. alux schrieb: Hm. It cant be an incanter problem. In an empty directory, I get: D:\projekts\testmvn clojure:swank [INFO] Scanning for projects... [INFO] Searching repository for plugin with prefix: 'clojure'. [INFO] [ERROR] BUILD ERROR [INFO] [INFO] The plugin 'org.apache.maven.plugins:maven-clojure-plugin' does not exist or no valid version could be found ... I dont knwo what to do. Thanks regards, alux alux schrieb: Um, thats been copy and paste, yes. (side remark, I read on about the plugin, and now I installed the needed swank file too) Thanks and greetings, alux liebke schrieb: Ah, you're right, only the bin/swank script calls maven the clj and clj.bat scripts are stand-alone, I thought I had changed them (but it's better that they're stand-alone). Was the following the actual error? [ERROR] BUILD ERROR [INFO] [INFO] The plugin 'org.apache.maven.plugins:maven-clojure-plugin' does not exist or no valid version could be found The Clojure Maven plugin should be called clojure-maven-plugin, not maven-clojure-plugin, did you change the pom file? David On Mar 20, 7:56 am, alux alu...@googlemail.com wrote: Hello, I'm just go through the Incanter getting-startedhttp://data-sorcery.org/2009/12/20/getting-started/ There I find, that I can use mvn clojure:repl But that doesnt work. [ERROR] BUILD ERROR [INFO] [INFO] The plugin 'org.apache.maven.plugins:maven-clojure-plugin' does not exist or no valid version could be found I dont know where to search for a solution, so I ask here. Thanks for any help, alux -- 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 from this group, send email to clojure+unsubscribegooglegroups.com or reply to this email with the words REMOVE ME as the subject.
Re: Maven clojure:repl
But even if I delete it, and do mvn -o clojure:swank I get the same error. Black maven magic. ;-( Regards, a. alux schrieb: deleting it doesnt help, it seems to be reloaded when I run clojure:swank a. alux schrieb: So, I found a file: %repo%\org\apache\maven\plugins\maven-clojure-plugin\maven-metadata- central.xml containing ?xml version=1.0 encoding=UTF-8? metadata groupIdorg.apache.maven.plugins/groupId artifactIdmaven-clojure-plugin/artifactId /metadata No, I dont know where it comes from. a. alux schrieb: Hm. It cant be an incanter problem. In an empty directory, I get: D:\projekts\testmvn clojure:swank [INFO] Scanning for projects... [INFO] Searching repository for plugin with prefix: 'clojure'. [INFO] [ERROR] BUILD ERROR [INFO] [INFO] The plugin 'org.apache.maven.plugins:maven-clojure-plugin' does not exist or no valid version could be found ... I dont knwo what to do. Thanks regards, alux alux schrieb: Um, thats been copy and paste, yes. (side remark, I read on about the plugin, and now I installed the needed swank file too) Thanks and greetings, alux liebke schrieb: Ah, you're right, only the bin/swank script calls maven the clj and clj.bat scripts are stand-alone, I thought I had changed them (but it's better that they're stand-alone). Was the following the actual error? [ERROR] BUILD ERROR [INFO] [INFO] The plugin 'org.apache.maven.plugins:maven-clojure-plugin' does not exist or no valid version could be found The Clojure Maven plugin should be called clojure-maven-plugin, not maven-clojure-plugin, did you change the pom file? David On Mar 20, 7:56 am, alux alu...@googlemail.com wrote: Hello, I'm just go through the Incanter getting-startedhttp://data-sorcery.org/2009/12/20/getting-started/ There I find, that I can use mvn clojure:repl But that doesnt work. [ERROR] BUILD ERROR [INFO] [INFO] The plugin 'org.apache.maven.plugins:maven-clojure-plugin' does not exist or no valid version could be found I dont know where to search for a solution, so I ask here. Thanks for any help, alux -- 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 from this group, send email to clojure+unsubscribegooglegroups.com or reply to this email with the words REMOVE ME as the subject.
Re: Maven clojure:repl
If this was a fresh project with no plugins defined, maven would look in the default group, for either clojure-maven-plugin or maven-clojure-plugin. -- Pull me down under... On Sun, Mar 21, 2010 at 7:09 AM, liebke lie...@gmail.com wrote: The Clojure Maven plugin should be called clojure-maven-plugin, not maven-clojure-plugin, did you change the pom file? -- 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 from this group, send email to clojure+unsubscribegooglegroups.com or reply to this email with the words REMOVE ME as the subject.
Swank, ELPA and Emacs version do you use?
Sorry to have so many questions. I lookes at swank at github, it says it supports Emacs 23 and up; and I should use ELPA to install it. The ELPA install page, explains how to install stuff for Emacs 21 and 22. As far as I understand, the Emacs init files dont support the usage of different EMacs versions. So which Emacs version do you use? Thank you, alux -- 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 from this group, send email to clojure+unsubscribegooglegroups.com or reply to this email with the words REMOVE ME as the subject.
Re: Maven clojure:repl
Hi Mark, sound plausible. But what should I do now? If there is any way to tell maven what it should use, I'd be happy. Preferred in settings.xml, so i can use it in every project. Thank you, alux Mark Derricutt schrieb: If this was a fresh project with no plugins defined, maven would look in the default group, for either clojure-maven-plugin or maven-clojure-plugin. -- Pull me down under... On Sun, Mar 21, 2010 at 7:09 AM, liebke lie...@gmail.com wrote: The Clojure Maven plugin should be called clojure-maven-plugin, not maven-clojure-plugin, did you change the pom file? -- 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 from this group, send email to clojure+unsubscribegooglegroups.com or reply to this email with the words REMOVE ME as the subject.
Re: clojure.walk
I discussed prewalk and postwalk with a another Clojure user that I am friends with. He sent me the following, via email, this morning: I have a workaround/solution for you.I still don't know exactly why, but the :else clause in walk calls outer on form. This will give you all sorts of class cast exceptions if you only wanted to apply the function to each element individually. With that said, just wrap your function with another that ignores any sequential structures. (defn ignore-sequential [f] #(if (sequential? %) % (f %))) user (prewalk (ignore-sequential inc) [1 [2] 3]) [2 [3] 4] user (postwalk (ignore-sequential inc) [1 [2] 3]) [2 [3] 4] -- 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 from this group, send email to clojure+unsubscribegooglegroups.com or reply to this email with the words REMOVE ME as the subject.
Re: Swank, ELPA and Emacs version do you use?
M-x version GNU Emacs 23.1.1 (i386-apple-darwin9.8.0, NS apple-appkit-949.54) of 2009-08-16 on black.local Most of my configuration comes from the Emacs Stater Kit: http://github.com/technomancy/emacs-starter-kit On Mar 20, 3:46 pm, alux alu...@googlemail.com wrote: Sorry to have so many questions. I lookes at swank at github, it says it supports Emacs 23 and up; and I should use ELPA to install it. The ELPA install page, explains how to install stuff for Emacs 21 and 22. As far as I understand, the Emacs init files dont support the usage of different EMacs versions. So which Emacs version do you use? Thank you, alux -- 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 from this group, send email to clojure+unsubscribegooglegroups.com or reply to this email with the words REMOVE ME as the subject.
Re: Swank, ELPA and Emacs version do you use?
* alux alu...@googlemail.com [100320 11:59]: Sorry to have so many questions. I lookes at swank at github, it says it supports Emacs 23 and up; and I should use ELPA to install it. The ELPA install page, explains how to install stuff for Emacs 21 and 22. As far as I understand, the Emacs init files dont support the usage of different EMacs versions. Why would you want to? But if you did choose to use multiple versions, perhaps you could bootstrap such a process by combining --no-init-file, --no-site-file, and --load So which Emacs version do you use? I'm using 23. I just installed it yesterday - in part to better use ELPA. 23 compiled and installed with 0 issues. I then bootstrapped ELPA with 0 issues. -- Tim t...@johnsons-web.com http://www.akwebsoft.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 To unsubscribe from this group, send email to clojure+unsubscribegooglegroups.com or reply to this email with the words REMOVE ME as the subject.
Re: Swank, ELPA and Emacs version do you use?
On Sat, Mar 20, 2010 at 12:46 PM, alux alu...@googlemail.com wrote: As far as I understand, the Emacs init files dont support the usage of different EMacs versions. So which Emacs version do you use? You can use Emacs 22, but since it's pretty old not very many people use it, so the Clojure support for it is not very well-tested. Unless you are in an environment with very strict limitations on what software you can install, you should update to 23, the latest release. -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 To unsubscribe from this group, send email to clojure+unsubscribegooglegroups.com or reply to this email with the words REMOVE ME as the subject.
Re: Maven clojure:repl
I'm just go through the Incanter getting-started http://data-sorcery.org/2009/12/20/getting-started/ There I find, that I can use mvn clojure:repl I dont know where to search for a solution, so I ask here. There's a pom.xml that works at http://hohonuuli.blogspot.com/2010/01/maven-and-clojure-im-trying-to-setup.html . You can copy and paste it into yours and things *should* work. Cheers -- ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ 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 To unsubscribe from this group, send email to clojure+unsubscribegooglegroups.com or reply to this email with the words REMOVE ME as the subject.
Re: Sequential vs. divide and conquer algorithm
Throwing in my 2 cents: (def chunk-size 2000) (defn sum-tree-part [nums start length] (reduce #(+ %1 (nth nums (+ start %2))) 0 (range length))) (defn sum-partition[nums] (reduce + (pmap #(sum-tree-part nums % chunk-size) (range 0 (count nums) chunk-size ; Save the vec and reuse it. Seems to take longer to create the vec than sum it. (def vec-range (vec (range 100))) (println sum-partition: (sum-partition vec-range)) (dotimes [_ 5] (time (sum-partition vec-range))) (println sum-seq: (sum_seq vec-range)) (dotimes [_ 5] (time (sum_seq vec-range))) (println sum-tree2: (sum_tree2 vec-range)) (dotimes [_ 5] (time (sum_tree2 vec-range))) Results: sum-partition: 4950 Elapsed time: 543.951 msecs Elapsed time: 521.138 msecs Elapsed time: 512.409 msecs Elapsed time: 540.504 msecs Elapsed time: 512.003 msecs sum-seq: 4950 Elapsed time: 687.038 msecs Elapsed time: 689.839 msecs Elapsed time: 690.173 msecs Elapsed time: 690.715 msecs Elapsed time: 690.543 msecs sum-tree2: 4950 Elapsed time: 809.912 msecs Elapsed time: 829.039 msecs Elapsed time: 823.197 msecs Elapsed time: 820.383 msecs Elapsed time: 821.239 msecs I have a 5 year old dual core computer. It would be interesting to see if someone with more cores has a greater improvement over sum-seq. -Matt Courtney -- 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 from this group, send email to clojure+unsubscribegooglegroups.com or reply to this email with the words REMOVE ME as the subject.