Skip to content

Instantly share code, notes, and snippets.

@robinkraft
Created November 27, 2012 18:09
Show Gist options
  • Select an option

  • Save robinkraft/4155956 to your computer and use it in GitHub Desktop.

Select an option

Save robinkraft/4155956 to your computer and use it in GitHub Desktop.
generic defbufferop proof of concept for fossa partitioning
(use 'cascalog.api)
(def a (vec (map vector (repeat 20 1) (vec (range 20 0 -1)) (vec (range 50 30 -1)))))
;; [[1 20 50] [1 19 49] [1 18 48] [1 17 47] [1 16 46] [1 15 45] [1 14 44] [1 13 43] [1 12 42] [1 11 41] [1 10 40] [1 9 39] [1 8 38] [1 7 37] [1 6 36] [1 5 35] [1 4 34] [1 3 33] [1 2 32] [1 1 31]]
(defn tester-func
[v]
(apply str (map (partial apply str) v)))
(defbufferop tester
[tuples]
(map vector (map tester-func (partition 10 10 tuples)) (range (/ (count tuples) 10))))
(let [src a]
(??<- [?id ?partition ?output]
(src ?id ?b ?c)
(tester ?id ?b ?c :> ?output ?partition)))
;; produces:
([1 0 "12050119491184811747116461154511444113431124211141"]
[1 1 "11040193918381737163615351434133312321131"])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment