List.v adapted from standard library