Contents    Page-10    Prev    Next    Page+10    Index   

Is some thing in the empty list a number?

(some number? '())

  • A: Yes: Got to be good-looking 'cause it's so hard to see.
  • B: No: There is nothing in the empty list that could be a number.
  • C: Maybe: Depends on the implementation.
  • D: Error: () is an improper argument to some.
  • E: WTF: I thought this was CS, not Philosophy.

    Answer: B

    some is an or over a set of items: some(p, lst) = p(lst1) || p(lst2) || ... || p(lst n) = p(lst1) ∨ p(lst2) ∨ ... ∨ p(l stn) .

    The base case (identity or idempotent value) for or is false, since (x || false) = x, so some should return false as its base case when the list is empty.