r/lisp

▲ 75 r/lisp

Git support for Lisp improved in 2.55.0

In a Git diff, each consecutive subsequence of lines near a difference is called a "hunk". Each hunk has a one-line header that might look something like this:

@@ -316,8 +322,9 @@ int main(int argc, char **argv)

The numbers indicate which lines of each version of the file appear in the hunk. The rest of the line is intended to be the first line of the function, class, or other top-level definition that the hunk is within. Git finds that line using a regexp corresponding to the source language. It's just to give the reader a bit more context; nothing else depends on it — or should depend on it, anyway, since it can be missing or wrong.

The regexps that tell Git how to find the header lines are called "userdiff drivers". A driver for Scheme was added a couple of years ago, but it didn't work for Common Lisp or many other Lisps, as it failed to match (defun lines. I have modified it to be more general, and the relevant changes are in the recent Git 2.55.0 release.

I was unable to persuade the Git maintainers to name the driver "lisp", however, given that one named "scheme" already exists. The argument that Lisp is the family name, and Scheme one dialect within the family, was not sufficient to overcome their resistance to having two closely related languages with separate drivers — understandable, since too lax a policy about adding drivers would surely lead to there being hundreds of them. And of course, we couldn't just rename the "scheme" driver, because people are already using it.

So that's why, starting with Git 2.55.0, the way to get correct hunk headers for code in Common Lisp, or probably almost any other dialect of Lisp, is to have a .gitattributes file containing this line:

*.lisp diff=scheme

The Scheme regexp is still there and will still match all the same constructs, but there's also now a much more general regexp that simply matches any unindented open parenthesis, or (def preceded by one or two spaces. (The latter is to catch defining forms grouped together insde a top-level form like eval-when, but without the false positives that we would get if we didn't require a name beginning with def.)

reddit.com
u/ScottBurson — 2 days ago
▲ 47 r/lisp

Any books similar to SICP Chapter 5?

I loved Chapter 5 of Structure and Interpretation of Computer Programs. Building a virtual register machine with an assembler and compiler in Scheme. Are there any other books/online classes or resources that involve building a computing machine (or any machine) from scratch using code?

reddit.com
u/Bongril_Joe — 3 days ago
▲ 64 r/lisp+1 crossposts

LIPS Scheme 1.0.0-beta.22 with continuations and TCO

The new beta of LIPS Scheme just got released. The evaluator was rewritten. It now supports continuations and TCO.

The implementation was inspired by JS-Scheme by Alex Yakovlev.

There is also a new quasiquote implementation based on Alen Bawden's paper "Quasiquotation in Lisp", a new macroexpand, and some performance improvements.

Full article about the release on the blog:

https://lips.js.org/blog/beta-continuations-and-tco

u/jcubic — 3 days ago
▲ 17 r/lisp+1 crossposts

Easy-ISLisp Ver5.63 has been released.

This release mainly focuses on compiler improvements, stability enhancements, and bug fixes.

Highlights:

  • Improved compiler stability
  • Better handling of labels mutual recursion
  • Improved nested lambda/free variable handling
  • Refined optimization and type inference behavior
  • Added (eisl-version) for distributed parallel child-node version checking
  • Re-tested distributed parallel functionality on a Raspberry Pi cluster

The distributed parallel features were verified again after recent compiler modifications to ensure that no regressions were introduced.

The compiler now appears to have reached a more stable operational level for ordinary user programs.

GitHub:
https://github.com/sasagawa888/eisl

Feedback and bug reports are welcome.

u/sym_num — 5 days ago
▲ 82 r/lisp

Really struggling to find a "practical" lisp

I write C++ for my day job, but I'm looking to pick up a Lisp as a hobby project. Even though it's a hobby, I want it to be practically useful to my day-to-day workflow. Specifically for writing scripts, automating tasks, and potentially extending my editor (I use Emacs).

I’ve narrowed it down to three choices but I'm having trouble pulling the trigger:

  • Guile (Scheme): This seems incredibly useful for general scripting. Guix seems to be a huge plus if I decide to go that route later.

  • Emacs Lisp: The obvious choice for immediate practical utility since I'm an Emacs user. Being able to hack my editor sounds great, but I worry it might be too domain-specific if I want to write standalone scripts and other things unrelated to Emacs.

  • Common Lisp: This is the one I’m struggling to place. I constantly hear that it has "the best programming books ever written" (Practical Common Lisp, PAIP, etc.), but I fail to see what the killer practical hook is for a modern developer doing scripting and automation. Each binary seems to be huge and not practical unless you're writing it for a living.

For someone with a systems/C++ background who wants to write useful tools, which would you recommend diving into first? And regarding Common Lisp, what am I missing? What is the practical value of CL today outside of its excellent literature?

Thanks in advance for the advice!

reddit.com
u/Anxious-Resist8344 — 8 days ago
▲ 27 r/lisp+1 crossposts

Metaspec updates: More corrections, features, Info render, ELPA package

Since the Metaspec (https://metaspec.dev/) was announced a couple of months ago, there have been many improvements. Thanks to #commonlisp on libera.chat for your suggestions!

  • Added a search box in the header
  • Added a dark/light theme button
  • Added an outline sidebar that shows if there's horizontal space
  • There is an OpenSearch spec to add it as a browser search engine
  • Extra information is now listed in an Addenda section
  • New Texinfo and Info renders added
  • There is a new emacs integration package https://metaspec.dev/elpa/ for details
  • X3J13 Issues have been integrated into the HTML
  • Better handling of linking of LOOP keywords
u/azimuth — 6 days ago
▲ 0 r/lisp

Renderer port to lisp

I’m considering doing a staged port (LLM assisted) of my rust-based multithreaded cpu renderer to SBCL . I’m currently using Janet as an embedded language for scene description. The core rendering is done in rust . Early benchmark trials in sbcl with basic primitives were 3-6x slower with GC being the wall . Can anyone suggest guidelines for performance? ( ex: vector/matrix calculations, memory allocation, to CLOS or not ) etc . I’m thinking that if I could get it within 2x slower, it might be interesting for certain applications where I could throw more cores at it . Also is anyone interested in such an application? I would be willing to make a demo if reasonably successful.

reddit.com
u/Feisty_Bike_9614 — 9 days ago
▲ 261 r/lisp+3 crossposts

Gödel, Escher, Elisp: The Beauty of Macros

This post is a lover letter to Emacs Lisp macros. I've been a long time user as a lisp hacker, and my recent obsessions with Douglas Hofstadter's strange loop concepts and M.C. Escher's mind bending artwork have enhanced my appreciation of this language's most beautiful and thought provoking feature. This post can teach you about macros and what makes them useful, but I also hope it can instill a fascination with their concept. https://www.chiply.dev/post-elisp-macros-are-beautiful

chiply.dev
u/misterchiply — 14 days ago
▲ 48 r/lisp+2 crossposts

MUD Driver in Common-Lisp

Hey folks, I'm working in an open source common-lisp MUD Driver (Apeiron MUD) mainly inspired by Dworkin Game Driver and LPMud.

Why? The personal reason is that I like Lisps and functional programming, I'm expert in Clojure, but haven't played too much with Lisp, wanted to see what could be achieved with CLOS (Common-Lisp Object System) and I love text-adventure games/virtual worlds (single or multiplayer).

The technical reason is that I was wondering that a lot of the machinery that was developed in C for the most popular drivers (specially LPMUD and DGD deriving from it) ended up developing features that were already built-in on Lisp Runtime Images from the start and if I could get a networked REPL running a LISP image that was already a significant step towards running a persistent world that could be changed and built interactively by players.

I don't know how true is that, but I managed to setup something similar to DGD (of course there might be bugs and rough edges) with persistent objects using a pre-existing library for CLOS in-memory and disk object persistence called BKNR Datastore. The interesting thing is that because of CLOS it is even possible to make changes to the classes of the objects (driver or libs) and update the system and persistence without ever having to turn the system off. I already did some very substantial changes successfully without turning the system off.

The scripting language doesn't need to be different from the driver language, except for security reasons. For the moment I allow every player to evaluate arbitrary code, which is very unsafe and can even bring the server down or completely break it, but it would not be hard to restrict the access to a subset of the language (with cl-isolated) and offer varying degrees of access depending on player role.

I think it has a lot of potential, but in any case, I'm doing it for fun, will probably keep it as a lifetime hobby and would encourage people to take a look if they find anything interesting or want to experiment, contribute or discuss.

u/NoProgram1720 — 12 days ago
▲ 11 r/lisp+3 crossposts

LispBM CAN message send in VESC

Hello everyone I have motor controller which is VESC firmware based ,what i want is to write a lispbm code to get the parameters values from the controller using get function and then send them on the CAN BUS using the CAN IDs set up by me to read further ,I am doing this because the DBC file I got is not that much reliable and the the manufacturer is also not able to help much
please help me with the resources which i can refer ,i refer the git repo of the VEDDER but cant do much ,any help you can or tips you can give me

reddit.com
u/_rickc137 — 11 days ago
▲ 33 r/lisp+1 crossposts

L. Peter Deutsch's birthday today

Happy Birthday (Aug 7, 1946) to L. Peter Deutsch, computing luminary and inventor of the REPL -- as a teenager. Some background about the creation of the REPL is found on the fantastic Obsolescence Guaranteed site at https://obsolescence.dev/interactive-computing-history.html

The PDP-1 LISP 1.5 guide (1964) is also available online at https://s3data.computerhistory.org/pdp-1/DEC.pdp_1.1964.102650371.pdf

reddit.com
u/fogus — 13 days ago