1.1.2 Differences between LOOP and DO

1.1.2.2 Example 2

;;; These loops read from one stream and write to another. 
;;; Typical code that uses the DO macro requires duplication  
;;; that is not necessary in the Loop Facility code.
(loop for char = (read-char instream nil)    ; Use Loop Facility 
      while char                             ; constructs.
      do (write-char char outstream))
(do ((char (read-char instream nil)          ; Use the DO macro.
           (read-char instream nil)))
    ((null char) nil)
  (write-char char outstream))


The Loop Facility - 9 SEP 1996

Generated with Harlequin WebMaker