最小的 LISP?
我很好奇。可以在其上构建所有其他功能的最小 LISP 是什么?忽略效率——这个问题仅仅来自于一个优雅的地方。
如果你在一个外星球上醒来,并被指示构建一个最小的 LISP,然后你可以在其上构建你喜欢的任何功能,你会包括什么?
编辑:澄清。我在这里的目的不是引发一场辩论,而是我正在考虑实现一个最小的 LISP,我想了解我可以做到最小化,同时仍然允许我实现的语言是图灵完整的,等等。如果这结果是有争议的,我我确信我会从观察争议中学到我想学到的东西。 :)。谢谢!
Possible Duplicate:
How many primitives does it take to build a LISP machine? Ten, seven or five?
I am curious. What is the most minimal LISP, upon which all further features could be built? Ignore efficiency -- the question comes simply from a place of elegance.
If you awoke on an alien planet and were instructed to build the most minimal LISP that you could later build upon to implement any feature you liked, what would you include?
Edit: Clarification. My intent here is not to start a debate, rather I am considering implementing a minimal LISP and I want to understand how minimal I can go while still allowing the language I implement to be Turing complete, etc. If this turns out to be controversial I am sure I will learn what I wanted to learn from observing the controversy. :). Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
由 Paul Graham 提供,这里是 John McCarthy 原始 LISP 的 Common Lisp 实现:
它假设
quote,
atom
,eq
、cons
、car
、cdr
和cond
,并定义null
、和
、不
、追加
、列表
、配对
、assoc
、eval
、evcon
和evlis
。Courtesy of Paul Graham, here's a Common Lisp implementation of John McCarthy's original LISP:
It assumes
quote,
atom
,eq
,cons
,car
,cdr
, andcond
, and definesnull
,and
,not
,append
,list
,pair
,assoc
,eval
,evcon
andevlis
.Peter Norvig 用 90 行 Python 实现了一个 LISP 解释器,他的后续文章详细讨论了您所问的问题。非常值得一读,恕我直言。
http://norvig.com/lispy.html
我有一种感觉,他的“测序”很特别如果只有函数调用可以采用任意数量的参数,则可以删除表单。
但这会使函数应用变得复杂。
Peter Norvig implemented a LISP interpreter in 90 lines of Python, and his subsequent article discusses in detail what you're asking. Well worth the read, IMHO.
http://norvig.com/lispy.html
I've got a feeling that his "sequencing" special form could be dropped if only function calls could take an arbitrary number of parameters.
But this would complicate function application.