home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / magazine / drdobbs / 1988 / 04 / amsterda / amsterda.exm next >
Text File  |  1979-12-31  |  896b  |  28 lines

  1.  
  2.  
  3.  
  4.  
  5. «PT1»«AL1»«LM5»(defun check-reqs (reqs bindings)
  6.   (if (null reqs) ;; all requirements passed--success
  7.    T
  8.    ;; else, check the first
  9.    (let* ((req (car reqs))
  10.        (binding-stream (deduce-pattern (requirement-pattern req)
  11.                        bindings))
  12.        (result))
  13.     ;; if it failed, return its failure string
  14.     (cond
  15.      ((empty-stream? binding-stream)
  16.      (requirement-failure-string req))
  17.      ;; else, try all the bindings on the other reqs until success.
  18.      ;; dostream just iterates over the elements of the stream.
  19.      (t
  20.      (dostream (binds binding-stream)
  21.       (setq result (check-reqs (cdr reqs) binds))
  22.       (if (eq result t)
  23.         ;; the remaining requirements passed--success
  24.         (return-from check-reqs t)))
  25.      ;; No other bindings worked; return the last failure string
  26.      result)))))
  27.  
  28.