6.10

Assignment 13b

home work!

Programming Language ISL

Due Date: Friday at 9:00pm (Week 13)

Purpose To practice designing generative and/or accumulator-based functions.

Remember to explicitly write down your generative ideas, termination conditions, and/or accumulator statements as appropriate.

Finger Exercises

Graded Exercises

Exercise 2 Design a function make-paragraph. It takes in a list of strings, each of which is a word with no spaces in it, and a positive integer representing the line width. It splits the list of words into a list of lists of words, representing a single line of text in a paragraph, such that each line of text is no longer than the given line width. For this problem, you can ignore the spaces between words, and you should fit as many words as you can on a line. For example,

(make-paragraph (list "hello" "is" "a" "greeting" "in" "English") 8) ==>
   (list (list "hello" "is" "a")
         (list "greeting")
         (list "in")
         (list "English"))
(make-paragraph (list "hello" "is" "a" "greeting" "in" "English") 9) ==>
   (list (list "hello" "is" "a")
         (list "greeting")
         (list "in" "English"))

There is a behavior left unspecified in the problem description above. Determine what it is, decided how to handle it, and document your choice.

Exercise 3 Exercise 528 in HtDP. Note: This problem asks you to draw a picture of just the final curve -- you do not need to draw the "scaffolding lines" that you use to derive the final curve. In other words, just draw the very first image you see in the problem (without even labelling the points).