To make it easier to specify a goal, we define the function i s as a function

Question:

To make it easier to specify a goal, we define the function i s as a function that returns a predicate that tests for a particular value. Note that i s does not do the test itself.

Rather, it returns a function that can be called to perform tests:

(defun i s (value) #'(lambda (x) (eql x value)))

Nowwe can turnon the debuggingoutput and search through the binary tree, starting at 1, and looking for, say, 12, as the goal state. Each line of debugging output shows the list of states that have been generated as successors but not yet examined:

> (debug :search) + (SEARCH)

> (depth- f i r s t -search 1 ( i s 12) #'binary-tree)

;; Search: (1)

;; Search: (2 3)

;; Search: (4 5 3)

;; Search: (8 9 5 3)

;; Search: (16 17 9 5 3)

;; Search: (32 33 17 9 5 3)

;; Search: (64 65 33 17 9 5 3)

;; Search: (128 129 65 33 17 9 5 3)

;; Search: (256 257 129 65 33 17 9 5 3)

;; Search: (512 513 257 129 65 33 17 9 5 3)

;; Search: (1024 1025 513 257 129 65 33 17 9 5 3)

;; Search: (2048 2049 1025 513 257 129 65 33 17 9 5 3)

CAbortl

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Question Posted: