#lang racket
(require [only-in plait test test/exn error print-only-errors])
(define (mk-o-state count)
(lambda (m)
(case m
[(inc) (lambda () (set! count (+ count 1)))]
[(dec) (lambda () (set! count (- count 1)))]
[(get) (lambda () count)])))
(define-syntax snd
(syntax-rules ()
[(_ obj selector args ...)
((obj (quote selector)) args ...)]))
(test (let ([o (mk-o-state 5)])
(begin (snd o inc) (snd o inc) (snd o dec)
(snd o get)))
6)