在 Newlisp 中将标准输入读取为字符串

Read stdin to string in Newlisp

在Newlisp中如何将标准输入的全部内容读入一个字符串? (即当前读取位置之后的全部剩余内容——此操作通常称为"slurp file")

你可以使用这个:

(define (read-all)
  (let (r "" ch "")
      (while (setf ch (read-char))
        (setf r (append r (char ch))))
    r))

另请参阅:http://www.newlisp.org/downloads/newlisp_manual.html#read-char