3 ms·
But then you are throwing all the readability gains of list.last vs. list[-1] right out the window and we are back to square one. I don't think anyone finds Li
by mnemonik 17y ago
But then you are throwing all the readability gains of list.last vs. list[-1] right out the window and we are back to square one.
I don't think anyone finds Lisp's car and cdr (much less cadr and friends) particularly intuitive when they are first introduced to whichever dialect it happens to be.
You get used to it, and when needed, write specific-case functions for readability that are simple wrappers to those combo functions. Which I think is probably best no matter whether you have last or [-1], this argument is kind of pointless. Step back and think about why you need that item, write a small wrapper function to grab that it and name the wrapper well so it provides a little semantic context to whoever ends up reading the code later.
- llimllib 17y ago> But then you are throwing all the readability gains of list.last vs. list[-1] right out the window and we are back to square one. ermmm, I apparently forgot to add the <sarcasm> tag.