Implements `firsts` and `seconds` functions for lists.