Skip to content

Commit

Permalink
adding a form to make it easier to do bulk binds
Browse files Browse the repository at this point in the history
  • Loading branch information
Danny Yoo committed Dec 13, 2011
1 parent e19c26f commit a75c3d6
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions web-world/main.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
(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 ...)))]))

0 comments on commit a75c3d6

Please sign in to comment.