
4.2.2 Annotated examples
(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:read-english-command parses a natural language command.strangify-command turns the parsed English command into a command that is suitable for the strange program.read-strange-response parses the output from the strange program.smarten-up-response turns output from the strange program into a readable format.

Generated with Harlequin WebMaker