You're right. I still think to much in Common Lisp where butlast is quite handy, but basically resembles drop-last from clojure. I agree that the non-lazy semantics is probably not wanted in most cases. To stress this aspect a better name might be all-butlast or something like that. Feel free to not use butlast any more ...
On Nov 24, 11:04 am, Daniel Janus <[email protected]> wrote: > On Wednesday, November 23, 2011 10:42:13 PM UTC, Nils Bertschinger wrote: > > It solves a > > common problem, namely to drop the last element of a sequence and > > reads better in this case than the equivalent idiom using drop-last. > > I don't quite get it. How does (butlast x) read better than (drop-last x)? PS: To me it reads slightly better (maybe more used to it), but the difference is minor and highly subjective. It sure reads better than (doall (drop-last x)) if that's what you want, but the name does not describe the laziness semantics (see above) > > (Granted, these two calls have slightly different semantics, the difference > being laziness. However, the non-lazy version should not normally be > required, or else we should have non-lazy versions of map, filter etc.) -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to [email protected] Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/clojure?hl=en
