From 3f742d7585961177b69965acfaff11f3ebc89a9e Mon Sep 17 00:00:00 2001 From: Ramakrishnan Muthukrishnan <vu3rdd@gmail.com> Date: Thu, 6 Jan 2011 21:08:25 +0530 Subject: [PATCH] solution to 3.6 --- src/sicp/ex3_6.rkt | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 src/sicp/ex3_6.rkt diff --git a/src/sicp/ex3_6.rkt b/src/sicp/ex3_6.rkt new file mode 100644 index 0000000..fcfa106 --- /dev/null +++ b/src/sicp/ex3_6.rkt @@ -0,0 +1,16 @@ +#lang racket + +(define rand + (let ((x random-init)) + (define (dispatch type) + (cond + ((eq? type 'generate) + (begin + (set! x (rand-update x)) + x)) + ((eq? type 'reset) + (lambda (new-val) + (set! x new-val))))) + dispatch)) + + -- 2.45.2