2010/5/18 Theam Yong Chew senatorzergling@gmail.com:
On 5/19/10, Mathieu Lemoine mathieu.lemoine@gmail.com wrote:
Hi everyone.
I made a little addition to the library. The lastcons function... It is very simple and I found myself thinking "that's something that ought to be in alexandria"...
Not knowing the exact procedure to commit to the repo (and "git push" give me a "fatal: The remote end hung up unexpectedly" which is to be expected, I guess...), I send you the patch.
Mathieu Lemoine.
This replicates a lot of code from DEF in alexandria's list.lisp.
I'm looking at this, as at today:
http://common-lisp.net/project/alexandria/darcs/alexandria/lists.lisp
Why not bundle your function into that def macrolet form?
I never realised that lastcar was safe. Should there be a safe- prefix? That was we can also rename lastcons to safe-last, the safe counterpart of cl:last.
Yong.
I didn't included it into the def from because I need the little if at the beginning (if (endp (cdr list)) list ...) [which is supposed to be safe-endp, actually] which is not part of the def macro... If there is a simple way to include it I agree it would be better, but it looks like it would add garbage to the macro...
Mathieu.