From b8c368aeb400aa7d2ae4992dc03caf1690682d29 Mon Sep 17 00:00:00 2001 From: Vivianne Langdon Date: Sat, 12 Oct 2024 13:30:27 -0400 Subject: [PATCH] Remove define-cell and define~ --- modules/reactive.scm | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/modules/reactive.scm b/modules/reactive.scm index 74ce715..97f24da 100644 --- a/modules/reactive.scm +++ b/modules/reactive.scm @@ -7,11 +7,9 @@ #:export (make-cell cell? ! - define-cell make-deriv deriv? ~ - define~ if~ make-cell-list cell-list? @@ -127,9 +125,6 @@ ((($ cell effect proc)) (! cell)))) -(define-syntax-rule (define-cell name value) - (define name (make-cell value))) - (define-record-type (_make-deriv cell effect proc) deriv? @@ -140,7 +135,7 @@ (set-record-type-printer! (lambda (d op) (format op "#" (deriv-proc d)))) (define (make-deriv proc) - (define-cell cell #f) + (define cell (make-cell #f)) (define deriv (_make-deriv cell effect proc)) @@ -161,9 +156,6 @@ (define-syntax-rule (~ body ...) (make-deriv (lambda () body ...))) -(define-syntax-rule (define~ name body ...) - (define name (~ body ...))) - (define-syntax-rule (if~ test consequent alternate) (let ((test-proc (lambda () test)) (consequent-proc (lambda () consequent)) @@ -388,9 +380,9 @@ ;; (test-begin "scene") ;; -;; (define-cell a 4) -;; (define-cell b 5) -;; (define~ c (+ (! a) (! b))) +;; (define a (make-cell 4)) +;; (define b (make-cell 5)) +;; (define c (~ (+ (! a) (! b)))) ;; ;; (format #t "c computed as 9\n") ;; @@ -454,9 +446,9 @@ ;; (ul ;; ,(~map (lambda (x) `(li ,x)) items)))) ;; -;; (define~ renderer (let ((value (render body))) +;; (define renderer (~ (let ((value (render body))) ;; (format #t "\n~a\n\n" value) -;; value)) +;; value))) ;; ;; (! b 26) ;;