Returning nil is consistent across seq functions and play well with when, if-let, when-let, just to name a few... On Jul 2, 2012 12:12 AM, "Sean Corfield" <seancorfi...@gmail.com> wrote:
> On Sun, Jul 1, 2012 at 12:47 PM, Warren Lynn <wrn.l...@gmail.com> wrote: > > 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. > > That would be horribly inconsistent with the rest of Clojure, IMO: > > user> (first []) > nil > user> (first [nil]) > nil > user> (second []) > nil > user> (second [nil]) > nil > user> (second [nil nil]) > nil > user> (next []) > nil > user> ({:a 1 :b 2} :c) > nil > user> (map inc nil) > () > user> (map inc []) > nil > user> (seq nil) > nil > user> (seq []) > nil > ;; etc etc etc > > Warren, this and some of your other issues with how Clojure works > makes me curious about your language background. May I ask what > languages you're most used to? That may help us frame future > discussions about differences in opinion about features in Clojure. > -- > Sean A Corfield -- (904) 302-SEAN > An Architect's View -- http://corfield.org/ > World Singles, LLC. -- http://worldsingles.com/ > > "Perfection is the enemy of the good." > -- Gustave Flaubert, French realist novelist (1821-1880) > > -- > 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 -- 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