diff --git a/web-world/main.rkt b/web-world/main.rkt index f74db08..2e38ce6 100644 --- a/web-world/main.rkt +++ b/web-world/main.rkt @@ -2,8 +2,28 @@ (require "impl.rkt" "helpers.rkt" - "event.rkt") + "event.rkt" + (for-syntax racket/base)) (provide (all-from-out "impl.rkt") (all-from-out "helpers.rkt") - (all-from-out "event.rkt")) \ No newline at end of file + (all-from-out "event.rkt")) + +(provide view-bind*) + + +;; A syntactic form to make it more convenient to focus and bind multiple things +;; (view-bind* a-view +;; [id type function] +;; [id type function] ...) +(define-syntax (view-bind* stx) + (syntax-case stx () + [(_ a-view [a-selector a-type a-function] ...) + (foldl (lambda (a-selector a-type a-function a-view-stx) + #'(view-bind (view-focus #,a-view-stx #,a-selector) + #,a-type + #,a-function)) + #'a-view + (syntax->list #'(a-selector ...)) + (syntax->list #'(a-type ...)) + (syntax->list #'(a-function ...)))])) \ No newline at end of file