Guest User

Untitled

a guest
Jul 21st, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. (defmapcatop set-bucket
  2. ([s v inv]
  3. (if (contains? s v) (list inv) '()))
  4. ([s v inv outv]
  5. (if (contains? s v) (list inv) (list outv)))
  6. ([s v inv outv bothv]
  7. (list bothv (if (contains? s v) (list inv) (list outv)))))
  8.  
  9. (def x (memory-source-tap [["a" 1]
  10. ["b" 1]
  11. ["c" 1]
  12. ["a" 2]
  13. ["b" 2]
  14. ["c" 2]]))
  15.  
  16. (?<- (stdout) [?l ?n ?b] (x ?l ?n)
  17. (set-bucket #{"a" "b"} ?l "a-or-b" "not-a-or-b" "a-or-b-or-not-a-or-b" :> ?b))
  18.  
  19. ;; RESULTS
  20. ;; -----------------------
  21. ;; a 1 a-or-b
  22. ;; a 2 a-or-b
  23. ;; b 1 a-or-b
  24. ;; b 2 a-or-b
  25. ;; a 1 a-or-b-or-not-a-or-b
  26. ;; a 2 a-or-b-or-not-a-or-b
  27. ;; b 1 a-or-b-or-not-a-or-b
  28. ;; b 2 a-or-b-or-not-a-or-b
  29. ;; c 1 a-or-b-or-not-a-or-b
  30. ;; c 2 a-or-b-or-not-a-or-b
  31. ;; c 1 not-a-or-b
  32. ;; c 2 not-a-or-b
  33. ;; -----------------------
  34.  
  35. (?<- (stdout) [?l ?n ?b] (x ?l ?n)
  36. (set-bucket #{"a" "b"} ?l "a-or-b" "not-a-or-b" :> ?b))
  37.  
  38. ;; RESULTS
  39. ;; -----------------------
  40. ;; a 1 a-or-b
  41. ;; a 2 a-or-b
  42. ;; b 1 a-or-b
  43. ;; b 2 a-or-b
  44. ;; c 1 not-a-or-b
  45. ;; c 2 not-a-or-b
  46. ;; -----------------------
Add Comment
Please, Sign In to add comment