#lang scheme (require "views.ss" "test-a.ss") (define-struct posn (x y)) (printf "~a~n" (match (make-posn 3 4) [(view posn? ([posn-y y] [posn-x x])) (+ x y)])) (define term->sexp (match-lambda [(var-view v) v] [(lam-view v b) `(lambda ,v ,(term->sexp b))] [(app-view op arg) (list (term->sexp op) (term->sexp arg))])) (printf "~a~n" (term->sexp (make-lam 'x (make-app (make-var 'x) (make-var 'x)))))