Permalink
Browse files

.

  • Loading branch information...
1 parent 7a7fe2e commit 3ed928c75123cf2fab4a78d0dc36e4136d6f5a18 @richard-lyman committed Dec 28, 2011
Showing with 15 additions and 5 deletions.
  1. +13 −4 src/com/lithinos/amotoen/core.clj
  2. +2 −1 test/com/lithinos/amotoen/test/core.clj
View
17 src/com/lithinos/amotoen/core.clj
@@ -67,10 +67,19 @@
; This needs to be some form of pmap
(defn- either [n g w]
- (let [original (gp w)] ; E.V.I.L.
- (first (keep #(do (sp w original) ; E.V.I.L.
- (pegasus % g w))
- (rest n)))))
+ #_(let [original (gp w)] (first (keep #(do (sp w original)
+ (pegasus % g w))
+ (rest n))))
+ ; This is supposed to be faster... I think... the 'backtracking' is done in parallel... but I wonder if pmap is lazy... so each item is still in serial...
+ (let [[result resultw] (first (remove #(nil? (first %))
+ (pmap #(let [cw (clone w)] [(pegasus % g cw) cw])
+ (rest n))))]
+ (if (nil? result)
+ nil
+ (do
+ (sp w (gp resultw))
+ result)))
+)
(defn- type-list [n g w]
(let [t (first n)
View
3 test/com/lithinos/amotoen/test/core.clj
@@ -38,4 +38,5 @@ a")))
a")))))
-(self-check)
+(println "Single run") (time (self-check))
+;(println "20 runs") (time (doall (take 20 (repeatedly #(self-check)))))

0 comments on commit 3ed928c

Please sign in to comment.