cs61a_sp08_mt1-04 - from word and ends with the to word The...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
Question 6 (8 points): Write a procedure range that takes three arguments, a sentence sent and two words from and to . It looks for a range of words within sent that start with from and end with to : > (range (being for the benefit of mister kite) for of) (for the benefit of) If the from and to words occur more than once, just return the first range found: > (range (party of the first part sells party of the second part this car) party part) (party of the first part) The return value is a sentence that starts with the
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: from word and ends with the to word. The from and to words may appear any number of times in the sentence, but you should just use the first occurrence of the from word, and the first occurrence of the to word that comes after the from word. You may not assume that the to word will appear after the from word does: > (range ’ (come to my party) ’ party ’ part) ( ) Hint: It’s okay for you to examine each word in the sentence more than once. Write helper procedures....
View Full Document

This note was uploaded on 08/26/2009 for the course CS 61A taught by Professor Harvey during the Spring '08 term at Berkeley.

Ask a homework question - tutors are online