(require 'cl)

(lexical-let ((x 0))
(defun foo ()
(setq x (+ x 1))))