Re: lazy-xml returns 503 from w3.org

2010-03-20 Thread Brian Sletten
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

questions on extending protocols

2010-03-20 Thread Stuart Halloway
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

Re: Sequential vs. divide and conquer algorithm

2010-03-20 Thread Michał Marczyk
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

lazy-cons

2010-03-20 Thread Glen Rubin
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

Re: For loop question

2010-03-20 Thread Heinz N. Gies
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

Re: lazy-cons

2010-03-20 Thread alux
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

Re: lazy-cons

2010-03-20 Thread Jarkko Oranen
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

Re: lazy-cons

2010-03-20 Thread alux
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

Re: For loop question

2010-03-20 Thread Michał Marczyk
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

Re: Translation from Common Lisp 1

2010-03-20 Thread alux
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,

indexing only some elements of a sequence...

2010-03-20 Thread Douglas Philips
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

Clojure related project at the Google Summer of Code 2010

2010-03-20 Thread Bartosz Dobrzelecki
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

Re: overrding function from other namespace

2010-03-20 Thread Martin Hauner
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

Re: overrding function from other namespace

2010-03-20 Thread Martin Hauner
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

Re: Installation issues on slack 13.0 (ant?)

2010-03-20 Thread Steve
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)

Re: For loop question

2010-03-20 Thread DmitriKo
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

Re: indexing only some elements of a sequence...

2010-03-20 Thread Per Vognsen
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

Re: lazy-xml returns 503 from w3.org

2010-03-20 Thread Heinz N. Gies
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

Re: indexing only some elements of a sequence...

2010-03-20 Thread Steve Purcell
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

Re: How to use Clojure with Robocode

2010-03-20 Thread Heinz N. Gies
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

Re: indexing only some elements of a sequence...

2010-03-20 Thread Per Vognsen
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

Re: Maven clojure:repl

2010-03-20 Thread Meikel Brandmeyer
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

Re: clojure naming convention for accessors vs. local variables

2010-03-20 Thread strattonbrazil
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

Re: indexing only some elements of a sequence...

2010-03-20 Thread Per Vognsen
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

Re: indexing only some elements of a sequence...

2010-03-20 Thread Per Vognsen
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

Re: separating ui and content in clojure

2010-03-20 Thread Mike Meyer
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

Re: Maven clojure:repl

2010-03-20 Thread alux
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

Re: clojure naming convention for accessors vs. local variables

2010-03-20 Thread David Nolen
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.

Re: For loop question

2010-03-20 Thread David Nolen
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

Re: clojure naming convention for accessors vs. local variables

2010-03-20 Thread Stuart Halloway
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

Re: Maven clojure:repl

2010-03-20 Thread alux
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.

Re: Maven clojure:repl

2010-03-20 Thread alux
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

Re: Maven clojure:repl

2010-03-20 Thread alux
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:

Re: Maven clojure:repl

2010-03-20 Thread Mark Derricutt
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

Swank, ELPA and Emacs version do you use?

2010-03-20 Thread alux
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

Re: Maven clojure:repl

2010-03-20 Thread alux
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

Re: clojure.walk

2010-03-20 Thread cej38
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

Re: Swank, ELPA and Emacs version do you use?

2010-03-20 Thread Seth
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

Re: Swank, ELPA and Emacs version do you use?

2010-03-20 Thread Tim Johnson
* 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

Re: Swank, ELPA and Emacs version do you use?

2010-03-20 Thread Phil Hagelberg
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

Re: Maven clojure:repl

2010-03-20 Thread Brian Schlining
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

Re: Sequential vs. divide and conquer algorithm

2010-03-20 Thread Matt
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