Re: help needed to use reducers and monoid

2012-08-19 Thread nicolas.o...@gmail.com
How do I construct a combining fn out of 'max-key' and is there an idiom or a pattern for doing so? You might use the fact that -Infinity is a neutral element for max. (Or the smallest long if you work with longs). Alternatively you can represent your value as either a number or nil, nil being

Re: help needed to use reducers and monoid

2012-08-19 Thread Jim - FooBar();
HI nicolas, first of all thanks for your time...I do appreciate it...Ok let's see, On 19/08/12 13:01, nicolas.o...@gmail.com wrote: You might use the fact that -Infinity is a neutral element for max. (Or the smallest long if you work with longs). Alternatively you can represent your value as

Re: help needed to use reducers and monoid

2012-08-19 Thread nicolas.o...@gmail.com
Hi Jim, I tried a bit. The performance of this is not perfect but seems not horrible. It can do a level 5 exploration in 11 sec on my computer, with a branching factor of 30. (Of course, there is very little computation for the next move.) The generation is now lazy, but the depth is used in the

Re: help needed to use reducers and monoid

2012-08-19 Thread nicolas.o...@gmail.com
By the way, I just found an obvious bug in that code, but that should be easy to correct. (if (= res Double/NEGATIVE_INFINITY) (evaluate (:board tree)) res This is obviously wrong. -- You received this message because you are subscribed to the Google Groups Clojure group. To

Re: help needed to use reducers and monoid

2012-08-19 Thread Jim - FooBar();
On 19/08/12 21:09, nicolas.o...@gmail.com wrote: By the way, I just found an obvious bug in that code, but that should be easy to correct. (if (= res Double/NEGATIVE_INFINITY) (evaluate (:board tree)) res This is obviously wrong. thanks a lot Nicolas...I'll definitely

Re: help needed to use reducers and monoid

2012-08-19 Thread nicolas.o...@gmail.com
thanks a lot Nicolas...I'll definitely play around with your code tomorrow morning...if you say you can go up to level 5 in 11 sec this is really good performance -I can't wait to explore the code...I'll let you know of any comments of mine soon! Of course, don't trust this code. I have

Re: help needed to use reducers and monoid

2012-08-19 Thread nicolas.o...@gmail.com
A correction for the wrong part: (defn my-max ([x y] (if (nil? x) y (if (nil? y) x (max x y ([] nil)) (defn tree-value ^double [tree evaluate ^long depth] (let [children (:children tree)] (if (or (zero? depth)) (evaluate (:board

Having issues installing clj-http

2012-08-19 Thread Mayank Jain
Hi, I am trying to install clj-http but having issues. Here's the gist : https://gist.github.com/3388644 Am I missing something? Environment : Ubuntu 12.04, 64Bit, Emacs-snapshot, lein2. Thanks. -- You received this message because you are subscribed to the Google Groups Clojure group. To post

Re: Logic Programming

2012-08-19 Thread Benjamin Chi
Hi Jim. Where is that located? Thanks. On Sunday, May 25, 2008 10:28:29 PM UTC-4, jim wrote: I just uploaded a file to the files area that implements a logic programming system from the book The Reasoned Schemer in Clojure. This book is a sequel to The Little Schemer and I was having a

SaxParseException when using the Rome rss library

2012-08-19 Thread keedon
Hi, I've got a clojure problem and I'm hoping someone can help: I'm trying to parse an rss feed which contains illegal characters and I'm getting this error SAXParseException An invalid XML character (Unicode: 0x19) was found in the element content of the document. I've tried adding a

Re: Logic Programming

2012-08-19 Thread David Nolen
On Fri, Aug 17, 2012 at 11:45 PM, Benjamin Chi bch...@gmail.com wrote: Hi Jim. Where is that located? Thanks. http://github.com/jduey/mini-kanren -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to

Re: SaxParseException when using the Rome rss library

2012-08-19 Thread Richard Lyman
On Fri, Aug 17, 2012 at 5:26 PM, keedon keith.po...@gmail.com wrote: Hi, I've got a clojure problem and I'm hoping someone can help: I'm trying to parse an rss feed which contains illegal characters and I'm getting this error SAXParseException An invalid XML character (Unicode: 0x19) was

Re: help needed to use reducers and monoid

2012-08-19 Thread Jim - FooBar();
Hi Nicolas, as you can see I couldn't sleep without trying out your snippet! :-) Unfortunately, your code gives me a: NullPointerException clojure.lang.Numbers.ops (Numbers.java:942) clojure.lang.Numbers.gt (Numbers.java:227) clojure.core/max-key (core.clj:4434)