(define test
  (let ((counter 0))
  (define (f x) (set! counter (+ counter 1)) (+ x 2))
  (lambda (m)
    (cond ((eq? m 'f) f)
          ((eq? m 'counter) counter)))))