Skip to content

Instantly share code, notes, and snippets.

@johnwalker
Last active January 2, 2016 03:19
Show Gist options
  • Save johnwalker/8243534 to your computer and use it in GitHub Desktop.
Save johnwalker/8243534 to your computer and use it in GitHub Desktop.
(ns nested-vector-ops)
(def nested-vector [[:salt 0 5 :deviation 5 10]
[:milk 5 4 :deviation 1 2]
[:cream 0 0 :deviation 0 0]])
(->>
nested-vector
(remove (fn [[_ _ _ _ a]] (= "N/A" a)))
(sort-by (fn [[_ _ _ _ a]] a))
(reverse))
@johnwalker
Copy link
Author

Oh. Well, just change zero? to a predicate that tests for N/A, e.g. (= "N/A", and then move the argument in the sort-by function to the fifth position.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment