There's currently a sequence function called "first", I propose to add in a new sequence function called "last".
The code foo[foo.length - 1] is quite common. Being able to use @last(foo) instead would be much nicer. Using @at(foo, -1) also works, but your intention is much clearer by using "last".
The "last" function could simply be a short alias for at(foo, -1)
function last(sequence) {
return at(sequence, -1);
}
If you wanted to, you could add in an optimization for arrays, so it would be equivalent to foo[foo.length - 1], but I don't think that's necessary if the "at" function is fast enough.
I would also recommend updating the documentation to replace uses of foo[foo.length - 1] with last(foo), but that is lower priority and doesn't need to be done right away.