Macro: WHICHEVER

Documentation

Evaluates one (and only one) of its args, which one is chosen at random

Source

(defmacro whichever (&rest possibilities)
  "Evaluates one (and only one) of its args, which one is chosen at random"
  `(ecase (random ,(length possibilities))
     ,@(loop for poss in possibilities
             for x from 0
             collect (list x poss))))
Source Context