6.6

Assignment 8

home work!

Programming Language ISL+Lambda

Due Date Friday 6/7 at 10:00pm

Purpose: Practice working with mutually recursive data.

Finger Exercises Complete exercises 1-11 from Lab 8 Lambda and JSON.

Graded Exercises:

Exercise 1 Consider the following data definitions:

; A Road is one of:
; - 'dead-end
; - (make-straightaway String PositiveNumber Road)
; - Intersection
 
(define-struct straightaway [name distance more])
; INTERPRETATION: A road with some name and some amount of distance
; until the next portion of road
 
; An Intersection is a [List-of Road]

Design the function total-road-length which takes a Road and produces the total length of it and all its connected roads. Use list abstractions where appropriate.

Exercise 2 Design the function road-names which takes a Road and produces a list of all the names of roads connected to the given Road (including the name of the given Road itself if it has one). Use list abstractions where appropriate. You may assume that all road names are unique.

Exercise 3 Exercises 12, 13 and 14 in Lab 8 Lambda and JSON