Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The default behavior of last is literally returning the last cons. So:

  (last '(1 2 3)) ;; => (3)
The signature for last is:

  last list &optional n => tail
If n is not provided, it defaults to 1 so the behavior and order of parameters is sensible in this context.

http://www.lispworks.com/documentation/HyperSpec/Body/f_last...

It's also worth noting that along with nth which takes the index first, there's elt which takes a sequence as the first parameter and index as the second. aref is similar but restricted to arrays and permits multiple numbers for the subscripts since arrays can be multidimensional. char, which accesses characters in a string, takes the string first and index second as well. bit takes the bit array as the first parameter and the subscripts follow it.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: