(define adjectives '(adjective nice tall diligent small white)) (define (parse-simple-noun-phrase) (define (parse-adjective-noun) (amb (parse-word nouns) (list 'adjective-noun (parse-word adjectives) (parse-adjective-noun)))) (list 'simple-noun-phrase (parse-word articles) (parse-adjective-noun))) ;;; Amb-Eval input: (parse '(the tall professor lectures)) ;;; Starting a new problem ;;; Amb-Eval value: (sentence (simple-noun-phrase (article the) (adjective-noun (adjective tall) (noun professor))) (verb lectures)) ;;; Amb-Eval input: try-again ;;; There are no more values of (parse (quote (the tall professor lectures))) ;;; Amb-Eval input: (parse '(the nice tall professor lectures)) ;;; Starting a new problem ;;; Amb-Eval value: (sentence (simple-noun-phrase (article the) (adjective-noun (adjective nice) (adjective-noun (adjective tall) (noun professor)))) (verb lectures)) ;;; Amb-Eval input: try-again ;;; There are no more values of (parse (quote (the nice tall professor lectures))) ;;; Amb-Eval input: (parse '(the nice tall professor lectures to the diligent student in the small class with the white cat)) ; It works. Output omitted
Advertisement