Hi Andreas,

You are right, the helpful Clojure community is a real asset to be proud of!

I like your solution using* loop ... recur* as it makes the intention of the 
code a bit more clear.

The pattern 
 (lazy-seq
    (when-let [s (seq coll)]
      ...
is used in the implementation of* take-while <goog_1884565766>* in Clojure 
Core <http://clojuredocs.org/clojure_core/clojure.core/take-while>. *loop 
... recur* cannot be used because the function call is not the tail 
position.

By the way, my code for *drop-by2* in my last post was not correct. So here 
is the corrected version:

(defn drop-by2 [f coll]
  (lazy-seq
    (when-let [s (seq coll)]
      (let [x (first s)
            y (second s)]
        (if (and x y (= (f x) (f y)))
          (drop-by2 f (rest s))
          (rest s))))))

Best regards,

Stefan





-- 
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