previous | index | next

Exercise 7.37 – Overview

This exercise changes the pattern language so that the wild card "_" is replaced by type designators number? or symbol?. These designators correspond to the Scheme predicates of the same names. This exercise modifies the following pattern/action pairs:
        (make-pattern/action ; modified for ex. 7.37
	 '(what (movie movies) (was were) made in number?)
	 made-in-year-action)

	(make-pattern/action ; modified for ex. 7.37
	 '(what (movie movies) (was were) made (in before after since) number?)
	 movies-before-after-action)

        (make-pattern/action ; modified for ex. 7.37  
	 '(what (movie movies) (was were) made between number? and number?)
	 movies-between-action)

        (make-pattern/action ; modified for ex. 7.37  
         '(what (movie movies) (did does) ... appear in between number? and number?)
	 appear-in-between-action)

        (make-pattern/action ; modified for ex. 7.37  
         '(what (movie movies) (did does) ... direct between number? and number?)
         direct-between-action)
and adds the new pair:
	(make-pattern/action  ; new for exercise 7.37
	 '(what (movie movies) (has have) symbol? in the title)
	 word-in-title-action)
After completion of this exercise you will be able to make these queries:
   (what movie was made in 1952)
   ((an american in paris) (othello))
  
   (what movie was made in barcelona)
   (i do not understand) [note that program does not crash]

   (what movie has gun in the title)
   ((johnny got his gun))

   (what movies have a in the title)
   ((a star is born) (a fish called wanda))
You will need to modify matches? and substitutions-in-to-match to recognize the new patterns, and you will need to write the action procedure word-in-title-action.

previous | index | next