4 ms·
I'll take head/tail over first/rest, but first/rest is not too bad.
by mercurial 13y ago
I'll take head/tail over first/rest, but first/rest is not too bad.
- csmuk 13y agoI thought that for a bit until I realised tail is a bit ambiguous as it's used in the Unix space to mean the "last n" items and in some data structures as the last item pointer.
- mrottenkolber 13y agoIronically in CL LAST does what UNIX tail does.
- csmuk 13y agoYeah which is where SBCL and me got into to a bad argument :)
- mrottenkolber 13y agoYou probably were looking for LAST1 (e.g. (first (last ...))). But why SBCL? LAST should behave the same on all implementations.
- csmuk 13y agoThat's just the variety of CL that I used.
- lgarron 13y agoI'm a fan first/rest because of Mathematica. It has four functions that all end in "st", which means I can always recall the one I need: First, Rest, Most, Last (Results on Range[4], respectively: 1, {2, 3, 4}, {1, 2, 3}, 4.)
- draegtun 13y agoRebol comes with first & last but not the others. >> a: [1 2 3 4] == [1 2 3 4] >> first a == 1 >> last a == 4 This is how you could add rest & most: >> rest: func [s] [next s] >> most: func [s] [copy/part s back tail s] >> rest a == [2 3 4] >> most a == [1 2 3] Rebol unifies all this under what it calls a series - http://www.rebol.com/docs/core23/rebolcore-6.html http://www.rebol.com/docs/core23/rebolcore-6.html
- lcedp 13y agoIn Clojure it's almost the same: first, rest, butlast, last