You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
sicp-all-tasks/sicp/4_002e47

17 lines
530 B

Exercise 4.47: Louis Reasoner suggests that,
since a verb phrase is either a verb or a verb phrase followed by a
prepositional phrase, it would be much more straightforward to define the
procedure parse-verb-phrase as follows (and similarly for noun phrases):
(define (parse-verb-phrase)
(amb (parse-word verbs)
(list
'verb-phrase
(parse-verb-phrase)
(parse-prepositional-phrase))))
Does this work? Does the program’s behavior change if we interchange the order
of expressions in the amb?