What's the difference between write, print, pprint, princ, and prin1?

岁酱吖の 提交于 2019-11-29 02:48:46

问题


I'm getting into some Lisp, and I've come across various different functions that to me appear to be doing the same thing... Namely printing to console... So what exactly is the difference between all those different functions?


回答1:


This is answered here: http://www.lispworks.com/documentation/HyperSpec/Body/f_wr_pr.htm

  • write is the general entry point to the Lisp printer.
  • prin1 produces output suitable for input to read.
  • princ is just like prin1 except that the output has no escape characters. princ is intended to look good to people, while output from prin1 is intended to be acceptable for the function read.
  • print is just like prin1 except that the printed representation of object is preceded by a newline and followed by a space.
  • pprint produces pretty output.


来源:https://stackoverflow.com/questions/19756296/whats-the-difference-between-write-print-pprint-princ-and-prin1

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!