Is there a way to write this in clojure without java's hashmaps or clojure's atom/ref/var-binding/etc? The program doesn't have to be an exact translation. I just want similar functionality.
---------------------------------------------------------------------------------------------- >From chapter 6 of On Lisp - Figure 6.5 (defvar *nodes* (make-hash-table)) (defun defnode (name conts &optional yes no) (setf (gethash name *nodes*) (if yes #’(lambda () (format t "~A~%>> " conts) (case (read) (yes (funcall (gethash yes *nodes*))) (t (funcall (gethash no *nodes*))))) #’(lambda () conts)))) (defnode ’people "Is the person a man?" ’male ’female) (defnode ’male "Is he living?" ’liveman ’deadman) (defnode ’deadman "Was he American?" ’us ’them) (defnode ’us "Is he on a coin?" ’coin ’cidence) (defnode ’coin "Is the coin a penny?" ’penny ’coins) (defnode ’penny ’lincoln) (funcall (gethash ’people *nodes*)) ----------------------------------------------------------------------------------------- -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en To unsubscribe, reply using "remove me" as the subject.