4.2.2 Annotated examples

4.2.2.3 Program with unusual syntax

Assume that you had a natural language preprocessor for a program that took an unusual syntax. You then could write the following code:

(defun run-strange-interactive-program-smartly (args)
  (with-open-stream (strange (run-program 
                              "strange-interactive-program"
                              :input :stream
                              :output :stream
                              :error-output :output
                              :wait nil
                              :arguments
                              (strangify-arguments args)))
                    (loop
                     (write-string 
                      (strangify-command
                       (read-english-command *standard-input*))
                      strange)
                     (write-line
                      (smarten-up-response 
                        (read-strange-response strange))
                      *standard-output*))))

This program has the following effects:


The Advanced User's Guide - 9 SEP 1996

Generated with Harlequin WebMaker