After review, several seq functions from clojure-contrib have been promoted to clojure [1], [2], [3]. Hopefully the FAQ below will answer the major questions you may have:

1. Is this a breaking change to Clojure?
No. Rich is super-careful to grow Clojure by expansion, not by breaking change.

2. Is this a breaking change to Contrib?
Yes. Contrib is a community-contribution area. Part of its mission is to germinate ideas that may get promoted to Clojure, and when that happens contrib users will have to adapt. Usually this will simply mean removing a require/use, or changing a fn name.

3. Why did some of the fn names change?
Because they were bad names. :-) Clojure is careful to encourage the use of fns that will have good performance characteristics, and make it obvious which fns are "seq-y" (therefore O(n)). rand-elt became rand-nth to make it clear that its performance is bound to the performance of nth on the underlying collection. Similarly, includes? became seq-contains? to make clear that the fn must walk the sequence. Avoid seq-contains? when you have a set or map!

4. Why did some semantics change?
Because they were not the most generally-desirable semantics. The contrib group-by returned a sorted map, when in most cases sorting is overkill, so the new core fn returns a plain ol' map.

5. Couldn't you have left the old fns in place in contrib, to avoid breakage? No, for multiple reasons. Name collisions are one. But the bigger one is that the fns in core have been audited by Rich for performance and correctness. Leaving the old fns in contrib would be a recipe for lower-performing (or even, in rare cases, buggy) programs.

6. Why did this break my project?
Hopefully it doesn't. But, it seems that a lot of people are tracking their apps (via leiningen or maven) to build snapshots of both Clojure and Contrib. This is a risky development practice, particularly in the case of Contrib. As a community, we need to develop a saner way to stay near the edge without being right on it.

7. How do I fix it?
Your code gets smaller. Remove requires or uses that refer to promoted fns. You already have them in core! For the fns whose names have changed, update the names in your code.

Comments and questions welcome!

Stu

[1] 
https://www.assembla.com/spaces/clojure/tickets/312-audit---promote-some-clojure-contrib-seq-fns
[2] 
http://github.com/richhickey/clojure/tree/a55df92faa0c51c634d93a8d991ccfd2638b108b
[3] 
http://github.com/richhickey/clojure-contrib/commit/78ee9b3e64c5ac6082fb223fc79292175e8e4f0c

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