updating p09 impl with List.span