fleshing out higher-order functions for singly-linked lists