I am reading Chapter 2 Creating your first lisp program in the Land of Lisp 
book and attempting to use the code in Racket.  The syntax is slightly 
different and the smaller function is defined in Land of Lisp as:

(defun smaller ()
  (setf *big* (1- (guess-my-number)))

where *big* is a global variable.

In Racket I defined the other vars/functions like this:
(define *small* 1)
(define *big* 100)
(define (guess-my-number) 
  (arithmetic-shift (+ *small* *big*) -1))


My attempts at defining smaller in Rachet (which didn't work):

(define (smaller)
  (define *big* (- (guess-my-number) 1)))

(define (smaller)
  (set *big* (- (guess-my-number) 1)))

How can I translate this function into Rachet syntax?

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to