2016-06-25 2 views

답변

7

system 절차는 stdout을 매개 변수 current-output-port의 값으로 설정합니다. 즉, current-output-port에 쓰여진 모든 것을 문자열로 수집하여 반환 할 수 있습니다. 구성 with-output-to-string은 아무 것도 인쇄하지 않는 포트에 current-output-port을 설정하지만 포트에 쓰여지는 문자열은 결국 문자열로 반환합니다.

> (with-output-to-string (lambda() (system "date"))) 
"Sat Jun 25 12:20:12 CEST 2016\n" 
관련 문제