r/scheme • • Jul 23 '24

Which lisp (lower case)

Hi,

I’m working on a blog post titled “which lisp” (lower case) and am soliciting responses to hopefully include in full within the post.

What do I mean by “a lisp”?

I means a lispy language.

  1. S-expressions on the surface (not as a substrate or implementation detail)
  2. Homoiconicity
  3. Fully specified across implementations at the level of day to day use

Decision points In no particular order, here are some questions I think are relevant.

  • Practicality for everyday to day generic scripting
  • Practicality for Web apps
  • Practicality for data analysis / munging tasks
  • Language ergonomics
  • Special sauce

What about Schemes?

For these purposes, each Scheme is considered a different “lisp” since in common use so many non-trivial packages/libraries/projects target a specific Scheme. Ease of learning/using other Schemes can be considered part of the special sauce, though.

What about Common Lisp?

While different CL implementations have special features, CL is fully specified and few significant packages/libraries function only on a single implementation.

What about lisp-over-another-runtime?

As long as the surface language has S-expressions and is homoiconic … it’s “a lisp” for these purposes.

11 Upvotes

11 comments sorted by

View all comments

Show parent comment

12

u/11fdriver Jul 23 '24

Common Lisp (SBCL)

  • You want to create a fully-featured piece of complex software.
  • You want full control over the finest details of your code.
  • You have unconventional ideas around software design & patterns that you want to test.
  • You like rapid prototyping, exploratory coding, and creative solutions.
  • You want to write code that will run in 20 years.

Nice:

  • Debugging is considered an unavoidable & necessary part of software development.
  • The most powerful REPL. SLIME & SLY are amazing.
  • Fast!
  • Lindy! Write Once, Run Forever.
  • Hyperspec is a fantastic, always-accurate resource.
  • Fully specified language allows for great reliability.
  • Condition and restart system are fantastic.
  • Superpowered macros.
  • Tagbody is a nice way to influence execution structure.
  • Generally agreed-upon feature-complete tooling.
  • Roswell is cool for managing projects and installations.
  • Good package management.
  • Some decent support for functional programming.
  • Generic setters.
  • Continuation-passing is confusing but can get you out of binds.
  • Lots of high-quality codebases to read through online.
  • Ultimate freedom awaits behind the CL door without the 'no-hand-holding' policy of C++.
  • CLOS and generic multiple dispatch are fast and powerful.
  • One main tool to remember; everything lives inside your REPL.
  • Some excellent learning books online, but not always free.
  • Clearer pathway for optimisation than many languages.
  • Being able to create standalone images is very handy.
  • Scripting is not too hard, especially with Roswell's generated template.
  • Can mimic many of the nice aspects of other programming languages with libraries.

Naughty:

  • Relatively closed ecosystem, not so easy to interface with existing languages.
  • Nasty surprises with macros.
  • Lots of footguns, and a lot to learn to avoid them well.
  • Sometimes nebulous documentation.
  • Some historical baggage for backward compatibility.
  • Web programming could be a little more ergonomic imo.

Racket

Note: I haven't used Racket outside of playing around, but I do recommend that others learn it sometimes. What I have tried has been very positive and quite easy to get along with.

  • You want to do syntactical research, or have unusual ideas around programming syntax.
  • You are learning programming, but prefer functional/lispy programming over Python.

Nice:

  • Hyperpowered hygienic macros. 'Language-oriented programming'.
  • Powerful GUI editor, DrRacket, included by default.
  • Consistent and easy to get started with.
  • Easy graphical programming (turtle, etc).
  • Some of the best online resources (beautifulracket, etc).
  • Some of the best documentation in general for the core language.
  • Scribble, the documentation language, is even nice for making larger documents.
  • Pollen is like scribble, but used to produce attractive online books.
  • Wonderful mathematics and graphing libraries.
  • Perfectly fine package management with raco.

Naughty:

  • Better hope that someone documented their obscure DSL.
  • Some cases of abuse and argument within the Racket team.
  • Not particularly fast execution (but works just fine for most things, and isn't a particular goal of this type of programming).
  • Lacklustre editor support outside of DrRacket.
  • Typed Racket adds a nice type system.

Honorable mentions:

  • Janet is a cool Clojure-like Lisp that is single-header embeddable into C/C++ projects.
  • Hy is a great Lisp that is the Python equivalent of Clojure on the JVM.
  • Lisp Flavoured Erlang (LFE) is a very nice functional Lisp for Erlang's VM, BEAM, that supports native green threads, pattern matching, and highly scalable concurrent programming.

Closing

I hope that this is helpful. I may have mentioned qualities for one Lisp but forgotten to do so for another that also has it. I may have even gotten something wrong. I swear that I found a way to do docstrings for Guile Scheme variables, for example, but then I really can't find it now.

5

u/raevnos Jul 24 '24

If you like functional style programming, you should look more into Racket. It comes with efficient immutable/functional hash tables (I almost never use the mutable ones it also has because it's so easy and natural to use the immutable ones in recursive code), sets, (very recently) vectors, and has more available in various third party libraries.