3 ms·
There are an infinite number of circumstances where one would want 'first'. In Lisp terms[1], 'first' is 'car', which, in conjunction with 'cdr'. With that com
by 286c8cb04bda 14y ago
There are an infinite number of circumstances where one would want 'first'.
In Lisp terms[1], 'first' is 'car', which, in conjunction with 'cdr'. With that combination recursive logic is regularly implemented.
[1] Some Lisps already include this alias.
- dllthomas 14y agoIn most cases the "a[0]" approach works, however. The set of circumstances where you want "first" as a proper function is limited to those cases where you need to pass it into some higher order function (which is still infinite, granted, but it's not 'every time we'd want "car"').