Walking Around in Our World

Now that we can see things in our world, let’s write some code so that we can walk around. The walk function (not in the functional style) takes a direction and lets us walk there:

(defun walk (direction)
  (let ((next (find direction
                    (cdr (assoc *location* *edges*))
                    :key #'cadr)))
    (if next
   (progn (setf *location* (car next)) ...

Get Land of Lisp now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.