(defun correct (a b)
  (if (= a b) nil a))
  
(defun make-unbiased-coin (biased-coin)
  (lambda ()
    (loop for a = (funcall biased-coin) then (funcall biased-coin)
          and b = (funcall biased-coin) then (funcall biased-coin)
          while (null (correct a b))
          finally (return (correct a b)))))

(let* ((bc (lambda () (if (< 7 (random 10)) 0 1)))
       (uc (make-unbiased-coin bc)))
  (pprint (loop repeat 10 collecting
            (loop repeat 1000 summing (funcall uc)))))