Examples of excellent Common Lisp code?

2019-01-29 17:59发布

I've learned enough Common Lisp to be able to muddle my way through writing an application. I've read Seibel's Practical Common Lisp

What libraries or programs should I be reading to understand the idioms, the Tao, of Common Lisp?

7条回答
Root(大扎)
2楼-- · 2019-01-29 18:09

The only thing I would offer is to program. That is what I did.

I did two things. One I tackled a problem that i was familiar with, a unit testing framework and expanded it to include test suites. To get an understanding of macro writing.

The second thing I did was play around with basic objects in CL. Macros, closures, and style.

Also don't forget about getting feedback from Lispers about your code.

(defun ugly-lisp-code? () ())

查看更多
劫难
3楼-- · 2019-01-29 18:15

CL-PPCRE is often cited as a good example, for good reason. Actually, probably any of Edi Weitz's libraries will make good reading, but CL-PPCRE is particularly clever and it's a useful and impressive library. Beyond that a lot of CL implementations are written mostly in CL. It can be pretty productive to pick some part of CL that's usually implemented in CL and compare how different implementations handle it. In particular, some of the best examples of large useful macro systems are implementations of things in the standard. Loop is an interesting read, or if you're really ambitious you could compare a few implementations of CLOS.

If there's some area of computing you are particularly interested in it might be worth mentioning that, so people can tailor recommendations to that.

查看更多
再贱就再见
4楼-- · 2019-01-29 18:20

LISP (Lisp In Small Pieces) is a neat book; shows clossette (small obect system) and some compiler stuff. Without doubt, norvig's book is awesome.

I like really "building problem sovers" as well but the code is a bit ruff. I'm not used to binding dynamic-scoped variables in the paramter list. But it made for much fun improvements trying to "pre-compile" the discrimination net. This book gives another approachs to some of Norvig's code; I still think that Norvigs code is much "neater and cleaner" code (easier to read and understand, and still creative).

"Building problem solvers" should come with a warning label like "you're gonna need some aspiren (sp). It felt like a bolt of lightning struck me in the head when I finally "understood" rms and sussmans' dependancy directed backtracking. Compiling the pdis was also brilliant. Excellent stuff. I just wish I could remeber it all ...

查看更多
成全新的幸福
5楼-- · 2019-01-29 18:21

It's another book, so it may not be precisely what you're looking for, but Peter Norvig's Paradigms in Artificial Intelligence Programming contains a lot of well-written, smallish Common Lisp programs. It's not perfectly natural code, especially in the the first few chapters, because, like code in Practical Common Lisp, it focuses on teaching you how to program in CL, but it's still very much worth a read. It also contains some excellent examples of ways you can build other languages on top of Common Lisp, and it has some valuable advice on how to improve the performance of CL programs.

查看更多
一纸荒年 Trace。
6楼-- · 2019-01-29 18:21

I like the SBCL code.

查看更多
放我归山
7楼-- · 2019-01-29 18:25

The Art of the Metaobject Protocol - is a book with the most beautiful code ever written.

查看更多
登录 后发表回答