Determining if a sequence is a function