I would like to know if there's a way to access the contents of the function
READ before it is completely evaluated. So, if the input is not in the form
of a lisp expression, it may be considered a special case.
For example:
(cond ((equal (read) "exit") (return ())
(t eval(read))
* This is not exactly what my task calls for, but I think it illustrates the
concern.... Help?
Viqar Abbasi
In article <··········@ariel.cs.yorku.ca> ········@ariel.cs.yorku.ca (VIQAR ABBASI) writes:
>For example:
>
> (cond ((equal (read) "exit") (return ())
> (t eval(read))
You could put the result of the (read) in a variable, and test it before
evaluating it:
(let ((input (read)))
(if (eq input 'exit) (return '())
(eval input)))
If the special sequence isn't valid Lisp syntax, you could use READ-LINE
and then READ-FROM-STRING. For instance, if you wanted to use a line
consisting of a single "." as the exit trigger:
(let ((input (read-line)))
(if (equal input ".") (return '())
(eval (read-from-string input))))
--
Barry Margolin
BBN Internet Services Corp.
······@near.net