God wrote in Lisp code

作者:薛宏 原發表日期:2008/2/7 http://psychob.soup.io/

前一阵子听到这首歌 God wrote in Lisp code (结尾有歌词) 感觉越来越迷恋 Lisp 了

If you give someone Fortran, he has Fortran.
If you give someone Lisp, he has any language he pleases.
–– Guy L. Steele Jr.

如果世界上只有一种编程语言 我会毫不犹豫地选择 Lisp Lisp 是除 Fortran 之外第二古老的语言 然而她太超越时代了 由于基于 Lambda 演算理论 1960 年在冯诺依曼机上运行效率很低 甚至要专门的 Lisp Machine 等到一般 PC 能运行 Lisp 时 大家早已习惯了冯诺依曼式的语言了 某位图灵奖得主曽感慨 我们何时才能从冯诺依曼式的语言中解脱 如果晚 20 年诞生的话 恐怕早已横行天下了 貌似有人预言最终编程语言都会趋向于 Lisp 从 C# 的演化中可以看到些蛛丝马迹

Lisp 是简洁的 哪个语言能用其自身的30代码写出她自身的解释器(meta-evaluator)!(参见 The Root of Lisp) Lisp 是千变万化的 她甚至不是一种语言 而是一种元语言(meta-language) Lisp 不是用来直接编程的 而是用来构建合适的语言(Domain Specific Language, DSL) 组合子+宏 你便拥有了一切

Lisp 的使用者都是些神秘的小团体 传说纽约有个神奇的3人组 每次都能在极短的时间内完成几乎不可能完成的项目 不过也有例外 貌似有家公司号称拥有地球上最多的 Lisp 程序员(几千个) 他们的代码库由几千种 DSL 加上上万个的宏组成。。。 这让我想到以前的一部电影 一群疯子为了求证上帝的存在与否 把银河系内的所有电脑联网构成一台超级计算机 启动后电脑说 Yes, now there is a God 。。。

很怀念前一阵子 每天 6 点爬起来 如痴如醉地看 SICP 的录像 这可是 1980 年 MIT 的课程录像吖!

On Lisp 是本好书 亚马逊上居然卖到 300 多美金 而且销量十分不错。。。 虽然作者的主页上提供免费的PDF下载 还记得那条画着 Y 组合子的胳膊么



God wrote in lisp code
I was taught assembler
in my second year of school.
It’s kinda like construction work –
with a toothpick for a tool.
So when I made my senior year,
I threw my code away,
And learned the way to program
that I still prefer today.

Now, some folks on the Internet

put their faith in C++.

They swear that it’s so powerful,

it’s what God used for us.

And maybe it lets mortals dredge

their objects from the C.

But I think that explains

why only God can make a tree.

For God wrote in Lisp code

When he filled the leaves with green.

The fractal flowers and recursive roots:

The most lovely hack I’ve seen.

And when I ponder snowflakes,

never finding two the same,

I know God likes a language

with its own four-letter name.

Now, I’ve used a SUN under Unix,
so I’ve seen what C can hold.
I’ve surfed for Perls, found what Fortran’s for,
Got that Java stuff down cold.
Though the chance that I’d write COBOL code
is a SNOBOL’s chance in Hell.
And I basically hate hieroglyphs,
so I won’t use APL.

Now, God must know all these languages,
and a few I haven’t named.
But the Lord made sure, when each sparrow falls,
that its flesh will be reclaimed.
And the Lord could not count grains of sand
with a 32-bit word.
Who knows where we would go to
if Lisp weren’t what he preferred?

And God wrote in Lisp code
Every creature great and small.
Don’t search the disk drive for man.c,
When the listing’s on the wall.
And when I watch the lightning burn
Unbelievers to a crisp,
I know God had six days to work,
So he wrote it all in Lisp.

Yes, God had a deadline.
So he wrote it all in Lisp.