Frames and Bindings
Exercise 4.71

Explicit delay in the simple-query and disjoin procedures

Louis Reasoner wonders why the simple-query and disjoin procedures (section are implemented using explicit delay operations, rather than being defined as follows:

(define (simple-query query-pattern frame-stream)
   (lambda (frame)
     (stream-append (find-assertions query-pattern frame)
                    (apply-rules query-pattern frame)))

(define (disjoin disjuncts frame-stream)
  (if (empty-disjunction? disjuncts)
       (qeval (first-disjunct disjuncts) frame-stream)
       (disjoin (rest-disjuncts disjuncts) frame-stream))))

Can you give examples of queries where these simpler definitions would lead to undesirable behavior?

Nobody's finished this exercise yet. You'll be the first!

There are no comments yet.

Authentication required

You must log in to post a comment.