write,print,pprint,princ和prin1有什么区别? [英] What's the difference between write, print, pprint, princ, and prin1?

查看:467
本文介绍了write,print,pprint,princ和prin1有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Lisp,并且遇到了各种不同的功能,这些功能对我来说似乎是在做同样的事情...即打印到控制台...那么所有这些不同之间的区别到底是什么?功能?

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?

推荐答案

在这里得到答案:

  • write是Lisp打印机的常规入口点.
  • prin1生成适合于read输入的输出.
  • princprin1相似,除了输出没有转义字符. princ旨在使人看起来不错,而prin1的输出旨在被功能read接受.
  • printprin1相似,除了对象的打印表示形式之前带有换行符,然后带有空格.
  • pprint产生漂亮的输出.
    • 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.

    这篇关于write,print,pprint,princ和prin1有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆