Hacker News new | ask | show | jobs
by RaycatRakittra 2583 days ago
Love seeing a Lisp Cookbook pop up on HN.

Had a general question about CL. What advantages does it have over things like Racket and Chicken? And how could I potentially pitch the language to a non-dev?

3 comments

It's defined by an ANSI standard; see (http://clhs.lisp.se).

There are a handful high-quality implementations, both free and commercial, many of which can generate efficient native code. When you can stick to the standard, you can reasonably expect your code to work across implementations and platforms.

The existence of the standard also means that you can often use code that is decades old with few changes. Furthermore, there are actually bodies of old code that you might want to use, because of its relatively common use in AI and academic communities in the 80s and 90s. See, for example (https://www.cs.cmu.edu/Groups/AI/0.html).

It's designed to support interactive programming to a greater extent that any other language except perhaps Smalltalk. For example, the ANSI standard defines functions you can use to change the definitions of classes at runtime and have existing instances automatically updated to use the new definitions.

Like Racket and Chicken, it has a good library ecosystem. The ecosystem is supported by a good package manager (https://www.quicklisp.org/beta/). That package manager is in turn supported by a decent documentation-search site (http://quickdocs.org).

Several Common Lisp implementations support easy delivery of programs as a single, self-contained executable. The buildapp library (http://quickdocs.org/buildapp/) shows how this may be done in a cross-implementation way by supporting both SBCL and CCL.

The Common Lisp community has been around for decades, as have some of its prominent members. There's a ton of useful, practical knowledge in the community. It does have a bit of an unfriendly reputation, and that's sometimes deserved, but with some patience and persistence you'll find that it also contains friendly and helpful people who know a lot about the language and its effective use.

You can find a guide to the community here (https://common-lisp.net/community).

I'd pitch:

- it's all interactive and that's a productivity boost. Write a function, compile it (yes, compile function by function), see warnings or get a debugger on errors, try it right away. Same for web development. No process has to restart to test your changes.

- build a self-contained executable: a joy to deploy.

- strong typing, catches many common errors (and coming: an ML extension for CL: https://github.com/stylewarning/coalton, already used in a large Rigetti codebase)

- stable.

- fast

- take in every language feature you want with libraries

- parenthesis: they help to edit code by structure, by semantic units, instead of by line or characters.

- most flexible language. Like Python's decorators or context managers ? Yet they're limited and have their idiosyncrasies.

- unmatched object system, with generic functions that help maintain your logic small.

And there are libraries :] https://github.com/CodyReichert/awesome-cl

Upsides: Many muture implementations both commercial and opensource (SBCL, LispWorks, Franz Lisp).

Can be very fast.

Less opinionated than Scheme/Racket. Supports FP, imperative, and OOP.

Supports system images where you can hack on running images to avoid downtime. Racket doesn’t support this.

Great debugging from the REPL.

Probably the most advanced exception/error system of any language.

Easy to learn (and powerful) macros.

ANSI standardized.

Powerful object system.

Downsides: Dynamic typing (some people might not have a problem with this).

No match statements.

Huge and complicated standard. Many unnecessary and unused/dead features.

Inconsistent and not orthogonal in the least. Multiple functions that do the same thing but have different argument orders or inconistent names.

A little low level compared to Racket. This might be a positive if you want C-like performance.

Not the greatest libraries compared to Racket. Documentation is often bad or non-existent.

Hard to learn effectively. Language gives little guidance on how it should be used.

There's the very good Trivia library for pattern matching: https://lispcookbook.github.io/cl-cookbook/pattern_matching....

(and I think libraries are better maintained that Racket's)