Right now

(last []) => nil
(last [nil]) => nil

So there is no way to differentiate these two (except with some
emptiness checking). In my opinion (last []) should throw an
exception, because that's when last does not apply. From another point
of view, there are two cases:

1. The local semantics requires the collection not to be empty.
Throwing an exception here will remove the burden of manual checking.

2. The local semantics allows the collection to be empty, in that case
the caller needs to do
(when-not (empty? c) (last c)).

case 1 is the "normal case" with higher probability, so the burden of
checking should be on the second case.

Your opinion?

Note this is rather academic because it probably is too late do
anything about it at this stage. But it may help future cases.

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