Advertisement
Guest User

Untitled

a guest
Feb 12th, 2016
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ;turn input into output by removing all vectors that have nope as last item and
  2. ;if there are no vector that has ds1 as last item in a map, remove the map as
  3. ;well.
  4.  
  5. (def input
  6.   [{:simple1 [:from [:simple1 'ds1]]}
  7.    {:simple2 [:from-any [[:simple2 'nope] [:simple2 'ds1]]]}
  8.    {:walk1 [:from [:sub1 :sub2 'ds1]]}
  9.    {:unaffected [:from [:unaffected 'nope]]}
  10.    {:replaced-with-nil [:from [:the-original 'ds1]]}
  11.    {:concat1 [:concat [[:simple1 'ds1] [:simple2 'ds1]]]}
  12.    {:submap1 [:submap {:foo {:bar1 [:concat [:simple1 'ds1] [:simpl2 'ds1]]
  13.                              :bar2 [:from [:unaffected 'nope]]}}]}
  14.    {:lookup-word [:lookup [:word 'word :word 'ds1]]}])
  15.  
  16.  
  17. (def output
  18.   [{:simple1 [:from [:simple1 'ds1]]}
  19.    {:simple2 [:from-any [[:simple2 'ds1]]]}
  20.    {:walk1 [:from [:sub1 :sub2 'ds1]]}
  21.    {:replaced-with-nil [:from [:the-original 'ds1]]}
  22.    {:concat1 [:concat [[:simple1 'ds1] [:simple2 'ds1]]]}
  23.    {:submap1 [:submap {:foo {:bar1 [:concat [:simple1 'ds1] [:simpl2 'ds1]]}}]}
  24.    {:lookup-word [:lookup [:word 'word :word 'ds1]]}])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement