I have a sequence s and a list of indexes into this sequence indexes. How do I retain only the items given via the indexes?
s
indexes
Simple example:
=> (defn filter-by-index [src indexes] (reduce (fn [a i] (conj a (nth src i))) [] indexes)) => (filter-by-index '(a b c d e f g) '(0 2 3 4)) [a c d e]