about summary refs log tree commit diff stats
path: root/js/games/nluqo.github.io/~bh/61a-pages/Lectures/3.2/prev5.scm
diff options
context:
space:
mode:
Diffstat (limited to 'js/games/nluqo.github.io/~bh/61a-pages/Lectures/3.2/prev5.scm')
-rw-r--r--js/games/nluqo.github.io/~bh/61a-pages/Lectures/3.2/prev5.scm19
1 files changed, 19 insertions, 0 deletions
diff --git a/js/games/nluqo.github.io/~bh/61a-pages/Lectures/3.2/prev5.scm b/js/games/nluqo.github.io/~bh/61a-pages/Lectures/3.2/prev5.scm
new file mode 100644
index 0000000..b2a6c27
--- /dev/null
+++ b/js/games/nluqo.github.io/~bh/61a-pages/Lectures/3.2/prev5.scm
@@ -0,0 +1,19 @@
+(define make-previous
+  (let ((glob 'first-time))
+    (lambda ()
+      (let ((old 'first-time))
+	(lambda (msg)
+	  (cond ((eq? msg 'local)
+		 (lambda (arg)
+		   (let ((result old))
+		     (set! old arg)
+		     result)))
+		((eq? msg 'global)
+		 (lambda (arg)
+		   (let ((result glob))
+		     (set! glob arg)
+		     result)))
+		(else (error "No such method" msg)) ))))))
+
+
+