recursively calculate max of a list