Using a vector instead of a list as the accumulator makes it possible
to skip the mapping of reverse used in the earlier version of pw:

(defn pw [f? x]
  (let [phi (fn [a e]
              (if (f? e)
                (cons [e] a )
                (cons (conj (first a) e)
                      (rest a))))]
    (reverse
     (reduce phi []  x))))

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to