Index: junk/cube.scm ================================================================== --- junk/cube.scm +++ junk/cube.scm @@ -16,23 +16,24 @@ (5 . ,white ) ;; white (6 . ,orange ) ;; orange (7 . ,black ) ;; black )) -(define (get c) +;; retrive color +(define (rc c) (alist-ref c colors)) (defstruct cspec (x 0) (y 0) (z 0) - (n (get 1)) ;; north - (s (get 1)) ;; south - (e (get 1)) ;; east - (w (get 1)) ;; west - (t (get 1)) ;; top - (b (get 1))) ;; bottom + (n (rc 1)) ;; north + (s (rc 1)) ;; south + (e (rc 1)) ;; east + (w (rc 1)) ;; west + (t (rc 1)) ;; top + (b (rc 1))) ;; bottom (define a 0) (define (spin id) (set! a (modulo (+ a 1) 360))) @@ -91,12 +92,12 @@ (for-each (lambda (dat) ;; (let ((c1 (make-cspec e: red w: blue n: green s: yellow t: white b: orange))) (match dat ((x y z n s e w t b) - (let ((c1 (make-cspec x: x y: y z: z n: (get n) s: (get s) e: (get e) w: (get w) t: (get t) b: (get b)))) + (let ((c1 (make-cspec x: x y: y z: z n: (rc n) s: (rc s) e: (rc e) w: (rc w) t: (rc t) b: (rc b)))) (pp (cspec->alist c1)) (add-object (make-cuber c1) select: (lambda _ (print "oink!"))))) (else (print "bad object " dat)))) data) (gl:Flush) (start-viewer)