What is
(set-difference '(c r e a m) '(s u g a r))

  • A: (C E M S U G A R)
  • B: (M E C)
  • C: (S U G)
  • D: (A R)
  • E: (C E M S U G)

    Answer: B

    set-difference returns the elements that are present in the first set, but not in the second set, in any order.

    set-difference often confuses students: it is not symmetric (commutative); unique elements of the second set do not appear in the output.

    Contents    Page-10    Prev    Next    Page+10    Index