Hacker News new | ask | show | jobs
by olewhalehunter 3224 days ago
What are some examples of open source Lisp projects and codebases whose features and elegance could have only been executed as well as they are in the language, or are just great codebases in general to study?
6 comments

GNU Guix. It uses code staging a lot, which works best in a language in which you can trivially pass around code as data.

It also demonstrates that Scheme is flexible enough to easily implement features that the language designers did not, such as monads and laziness. While both can be done in almost any language, I think that Scheme's macros allow for exceptionally seamless implementations.

> code staging

I'm trying to look up what this means. Do you have a link?

In Guix not only package definitions are written in Scheme, but also build phases. These build phases are evaluated at a different time in the context of the build daemon. This means that there are two major strata, both of which are written in Scheme. Expressions that are evaluated in the build context look no different than other expressions.

That's not the only instance of "staged" execution. Guix introduces G-expressions, a quoted expression in a build context where unquoted package values are replaced with absolute directory names that are not known until execution time.

Quoting and unquoting code and dealing with different strata of evaluation come natural in Scheme.

Another simpler example of staged execution might be the remote code execution feature of Guile-SSH.

You may also like to read about multitier programming in Hop: http://queue.acm.org/detail.cfm?id=2330089

"Code staging" is a phrase that is used around people who are allergic to the word "macro", because they associate it with #define, or "Excel macro".
Axiom, Maxima (DOE), and Macsyma (Symbolics) are large systems.

Axiom is a FOSS computer algebra system implemented in about 1.2 million lines of Common Lisp.

Axiom relies heavily on the ability to dynamically define and re-define functions. It relies heavily on the macro facility. It presents a domain specific language (called SPAD) which implements mathematically friendly syntax and semantics. (https://github.com/daly/axiom)

I think Emacs is the best example.
For Common Lisp people always recommend Edi Weitz's software like CL-PPCRE: http://weitz.de/cl-ppcre/

https://github.com/edicl/cl-ppcre