Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (defmapcatop set-bucket
- ([s v inv]
- (if (contains? s v) (list inv) '()))
- ([s v inv outv]
- (if (contains? s v) (list inv) (list outv)))
- ([s v inv outv bothv]
- (list bothv (if (contains? s v) (list inv) (list outv)))))
- (def x (memory-source-tap [["a" 1]
- ["b" 1]
- ["c" 1]
- ["a" 2]
- ["b" 2]
- ["c" 2]]))
- (?<- (stdout) [?l ?n ?b] (x ?l ?n)
- (set-bucket #{"a" "b"} ?l "a-or-b" "not-a-or-b" "a-or-b-or-not-a-or-b" :> ?b))
- ;; RESULTS
- ;; -----------------------
- ;; a 1 a-or-b
- ;; a 2 a-or-b
- ;; b 1 a-or-b
- ;; b 2 a-or-b
- ;; a 1 a-or-b-or-not-a-or-b
- ;; a 2 a-or-b-or-not-a-or-b
- ;; b 1 a-or-b-or-not-a-or-b
- ;; b 2 a-or-b-or-not-a-or-b
- ;; c 1 a-or-b-or-not-a-or-b
- ;; c 2 a-or-b-or-not-a-or-b
- ;; c 1 not-a-or-b
- ;; c 2 not-a-or-b
- ;; -----------------------
- (?<- (stdout) [?l ?n ?b] (x ?l ?n)
- (set-bucket #{"a" "b"} ?l "a-or-b" "not-a-or-b" :> ?b))
- ;; RESULTS
- ;; -----------------------
- ;; a 1 a-or-b
- ;; a 2 a-or-b
- ;; b 1 a-or-b
- ;; b 2 a-or-b
- ;; c 1 not-a-or-b
- ;; c 2 not-a-or-b
- ;; -----------------------
Add Comment
Please, Sign In to add comment