Re: Why cannot "last" be fast on vector?
2012-07-01 00:05:06 GMT
On Sat, Jun 30, 2012 at 10:24 AM, Warren Lynn <wrn.lynn <at> gmail.com> wrote:
I think some people agree with me something is broken here (puzzler, for example. Please correct me is I am wrong as I don't want to hijack other people's opinion).
One really nice thing about the Clojure community is that from the very beginning, Rich instilled a value that we should generally avoid talking in terms of a "sky is falling" mentality, and avoid using terms like "broken". Generally speaking, the community has been trained to avoid engaging with people who make such exaggerated claims. This has a couple of beneficial effects: first, it helps keep criticisms grounded and constructive, second, it tends to limit the destructive potential of people who are just trolling. As a result of this community ethic, you'll find that if you keep calling Clojure broken, people will just tune you out.
So no, I don't agree that last is "broken". I claimed that last *could* be made polymorphic, and that if, it were up to me, I *would* make it polymorphic because I think there's little downside and it's generally better to make functions behave in an intuitive way; I believe that the name last implies fast access for data structures which offer fast access to the last element.
However, I, like most of the others here, don't regard this as a big deal. The first time I read through the docs, I noted that last wasn't a particularly useful function because of its linear time bound. So I just don't use it. If I need fast access to the last element, I use a vector, and I use the peek function. It's not the way I would design things, but it's not a big deal, either. There are a number of aspects of Clojure I feel that way about, and it doesn't stop me from wanting to use it.
Now I *do* find this discussion interesting, particularly because of things that David has said about protocols and ClojureScript, and the limitations that this may place on design. Ever since protocols were introduced, I have been very intrigued to see how they would play out in practice. I would like to discuss this issue further, but I will start a new thread to do so...
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure <at> 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+unsubscribe <at> googlegroups.com
For more options, visit this group at