Do exercise 3.2 of the textbook.
Check the 6.001 discussion forum for tutorial-ex-01
|
Look here
for information about the forum.
| |
The following variation of make-df-strategy-1 has a bug that causes it to not work, even on the test-data. Explain what is wrong. In particular, why does it matter where *to-be-visited* is declared?
(define (make-df-strategy-2 starting-point goal? neighbors)
(define (where-next? here)
(let ((*to-be-visited* '())) ; Nodes to look at
(set! *to-be-visited* ; Add on new nodes
(append (neighbors here) *to-be-visited*))
(cond ((goal? here) #T) ; We win!
((null? *to-be-visited*) #F) ; Nowhere left to look
(else ; Visit next node
(let ((next (car *to-be-visited*)))
(set! *to-be-visited* (cdr *to-be-visited*))
next))))
where-next?)))
Check the 6.001 discussion forum for tutorial-ex-02
|
Look here
for information about the forum.
| |
The following partial definition mimics the graph of web pages at the 6.001 web site. Each node here is the URL of a web page and the neighbor nodes are the URLs referenced in the links on the page.
(define web
(list
(make-graph-entry
'http://mit.edu/6.001
'(http://mit.edu/6.001
http://mit.edu/6.001/SchemeImplementations
http://mit.edu/6.001/PSets)
'(... words extracted from http://mit.edu/6.001 ...))
(make-graph-entry
'http://mit.edu/6.001/SchemeImplementations
(http://mit.edu/6.001/getting-help
http://mit.edu/6.001/lab-use
*the-goal*)
'(... words extracted from http://mit.edu/6.001/SchemeImplementations ...))
(make-graph-entry
'http://mit.edu/6.001/getting-help
'(http://mit.edu/6.001
http://mit.edu/6.001/SchemeImplementations)
'(... words extracted from http://mit.edu/6.001/getting-help))
...))
Demonstrate that
make-df-strategy-1 fails on this graph. What is the essential
difference between the test-data and web examples that
causes make-df-strategy-1 to fail here?
Check the 6.001 discussion forum for tutorial-ex-03
|
Look here
for information about the forum.
| |