Re: Meta data access

2012-10-22 Thread Jim - FooBar();
Direct copy-paste from my repl: user= (defn ^{:test true} f1 [] #_= (println call f1 fn)) #'user/f1 user= user= (defn ^{:test false} f2 [] #_= (println call f2 fn)) #'user/f2 user= (:test (meta (var f1))) true user= (:test (meta (var f2))) false user= (println (:test (meta (var

Re: Coming from Common Lisp to Clojure

2012-10-18 Thread Jim - FooBar();
On 18/10/12 17:37, Brian Craft wrote: It's not just you. I'm also surprised at the amount of syntax and the number of ways of doing some things. I suspect that if you come from java or C++ it seems like a simple language, but it feels pretty cluttered compared to other languages. The '-'

trampoline not compatible with reducers?

2012-10-16 Thread Jim - FooBar();
Hi everyone, I'm pretty sure i'm using trampoline the right way but still I get this exception: ClassCastException Clondie24.lib.search$search$minimize__3075$fn__3076 cannot be cast to java.lang.Number Clondie24.lib.search/search/minimize--3075 (search.clj:47) here is the code: (defn

Re: trampoline not compatible with reducers?

2012-10-16 Thread Jim - FooBar();
On 16/10/12 19:15, Kevin Downey wrote: you are declaring the functions return doubles, but in fact returning functions or doubles yes you're right (my bad) but the same thing happens without the type-hinting - albeit in a different place and different originating function: ClassCastException

Re: trampoline not compatible with reducers?

2012-10-16 Thread Jim - FooBar();
, Jim - FooBar(); jimpil1...@gmail.com wrote: On 16/10/12 19:15, Kevin Downey wrote: you are declaring the functions return doubles, but in fact returning functions or doubles yes you're right (my bad) but the same thing happens without the type-hinting - albeit in a different place and different

parallel alpha-beta pruning possible?

2012-10-16 Thread Jim - FooBar();
After watching this presentation[1] by Brian Goetz, in which he discusses the fork-join framework and how it is intended to be used I was left with a major question. Around the end of the talk he said and I quote ...fork-join can be used for game-tree exploration... while the slides actually

Re: parallel alpha-beta pruning possible?

2012-10-16 Thread Jim - FooBar();
On 16/10/12 21:48, Alan Malloy wrote: You will get better results from a game-programming forum, or indeed from a google search for parallel alpha beta than from a bunch of clojure guys with no particular experience in your problem domain. The question is more around JDK7 and reducers. Google

Re: Evaluating an anonymous function with closure

2012-10-15 Thread Jim - FooBar();
On 15/10/12 19:42, Ben Smith-Mannschott wrote: If the distinction I'm trying to make is not clear to you, I'd suggest having a look athttp://www.infoq.com/presentations/Clojure-Macros (It does a good job exploring these kinds of distinctions as it's vital to have an accurate mental model of how

Re: Evaluating an anonymous function with closure

2012-10-15 Thread Jim - FooBar();
On 15/10/12 22:44, Alan Malloy wrote: On Oct 15, 1:07 pm, Jim - FooBar(); jimpil1...@gmail.com wrote: On 15/10/12 19:42, Ben Smith-Mannschott wrote: If the distinction I'm trying to make is not clear to you, I'd suggest having a look athttp://www.infoq.com/presentations/Clojure-Macros

Re: Evaluating an anonymous function with closure

2012-10-15 Thread Jim - FooBar();
On 16/10/12 01:45, Andy Fingerhut wrote: On Oct 15, 2012, at 5:41 PM, Jim - FooBar(); wrote: On 15/10/12 22:44, Alan Malloy wrote: You add the numbers at compile time, and then time how long it takes to...do nothing to them, at runtime. You are comparing N to zero, not to some smaller factor

Re: pmap performance degradation after 30-40 min of work?

2012-10-14 Thread Jim - FooBar();
On 14/10/12 00:17, Ben Mabey wrote: I switched from pmap to (r/fold n (r/monoid into vector) conj coll)) and the same thing happened again! after approximately 50 minutes cpu utilisation dropped from 4/4 to 1/4...I don't understand! Jim Are you holding on to the head of the collection?

arguments to 'lein uberjar'?

2012-10-13 Thread Jim - FooBar();
Hello everyone, I was just wondering... with leiningen we can do 'lein compile [foo.core]' and lein will aot compile only the foo.core namespace. Is there a way to do the same for the 'uberjar' option? In other words, is there a trick to achieve 'lein uberjar foo.core' so that only foo.core

Re: pmap performance degradation after 30-40 min of work?

2012-10-13 Thread Jim - FooBar();
On 13/10/12 12:50, Tassilo Horn wrote: pmap might not be as perfect for you use-case as you think. Because it is lazy and chunked, it won't keep you cores busy. Some time ago, there was a detailed thread about this on this list. But it does keep my cores fully busy (99-100%) for the first 40

where is pvmap?

2012-10-13 Thread Jim - FooBar();
I am struggling to find the namespace in which 'pvmap' lives! Can anyone help? Jim -- 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

Re: pmap performance degradation after 30-40 min of work?

2012-10-13 Thread Jim - FooBar();
On 13/10/12 12:55, Jim - FooBar(); wrote: On 13/10/12 12:50, Tassilo Horn wrote: pmap might not be as perfect for you use-case as you think. Because it is lazy and chunked, it won't keep you cores busy. Some time ago, there was a detailed thread about this on this list. But it does keep my

Re: File endings proposal for easier cross-compiling

2012-10-08 Thread Jim - FooBar();
On 08/10/12 18:33, Stuart Sierra wrote: Feature Expressions provide an escape from file extensions. http://dev.clojure.org/display/design/Feature+Expressions Everything could become a .clj file. Sources dedicated to different targets would live in different directories. -S -- You received

Re: Playing with clojure-encog, Machine-Learning wrapper

2012-10-01 Thread Jim - FooBar();
. See responses inlined. On Mon, Oct 1, 2012 at 4:24 AM, Jim - FooBar(); jimpil1...@gmail.com mailto:jimpil1...@gmail.com wrote: I've always found this page very good : http://www.doc.ic.ac.uk/~nd/surprise_96/journal/vol4/cs11/report.html http://www.doc.ic.ac.uk/%7End/surprise_96

Re: how do I evaluate this lazy sequence?

2012-09-27 Thread Jim - FooBar();
the 2 previous responses answered your question perfectly ...I'm just a bit amazed that you would go away and write clojure code to consume JSON and all that, without realising that data-structures in Clojure are immutable! I think we can all agree they are *the* cornerstone of Clojure. It is

Re: Clojure : a good start for non-programmers?

2012-09-26 Thread Jim - FooBar();
On 26/09/12 17:10, Ian wrote: If you want to start with a functional language, then I would start with Erlang or Haskell, rather than Closure. Closure is a great language, but it runs on the Java VM, and you are expected to know and understand Java data structures. I found learning both

Re: ref to array suddenly changes type

2012-09-21 Thread Jim - FooBar();
As Andy indicated, it is almost never a good idea to wrap something mutable in a reference type simply because the guarantees of references do not hold for mutable things. In other words, the thing the ref points to can be changed without going through the ref which defeats the whole purpose

mixing clojure source with java class files problem!

2012-09-18 Thread Jim - FooBar();
Hi all, I'm having a really ridiculous problem...let's say there is jar on clojars with the following structure: --- top-level (.jar) --foo (clojure namespaces) -a.clj -b.clj -c.clj -- --bar (java .class files - no package declaration when compiled) --baz -d.class

Re: mixing clojure source with java class files problem!

2012-09-18 Thread Jim - FooBar();
On 18/09/12 16:00, Aaron Cohen wrote: The package is baked into the .class file format. You can't change it after the fack by just moving files in the directory structure. regardless of whether there is an actual package declaration? So, you're saying that if I compile the java source inside

Re: mixing clojure source with java class files problem!

2012-09-18 Thread Jim - FooBar();
16:16, Jim - FooBar(); wrote: On 18/09/12 16:00, Aaron Cohen wrote: The package is baked into the .class file format. You can't change it after the fack by just moving files in the directory structure. regardless of whether there is an actual package declaration? So, you're saying that if I

Re: mixing clojure source with java class files problem!

2012-09-18 Thread Jim - FooBar();
16:51, Jim - FooBar(); wrote: It still not finding the compiled classes! I compiled them all using the exact same package declaration as the one found in the jar that I'm producing! I was also careful to convert the hyphen (directory name) to an underscore (in the .java file)... I am still

Re: mixing clojure source with java class files problem!

2012-09-18 Thread Jim - FooBar();
On 18/09/12 17:28, Aaron Cohen wrote: What did you use to compile this? I don't believe hyphens are legal in Java package names. I used regular *javac -cp blah:blah:blah encog-java/customGA/*.java* the compiler did not complain because the actual package declaration uses underscore instead

Re: mixing clojure source with java class files problem!

2012-09-18 Thread Jim - FooBar();
On 18/09/12 17:50, Aaron Cohen wrote: I actually just tried this (I don't recommend this approach though), and it worked for me, maybe you missed a step. what? seriously? You mean you downloaded the jar and managed to import some class from inside encog_java/customGA/ in some dummy project of

Re: mixing clojure source with java class files problem!

2012-09-18 Thread Jim - FooBar();
On 18/09/12 17:50, Aaron Cohen wrote: I actually just tried this (I don't recommend this approach though), and it worked for me, maybe you missed a step. what jar is lein2 using? the one with the nice name or the one with the numbers at the end? which one of the 2 did you modify? Jim ps:

Re: mixing clojure source with java class files problem!

2012-09-18 Thread Jim - FooBar();
On 18/09/12 17:54, Jim - FooBar(); wrote: On 18/09/12 17:50, Aaron Cohen wrote: I actually just tried this (I don't recommend this approach though), and it worked for me, maybe you missed a step. what jar is lein2 using? the one with the nice name or the one with the numbers at the end

instantiating a clojure record from Java

2012-09-18 Thread Jim - FooBar();
I want to instantiate a record and call a fn from java source code... I've got this in my .java file: //prepare java-clojure interop private static IFn requireFn = RT.var(clojure.core, require).fn(); static {requireFn.invoke(Symbol.intern(Clondie24.games.chess));} //the namespace

Re: instantiating a clojure record from Java

2012-09-18 Thread Jim - FooBar();
trying at the repl: (class (Player. nil 1)) =Clondie24.games.chess.Player if the fully-qualified name won't work I don't know what will! weird-stuff... Jim On 18/09/12 19:04, Jim - FooBar(); wrote: I want to instantiate a record and call a fn from java source code... I've got

idiomatic use of iterate + cycle ?

2012-09-16 Thread Jim - FooBar();
Hi all, I'm trying to come up with a way to create a 'tournament' fn that basically alternates between players (in turns) and calls soem 'move' fn on each. Now, obviously this can be done with loop/recur no problem, however perhaps a combination of cycle iterate is more appropriate...so

Re: idiomatic use of iterate + cycle ?

2012-09-16 Thread Jim - FooBar();
100 (cycle '(-1 1) ;;50 moves each should be enough Ok, it's certainly not a one-liner but it's pretty clear and readable so I'm happy :-) Jim On 16/09/12 11:59, Jim - FooBar(); wrote: Hi all, I'm trying to come up with a way to create a 'tournament' fn that basically alternates

Re: idiomatic use of iterate + cycle ?

2012-09-16 Thread Jim - FooBar();
] Jim On 16/09/12 18:15, Sean Corfield wrote: On Sun, Sep 16, 2012 at 5:15 AM, Jim - FooBar(); jimpil1...@gmail.com mailto:jimpil1...@gmail.com wrote: It turns out that reduce is exactly what I need...I didn't know this but there is a handy 'reduced' fn that makes it easy to terminate

Re: Clojure Programming is a great book

2012-09-13 Thread Jim - FooBar();
On 13/09/12 21:40, larry google groups wrote: I want to offer a big thanks to Chas Emerick, Brian Carper and Christophe Grand. I just got their book Clojure Programming from Amazon yesterday. Spent the whole night reading it. This is my favorite Clojure book so far It is certainly the most

Re: Question: Looking at Noir code - hey, are those singletons?

2012-09-12 Thread Jim - FooBar();
On 12/09/12 16:29, the80srobot wrote: What I usually do when I want to avoid passing these implicit parameters is just use thread-local bindings with ^:dynamic vars. From the point to rebind them using (bindings), every function called from within the binding block sees the same value; you can

Re: Question: Looking at Noir code - hey, are those singletons?

2012-09-12 Thread Jim - FooBar();
On 12/09/12 16:23, gaz jones wrote: I find myself having to make similar choices quite often in my own Clojure code - do I create perhaps a map of things that represent some kind of 'state' and pass that around to each function that needs it, or do I do what has been done above and create some

Re: Using function that returns unique keys in map literals causes an

2012-09-12 Thread Jim - FooBar();
There is a long discussion about how maps and sets should behave (throw on dups or not) (see ''question about sets on the mailing list)for the moment try using the constructor fn hash-map rather than the map literal...so basically do this: (hash-map (generate-id) foo

Re: [ANN] clojure-encog has a new name and repo

2012-09-08 Thread Jim - FooBar();
thought was a bug... Jim On 08/09/12 10:12, Denis Labaye wrote: On Tue, Sep 4, 2012 at 9:05 PM, Jim - FooBar(); jimpil1...@gmail.com mailto:jimpil1...@gmail.com wrote: Hi all, just wanted to let you know that I renamed 'clojure-encog' to *enclog* ...release 0.5.0 does not add

Re: [ANN] clojure-encog has a new name and repo

2012-09-08 Thread Jim - FooBar();
... Jim On 08/09/12 13:00, Jim - FooBar(); wrote: Hi Denis, you cannot bring 2 vars named 'network' in the same namespace...It is partly my fault cos since I changed 'make-network' to 'network' I should have changed the examples as well...try again but instead of 'network' define your neural

Re: [ANN] clojure-encog has a new name and repo

2012-09-08 Thread Jim - FooBar();
On 08/09/12 16:56, Denis Labaye wrote: Anyway, it works fine with the 0.5.2-SNAPSHOT (I've got network traing logs), but how do I use the network I just trained ? In your example I would like to give it a new input, and see if it learned correctly his xor lesson :) basically, you need to

Re: Where is Clojure CLR ?

2012-09-05 Thread Jim - FooBar();
Of course you can... http://clojureclr.blogspot.co.uk/ Jim On 05/09/12 16:36, Erlis Vidal wrote: Hi group, Have been a while since I don't into that project. Is the CRL version of clojure using another mailing list? How is the status of the project? I think it would be very very

Re: Fund raiser for our projects

2012-09-05 Thread Jim - FooBar();
I'll be honest with you... I 'm not sure I understand at all what you mean! raise money for people to document their open-source projects better? forgive me but I missed your point... :-) Jim On 05/09/12 17:37, Simone Mosciatti wrote: Hi everybody, I get a little idea now that we are

Re: Fund raiser for our projects

2012-09-05 Thread Jim - FooBar();
aaa ok that makes things clearer...thank you I get your point now! i can't say it doesn't make sense but i would say it's rather ambitious. :-) Jim On 05/09/12 18:15, Simone Mosciatti wrote: I would say raise money to help people improve their project (documentation is a very important part

Re: Fund raiser for our projects

2012-09-05 Thread Jim - FooBar();
On 05/09/12 19:35, Paul deGrandis wrote: Don't be scared to reach out and approach the authors of the libraries you're using. I've had much success directly contracting creators/maintainers of open source projects. me too :-) Jim -- You received this message because you are subscribed to

Re: Fund raiser for our projects

2012-09-05 Thread Jim - FooBar();
On 05/09/12 19:37, Jim - FooBar(); wrote: On 05/09/12 19:35, Paul deGrandis wrote: Don't be scared to reach out and approach the authors of the libraries you're using. I've had much success directly contracting creators/maintainers of open source projects. me too :-) Jim and by looking

Re: genuine help needed to speed up minimax algorithm!

2012-09-04 Thread Jim - FooBar();
everything is working fine...see the post from yesterday called 'when looking for performance consider cheating' for an up to date explanation of how and where i cheated to speed it up... Jim On 04/09/12 04:42, Bill Robertson wrote: Did you figure out what was going on? -- You received this

Re: Question about sets

2012-09-04 Thread Jim - FooBar();
On 04/09/12 02:06, Mark Engelberg wrote: This email is also my way of bumping the thread and bringing it again to everyone's attention. This is something I'd very much like to see resolved. +1 ... this thread should not die! Jim -- You received this message because you are subscribed to

Re: reporting function inputs as part of exceptions

2012-09-04 Thread Jim - FooBar();
you want the exception thrown to report the arguments or 'capture them' (as you say) in the actual Exception object so you can use them outside the try-catch scope? the former is very straight forward you just use your arguments...the latter is more fuss as you have to gen-class your own

Re: reporting function inputs as part of exceptions

2012-09-04 Thread Jim - FooBar();
oops gensym mistake! (defmacro capture-inputs [f args] `(try (apply ~f ~@args) (catch Exception e# (do (println oops!) {:e e# :inputs (vec ~args)} Jim On 04/09/12 12:20, Jim - FooBar(); wrote: you want the exception thrown to report the arguments or 'capture them' (as you say

Re: reporting function inputs as part of exceptions

2012-09-04 Thread Jim - FooBar();
I'm so sorry... this one works! (defmacro capture-inputs [f args] `(try (~f ~@args) (catch Exception e# (do (println oops!) {:e e# :inputs (vector ~@args)} Jim On 04/09/12 12:23, Jim - FooBar(); wrote: oops gensym mistake! (defmacro capture-inputs [f args] `(try (apply ~f ~@args

Re: Found bug in contains? used with vectors.

2012-09-04 Thread Jim - FooBar();
as contains?... Jim On 04/09/12 10:01, Marcus Lindner wrote: I think this is not a bad idea. ;) At all, a method/function name should describe what it does. And if 'contains?' only looks for keys, then 'contains-key?' would be a better descriptor for it. Am 03.09.2012 13:29, schrieb Jim - FooBar

Re: reporting function inputs as part of exceptions

2012-09-04 Thread Jim - FooBar();
:inputs (vector ~@args)} (defn-capt foo [a b] (/ a b)) (foo 1 0) = {:inputs [1 0], :exception #ArithmeticException java.lang.ArithmeticException: Divide by zero, :origin #user$foo user$foo@4dbf98eb} Jim On 04/09/12 12:31, Jim - FooBar

Re: Question about sets

2012-09-04 Thread Jim - FooBar();
the issue here is that behaviour should be *consistent* across all forms of ctor functions, so programmers don't have to remember which one allows what or don't thus limiting code breaks...the literal syntax is just too elegant to give up! I don't think anyone is against consistency... Jim

[ANN] clojure-encog has a new name and repo

2012-09-04 Thread Jim - FooBar();
Hi all, just wanted to let you know that I renamed 'clojure-encog' to *enclog* ...release 0.5.0 does not add anything but several 'library coding standards' that i was previously not aware of, have been addressed... I created a brand new repo here : https://github.com/jimpil/enclog and a

Re: Question about sets

2012-09-04 Thread Jim - FooBar();
On 04/09/12 21:02, Andy Fingerhut wrote: But what if they all consistently throw exceptions when encountering duplicates, including (set [5 5])? That doesn't sound like what you want. of course not...this also goes against set/map semantics from a mathematics point of view...the

Re: Question about sets

2012-09-04 Thread Jim - FooBar();
On 05/09/12 00:53, Jim - FooBar(); wrote: of course not...this also goes against set/map semantics from a mathematics point of view...the mathematical guarantees of set ('there will be no duplicates') are imposed by the set itself and not by the person/program/whatever using it! the same

Re: Found bug in contains? used with vectors.

2012-09-03 Thread Jim - FooBar();
this is probably the single most confusing name in clojure! :-) why can't we make it contains-key? ? Jim On 03/09/12 12:14, Goldritter wrote: Ah ok. So I need to transform a vector and/or a list into a set first. Thanks. Am Montag, 3. September 2012 13:05:52 UTC+2 schrieb Ambrose

when looking for performance, consider 'cheating' !

2012-09-03 Thread Jim - FooBar();
Hi all, this is basically a continuation of my previous thread Functional performance vs imperative complexity...for those of you who are still interested here is what I learnt during the process. I should note that i finally got the performance I was after without sacrificing any

Re: anonymous functions with names

2012-08-31 Thread Jim - FooBar();
defn will create a global var while fn won't...it is only visible in the scope it was originally defined...remember you can always do: (def f (fn [x] ...)) which is he same as defn Jim On 31/08/12 16:52, Erlis Vidal wrote: Hi guys, I've been reading but I'm still confused about the

Re: having trouble setting the cursor with seesaw

2012-08-27 Thread Jim - FooBar();
/?fromgroups#!forum/seesaw-clj On Sun, Aug 26, 2012 at 7:17 AM, Jim - FooBar(); jimpil1...@gmail.com wrote: another question...why won't this do anything? (seesaw/config! canvas :cursor :wait) ;;canvas is a result of (seesaw/canvas ... ... ...) I also tried (seesaw/config! (seesaw/to-root canvas

Re: 'functional' performance VS 'imperative' complexity

2012-08-26 Thread Jim - FooBar();
On 26/08/12 11:03, Joshua Ballanco wrote: I would love to have some time to look into the details of your specific problem more, but in the absence of time, might I suggest two quick points: Well, feel free to have a look at the project on github when you find some time (

Re: 'functional' performance VS 'imperative' complexity

2012-08-26 Thread Jim - FooBar();
On 26/08/12 09:51, Patryk Bukowinski wrote: Hi Jim, Reading your story I've got an impression that you make 'functional' and 'immutable' a synonym, not default. Implementation should be more transparent. In APL funcvect programming languages fammily there are tools which amends values in

having trouble setting the cursor with seesaw

2012-08-26 Thread Jim - FooBar();
another question...why won't this do anything? (seesaw/config! canvas :cursor :wait) ;;canvas is a result of (seesaw/canvas ... ... ...) I also tried (seesaw/config! (seesaw/to-root canvas) :cursor :wait) but the proxied JFrame does not support the :cursor option! what am I missing?

Re: 'functional' performance VS 'imperative' complexity

2012-08-26 Thread Jim - FooBar();
Thanks for the snippet Nicolas but that is not the problem! I do know how to implement the 'undo' functionality...In OOP this is called the Command design pattern...The command interface has execute(from, to) and undo(from,to) (which calls execute with reversed arguments)...That part is not

'functional' performance VS 'imperative' complexity

2012-08-25 Thread Jim - FooBar();
Hello everyone, in this post I'm not asking for something specific, but rather I'd like to spark a discussion regarding the issue of performance within the functional paradigm...most of the things i will mention will probably not be news for most of you...Hopefully, however the issues I plan

calling record ctor from within the record definition fails?

2012-08-24 Thread Jim - FooBar();
Hi all, It seems that trying to instantiate a new record via its own methods fails!!! example: (defrecord Foo [a b c] Bar (update-position [this np] (Foo. a np c))) No matching ctor found ! There must be a way to do this without going round and round in functions... Jim -- You received

Re: calling record ctor from within the record definition fails?

2012-08-24 Thread Jim - FooBar();
On 24/08/12 11:32, Jim - FooBar(); wrote: Hi all, It seems that trying to instantiate a new record via its own methods fails!!! example: (defrecord Foo [a b c] Bar (update-position [this np] (Foo. a np c))) No matching ctor found ! There must be a way to do this without going round

Re: calling record ctor from within the record definition fails?

2012-08-24 Thread Jim - FooBar();
user= (defrecord Foo [a b c] #_= Bar #_= (update-position [this np] (Foo. a np c))) user.Foo user= (update-position (Foo. 1 2 3) 1) #user.Foo{:a 1, :b 1, :c 3} user= Thanks, Ambrose On Fri, Aug 24, 2012 at 6:32 PM, Jim - FooBar(); jimpil1...@gmail.com mailto:jimpil1

Re: real-world usage of reducers?

2012-08-24 Thread Jim - FooBar();
I finally managed to reach level 3 in 12-13 sec (as opposed to 83)...at the moment, for level 3 there are only 4 sec separating the 2 real fns from the dummy ones that return immediately! This is very good news indeed... as for level 4, it still takes long (just over 9 min) but at least, not

Re: profiler help...

2012-08-24 Thread Jim - FooBar();
On 24/08/12 16:41, nicolas.o...@gmail.com wrote: (and creates vectors via (into [] (r/map ))) Depending of your method of scoring, you could try to do it just with a reducer. (Without creating a vector with it). but i am doing it with a reducer (the mapping) , however after that i

Re: profiler help...

2012-08-24 Thread Jim - FooBar();
On 24/08/12 18:24, nicolas.o...@gmail.com wrote: (defn score-by-count ^long [b dir] (let [ hm (into [] (core/gather-team b dir)) aw (into [] (core/gather-team b (unchecked-negate dir)))] (unchecked-subtract (count hm) (count aw (defn counting-accumulator

Re: real-world usage of reducers?

2012-08-23 Thread Jim - FooBar();
On 23/08/12 09:35, nicolas.o...@gmail.com wrote: If it is so slow, that's maybe because the branching factor is very high. Could you have an atom incremented in your evaluation function, or in next level, to check how many boards are generated for level 2 or 3? (At least this could give an

Re: real-world usage of reducers?

2012-08-23 Thread Jim - FooBar();
). But both these fns should only be called n times (where n is the depth)...this is weird stuff indeed... Jim On 23/08/12 12:43, Jim - FooBar(); wrote: On 23/08/12 09:35, nicolas.o...@gmail.com wrote: If it is so slow, that's maybe because the branching factor is very high. Could you have

Re: real-world usage of reducers?

2012-08-23 Thread Jim - FooBar();
On 23/08/12 20:23, Jim - FooBar(); wrote: But both these fns should only be called n times (where n is the depth). now this is completely wrong!!! next-level should be called on every single node!!! 8421 times for level 2... Jim -- You received this message because you are subscribed

Re: dumping maps out to XML

2012-08-23 Thread Jim - FooBar();
make sure to bind *read-eval* to false when reading arbitrary code from files... (defn read-back Read the file f back on memory. Careful not to eval anything dangerous (#=). [f] (binding [*read-eval* false] (read-string (slurp f Jim On 23/08/12 21:32, larry google groups wrote: (def m

Re: real-world usage of reducers?

2012-08-22 Thread Jim - FooBar();
Hi again Nicolas, 1) My moves at the top are a result of r/map...I did try to pou it all in a vector with 'nto []' but nothing changes. 2)well, no there is no way to have 512 moves at any point in in the game!!! The game actually starts with 20 branches (2 moves for each pawn and 2 for

Re: real-world usage of reducers?

2012-08-22 Thread Jim - FooBar();
the sequential equivalent)... Jim On 22/08/12 13:33, Jim - FooBar(); wrote: Hi again Nicolas, 1) My moves at the top are a result of r/map...I did try to pou it all in a vector with 'nto []' but nothing changes. 2)well, no there is no way to have 512 moves at any point in in the game!!! The game

Re: real-world usage of reducers?

2012-08-22 Thread Jim - FooBar();
On 22/08/12 14:08, nicolas.o...@gmail.com wrote: You should see a close to *4 speed up, at least in the level 4. One thing that could happen is if some of your functions are using an atom or a reference and the threads keeps bumping into each other and retrying. Are you sure that both next-level

Re: real-world usage of reducers?

2012-08-22 Thread Jim - FooBar();
(my ubuntu becomes less responsive as well)! Jim ps: Could it be that the sequential version really is a lot worse than what I'm approximating? On 22/08/12 14:20, Jim - FooBar(); wrote: On 22/08/12 14:08, nicolas.o...@gmail.com wrote: You should see a close to *4 speed up, at least

Re: real-world usage of reducers?

2012-08-22 Thread Jim - FooBar();
On 22/08/12 15:16, nicolas.o...@gmail.com wrote: You should replace your functions that computes the board by function that does return 30 times the same board. And evaluation function by something that returns a constant value. And check : speed and speed-up for folding. Then you will know for

real-world usage of reducers?

2012-08-21 Thread Jim - FooBar();
Dear all, Can anyone redirect me to some 'real code' using reducers? I say 'real-code' cos I don't consider (r/fold + [1 2 3 4 5]) to be a realistic example of usage...also, apart from Rich's blogs, I'm having a hard time finding resources explaining the role of the combining/reducing fns.

Re: What is the meaning of :while in a for ?

2012-08-21 Thread Jim - FooBar();
On 21/08/12 11:28, nicolas.o...@gmail.com wrote: Dear all, What is the meaning of :while in a for? I understand :when, and also that :while jumps more element when the condition is not met, but where does it jump to exactly? Best regards, Nicolas. You may find this helpful...

Re: real-world usage of reducers?

2012-08-21 Thread Jim - FooBar();
= ... result.cuddleWith(s); } return result a reducer would have been a functional alternative to this Am 21.08.2012 13:04, schrieb Jim - FooBar();: Dear all, Can anyone redirect me to some 'real code' using reducers? I say 'real-code' cos I don't consider (r/fold + [1 2 3 4 5]) to be a realistic

Re: real-world usage of reducers?

2012-08-21 Thread Jim - FooBar();
as a tree (like vectors), then the partitioning can be carried out in a particularly efficient manner. Cheers, MichaƂ On 21 August 2012 13:04, Jim - FooBar(); jimpil1...@gmail.com wrote: Dear all, Can anyone redirect me to some 'real code' using reducers? I say 'real-code' cos I don't consider (r/fold

ForkJoinTask not found under Java 7?

2012-08-21 Thread Jim - FooBar();
Hi everyone, I get this very strange error even though I'm using clojure 1.5 alpha3 and java version 1.7.0_02 on Java HotSpot(TM) 64-Bit Server VM ! ClassNotFoundException jsr166y.ForkJoinTask java.net.URLClassLoader$1.run (URLClassLoader.java:366) java.net.URLClassLoader$1.run

Re: ForkJoinTask not found under Java 7?

2012-08-21 Thread Jim - FooBar();
Has clojure 1.5 apha3 been aot-compiled against java 6? Jim On 21/08/12 19:40, Jim - FooBar(); wrote: Hi everyone, I get this very strange error even though I'm using clojure 1.5 alpha3 and java version 1.7.0_02 on Java HotSpot(TM) 64-Bit Server VM ! ClassNotFoundException

lein2 is not aware of newly installed jars in ~/.m2/repositories/

2012-08-21 Thread Jim - FooBar();
I built clojure 1.5 snapshot from source and installed it in ~/.m2/repositories/org/clojure/ via 'mvn install' but now lein2 reverts to 1.3 after amending my project.clj!!! How can I make leiningen aware of the newly installed snaphot version? Jim On 21/08/12 19:49, Jim - FooBar(); wrote

Re: lein2 is not aware of newly installed jars in ~/.m2/repositories/

2012-08-21 Thread Jim - FooBar();
, Nelson Morris wrote: Whats the project.clj look like? On Tue, Aug 21, 2012 at 2:25 PM, Jim - FooBar(); jimpil1...@gmail.com wrote: I built clojure 1.5 snapshot from source and installed it in ~/.m2/repositories/org/clojure/ via 'mvn install' but now lein2 reverts to 1.3 after amending my

Re: lein2 is not aware of newly installed jars in ~/.m2/repositories/

2012-08-21 Thread Jim - FooBar();
the dependency resolution ignores that artifact. Instead it uses the closest version to the project root that is in range, in this case 1.3.0 asked for by core.logic. To fix this use [seesaw 1.4.2 :exclusions [org.clojure/clojure]]]). On Tue, Aug 21, 2012 at 2:31 PM, Jim - FooBar(); jimpil1...@gmail.com

Re: ForkJoinTask not found under Java 7?

2012-08-21 Thread Jim - FooBar();
hmmm... I see. anyway I sorted my problem my building the latest clojure snpashot from source on my machine with Java 7 and then installing it ~/.m2/repositories/... Jim On 21/08/12 21:41, Sung Pae wrote: Jim - FooBar(); jimpil1...@gmail.com writes: I thought I did not need

Re: real-world usage of reducers?

2012-08-21 Thread Jim - FooBar();
Hi Josh, I had a quick look at your code... If you say that running with reducers cuts runtime to 1/4 the original, I'll believe you...However, even though our code is very similar, I don't get any benefit from reducers...Like you, I've got recursion inside a 'letfn' that uses (r/reduce

Re: help needed to use reducers and monoid

2012-08-20 Thread Jim - FooBar();
On 20/08/12 10:12, nicolas.o...@gmail.com wrote: (defn generate [board next-boards] ;; next-boards return a seq of MoveAndBoard (BoardAndChildren. board (r/map (fn [m] (MoveAndTree. (:move m)

Re: help needed to use reducers and monoid

2012-08-20 Thread Jim - FooBar();
On 20/08/12 12:34, Jim - FooBar(); wrote: On 20/08/12 10:12, nicolas.o...@gmail.com wrote: (defn generate [board next-boards] ;; next-boards return a seq of MoveAndBoard (BoardAndChildren. board (r/map (fn [m] (MoveAndTree

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 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 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)

Re: genuine help needed to speed up minimax algorithm!

2012-08-18 Thread Jim - FooBar();
On 18/08/12 13:13, Michael Gardner wrote: If you haven't already, start by eliminating reflection warnings[1]. As for pmap, it's unfortunately useless. You could roll your own using e.g. Java's thread pools, or you could wait for the new reducers library[2]. Reducers should offer not only

Re: genuine help needed to speed up minimax algorithm!

2012-08-18 Thread Jim - FooBar();
On 18/08/12 13:57, Michael Gardner wrote: Until the reducers library is ready, you could try something like this (no guarantees that this is an optimal implementation!): (defn with-thread-pool* [num-threads f] (let [pool (java.util.concurrent.Executors/newFixedThreadPool num-threads)]

Re: genuine help needed to speed up minimax algorithm!

2012-08-18 Thread Jim - FooBar();
algorithm completely wrong? this is scary stuff... the bad news is that i always get the same answer regardless of the depth...also something suspicious is the fact the no matter the depth the r/map returns in constant time! something smells here! Jim On 18/08/12 19:24, Jim - FooBar

help needed to use reducers and monoid

2012-08-18 Thread Jim - FooBar();
Hi all, so I was playing with the reducers library today and I think I've identified the critical spot where my code can be parallelized. after all i am building a tree and i am using a map that nests. According to all the posts this is ideal situation for reducing...anyway, assuming I'm

<    1   2   3   4   5   6   7   >