(seq coll) is the test, if the collection is empty seq returns nil, hence nothing gets done in the (let ...) form.
Luc > After posting, I had the idea of checking out the source for partition- > by, and solved the problem: > > (defn partition-when > "Applies f to each value in coll, splitting it each time f returns > the specified value. Returns a lazy seq of partitions." > [f value coll] > (lazy-seq > (when-let [s (seq coll)] > (let [run (cons (first s) (take-while #(not= value (f %)) (next > s)))] > (cons run (partition-when f value (seq (drop (count run) s)))) > ) > ) > ) > ) > > So, I can see basically how this function works, but am not sure what > the when-let gives you. Could someone explain? The documentation makes > no sense to me at the moment: > > " > (when-let bindings & body) > > bindings => binding-form test > > When test is true, evaluates body with binding-form bound to the value > of test > " > > What test? > > Thanks, > > Anthony. > > -- > 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 > -- Softaddicts<lprefonta...@softaddicts.ca> sent by ibisMail from my ipad! -- 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