Unfortunately this couldn't be tail-recursive because we are constructing a list from the front.