Problem Set 7
Language: Intermediate Student with lambda
Due: 11:59 PM Friday, March 22
1 Accumulators
Write the function
; to10: list-of-number -> number
from HTDP/1e exercise 31.3.7 using a helper function that takes an accumulator. The empty list of digits corresponds to the number 0.
You do not need to write the to10-general function mentioned in the exercise.
2 Graphs
Write the following two functions.
; a graph is |
; (make-graph (listof symbol) (symbol -> (listof symbol))) |
(define-struct graph (nodes neighbor)) |
; has-self-loop? : graph -> boolean |
; Determines whether any node in the given graph is its own neighbor |
; has-cycle? : graph -> boolean |
; Determines whether the given graph has a cycle. |