Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;turn input into output by removing all vectors that have nope as last item and
- ;if there are no vector that has ds1 as last item in a map, remove the map as
- ;well.
- (def input
- [{:simple1 [:from [:simple1 'ds1]]}
- {:simple2 [:from-any [[:simple2 'nope] [:simple2 'ds1]]]}
- {:walk1 [:from [:sub1 :sub2 'ds1]]}
- {:unaffected [:from [:unaffected 'nope]]}
- {:replaced-with-nil [:from [:the-original 'ds1]]}
- {:concat1 [:concat [[:simple1 'ds1] [:simple2 'ds1]]]}
- {:submap1 [:submap {:foo {:bar1 [:concat [:simple1 'ds1] [:simpl2 'ds1]]
- :bar2 [:from [:unaffected 'nope]]}}]}
- {:lookup-word [:lookup [:word 'word :word 'ds1]]}])
- (def output
- [{:simple1 [:from [:simple1 'ds1]]}
- {:simple2 [:from-any [[:simple2 'ds1]]]}
- {:walk1 [:from [:sub1 :sub2 'ds1]]}
- {:replaced-with-nil [:from [:the-original 'ds1]]}
- {:concat1 [:concat [[:simple1 'ds1] [:simple2 'ds1]]]}
- {:submap1 [:submap {:foo {:bar1 [:concat [:simple1 'ds1] [:simpl2 'ds1]]}}]}
- {:lookup-word [:lookup [:word 'word :word 'ds1]]}])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement