Is some thing in the empty list (null) a 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: null is an improper argument to every.
  • 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(lstn) = p(lst1) ∨ p(lst2) ∨ ... ∨ p(lstn) .

    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.

    Contents    Page-10    Prev    Next    Page+10    Index