this post was submitted on 29 Sep 2023
10 points (91.7% liked)

Lisp Community

683 readers
5 users here now

A community for the Lisp family of programming languages.

Lisp (historically LISP) is a family of programming languages with a long history and a distinctive, fully parenthesized prefix notation. Originally specified in 1958, Lisp is the second-oldest high-level programming language. Only Fortran is older, by one year.

History

Associations and meetings

Resources - TODO

Related communities (dialects) - TODO

founded 5 years ago
MODERATORS
 

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.

all 9 comments
sorted by: hot top controversial new old
[โ€“] bahmanm@lemmy.ml 3 points 1 year ago

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 ๐Ÿ™‚ ๐Ÿคทโ€โ™‚๏ธ

[โ€“] Ramin_HAL9001@lemmy.ml 2 points 1 year ago* (last edited 1 year ago) (1 children)

(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.

[โ€“] jaredj@emacs.ch 4 points 1 year ago (1 children)
[โ€“] Ramin_HAL9001@lemmy.ml 2 points 1 year ago (1 children)

Oh wow, I had seen this presentation back when it first came out in 2018 and had forgotten about it! Thanks for reminding me!

[โ€“] jaredj@emacs.ch 3 points 1 year ago

@Ramin_HAL9001 I feel like they have made less presentations of late, but the repo commits say that they are still working on it

[โ€“] cadar@lemmy.ml 2 points 1 year ago

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".
[โ€“] amoroso@lemmy.ml 2 points 1 year ago

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.

@cadar

in my case the answer is long and winding.

I started by embedding Guile Scheme into my game engine, because I wanted to make a game, and I ended up with this;

https://www.youtube.com/watch?v=G4QVE6JjmO0

(then Guile developers changed some APIs and so it no longer compiles)

But I have used Guile a lot in Emacs via Geiser to do various small things, such as this:

https://www.quora.com/For-what-types-of-problems-is-functional-programming-better-than-object-oriented-programming/answer/Panicz-Godek

The macros and functions that I've accumulated along the way were eventually gathered into one module that I called (grand scheme):

https://github.com/plande/grand-scheme

Later on, while still trying to make a game, I concluded that the medium of text isn't expressive enough, and that I would like to be able to write some pieces of my program (like finite state machines) in visual notation, so I ended up developing GRASP, The Graphical Scheme Programming environment, which currently looks like this:

https://www.youtube.com/watch?v=wN8Fy5xTXeQ

and it also works on Android

https://www.youtube.com/shorts/J9YNBxPP_wU

(which is why I chose Kawa Scheme to implement it)