From 352ba64d8a56b0bf4c1041c632ca1987788fd5db Mon Sep 17 00:00:00 2001 From: David Thompson Date: Mon, 2 Dec 2013 20:30:47 -0500 Subject: Use signal-fold in example. --- examples/rewrite-test.scm | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/examples/rewrite-test.scm b/examples/rewrite-test.scm index 3582174..760afb0 100644 --- a/examples/rewrite-test.scm +++ b/examples/rewrite-test.scm @@ -12,15 +12,14 @@ (with-window (make-window #:title "FRP is cool" #:resolution (vector2 640 480) #:fullscreen? #f) + (define speed 4) + ;; Move when arrow keys are pressed. (define move - (make-signal - #:init (vector2 320 240) - #:transformer (lambda (value old from) - (v+ (vscale (signal-ref key-arrows) 4) old)) - #:filter (lambda (value old from) - (not (eq? from key-arrows))) - #:connectors (list key-arrows (time-every)))) + (signal-fold (lambda (direction position) + (v+ (vscale direction speed) position)) + (vector2 320 240) + (time-every key-arrows))) (define ghost-texture (load-texture "images/ghost.png")) -- cgit v1.2.3