Hello! Let us have another Friday social topic.
What type of problems do you solve using Lisp? Please share these details while answering:
- Which dialect of Lisp do you use?
- What problems do you solve?
- Why do you choose Lisp to solve these problems?
I have a feeling that this thread might get inundated with too many Emacs Lisp posts about solving personal productivity problems. That's fine. But I suggest posting stuff about other dialects of Lisp too. The more dialects of Lisp (CL, Clojure, Racket, etc.) are discussed here, the better! We want to have a good variety of answers on this thread.
NB: I have never had the fortune to write Lisp in a professional setup.
For years, I used to use SBCL snippets for a whole set of automation tasks in my daily workflow, like updating git repos in batch, checking failing CI/CD pipelines per repo, organising my music collection, etc.
But gradually I switched to more specialised tools and, yes, Emacs Lisp to do what I needed to do. It just felt more ergonomic in my case.
The last time I seriously used SBCL was to solve some of Project Euler's challenges back in 2018: https://github.com/bahmanm/euler-cl
Nowadays, I've got no non-elisp code left 🙂 🤷♂️
My answers:
- Common Lisp
- Numerical work. Document authoring work. All kinds of numerical stuff like linear algebra, exploring patterns of solutions for complex equations before formulating proofs, document writing. I also write documents as symbolic expressions and convert them to other formats like LaTeX, HTML, etc.
- I already started with a small bank of functions for doing numerical work back in the days. And from then it just kept growing. That's why I use Lisp for this stuff. For document authoring, symbolic expressions work surprisingly well as "markup". Write once and then convert them to LaTeX or HTML or Markdown using different macro definitions for the different symbols used in the "markup".
(EDIT: this got to be a wall of text, so I wrote a proper blog post about it, but I'll take any comments on it here, or on this Lemmy post linking to my blog.)
I have known about Common Lisp and Scheme for years, but only recently started using them.
I use Emacs and Emacs Lisp to manage my tens of thousands of text files, I write Emacs Lisp scripts to automate simple tasks like searching for pieces of information, formatting it, and outputting it to a report that I might publish on my blog or send in an e-mail. I also use Emacs to help with data cleaning before running machine learning processes. Emacs helps with navigating CSV and JSON files, it also is a really good batch file renamer.
I have recently started using Guile Scheme to do some personal projects. I went with Guile over the myriad other Scheme dialects because it is the implementation used for the Guix package manager and operating system. Also, there the G-Golf foreign interface layer allows Guile to automatically use an C library that implements the GObject Introspection interface. So through Guile, like with Python, you can use any C code library used to create of all native apps in the Gnome, MATE, Cinnamon, or Xfce desktop environments. This makes Guile a viable alternative to Python scripting across all of those Linux desktop environments.
Of all the Lisp dialects, Scheme is my favorite, for a few reasons:
- it is absolutely tiny. The Chibi Scheme interpreter is something like 300 kilobytes on a 64-bit computer system.
- hygienic macros with
syntax-case
- I strongly prefer writing recursive functions over using the
loop
macro of Common Lisp. Scheme also provides me the ease-of-mind that comes with knowing the optimizing Scheme compiler will ensure recursive loops will never overflow the stack. - most implementation have good support for pattern matching
- I personally find it easier to reason about higher-order functions when there is only one namespaces for variables and functions
- More recently, there is now support for Delimited Continuations across a few Scheme implementations
That said, I am also starting experimenting with Embedded Common Lisp (ECL) because it is a lightweight standards compliant Common Lisp implementation that compile your program into C++ code, and this is useful to my professional work.
In modern software engineering, especially in the realm of big data and machine learning, all of the most commonly used frameworks are written in C++ for performance, and scripted in Python. But Python does not scale well at all to larger applications, where Common Lisp does (for various reasons, but mostly due to how Lisp does strong dynamic typing and the meta-object protocol). So I see Common Lisp, and the ECL compiler, as a viable alternative to the sub-optimal status quo of Python/C++ in my professional work. Mostly, ECL would allow me to write a program in Common Lisp instead of Python, but deliver to my clients the C++ code that ECL generates to be used in their machine learning projects. (I have not actually done this yet, I am still investigating whether this would be a viable solution to any of my projects).
ECL makes it easy to use C++ libraries through Lisp instead of Python. And there are so many good, performant C++ libraries out there: Qt, OpenCV, OpenCL, Tensorflow, PyTorch, OpenSceneGraph, FreeCAD, Godot, Blender. And it compiles easily on Linux/Unix (GCC), Windows (MSVC), and MacOS (via Clang++), so good for cross-platform development.
Which dialect of Lisp do you use?
Currently Interlisp and Common Lisp, mostly under Medley.
What problems do you solve?
I use Lisp for my hobby programming, not necessarily for solving practical problems. I enjoy coding for the intellectual pleasure of creating, exploring algorithms and systems, and learning computing.
Why do you choose Lisp to solve these problems?
I have been checking out several programming languages for the past four decades or so and Lisp is the only family of languages that doesn't just come the most natural to me, it gives me pure joy.