Permalink
Browse files

Update some more methods

  • Loading branch information...
1 parent 4ed27de commit 4476cd33a0d527da89faf8eba57bdd1e1ded2aa9 Darrick Wiebe committed Aug 27, 2012
Showing with 8 additions and 7 deletions.
  1. +8 −7 src/pacer.clj
View
15 src/pacer.clj
@@ -1,27 +1,28 @@
(ns pacer
(:use [clojure.pprint :only [pprint]]
- pacer.step))
+ pacer.step
+ ))
(defn simple-encoder [] { :encode nil :decode nil })
(defn show
"Show an easy to read"
[route]
(->> route
- (map describe-step)
+ (map str)
(clojure.string/join " -> ")))
(defn- pipe-from-step [in step]
(cond
- (:pipe step) (doto ((:pipe step) in)
- (.setStarts (:pipe in (:source in))))
- (:iterator step) ((:iterator step) (:pipe in (:source in)))
+ (satisfies? pacer.step/BuildPipe step) (doto (build-pipe step in)
+ (.setStarts (:pipe in (:source in))))
+ (satisfies? pacer.step/BuildIterator step) (iterator step (:pipe in (:source in)))
:else (throw (Exception. "Don't know how to build step"))))
(defn build-pipeline [[source & route]]
(if route
(reduce (fn [in step]
- (check-step in step)
+ (check step in)
{ :pipe (pipe-from-step in step)
:type (:type step (:type in))
:route (conj (:route in) step)})
@@ -45,7 +46,7 @@
(comment
(route g v (loop (out-e :x) in-v :max 5 :while ??))
- (route g v (loop { max: 5 } (out-e :x) in-v))
+ (route g v (loop { :max 5 } (out-e :x) in-v))
(route g v (loop
(fn [v path loop emit] (loop) (emit path))
; fn could use CPS. would that cause stack overflow?

0 comments on commit 4476cd3

Please sign in to comment.