Modern Common Lisp with FSet(fset.common-lisp.dev)
136 points by larve 3 days ago | 8 comments
oxavier 5 hours ago
This library serves as the basis of cloture[0] an effort to host Clojure on Common Lisp. I hope to see both projects thrive!

[0] https://github.com/ruricolist/cloture

ivanb 2 hours ago
Balancing trade-off is crucial in software design. It would be nice if the documentation listed the trade-offs of the structures compared to their native implementations. I imagine at least every mutation is consing? There are also larger fixed and slow-growing overheads in various operations.
aidenn0 1 hour ago
1. Each operation lists the big-O complexity; most operations are O(lg N).

2. There are no mutations

3. I think it would be rather redundant to mention that every operation that returns a new object conses.

ivanb 1 hour ago
Btw I meant quasi-mutations of course. So every quasi-mutation conses. Alright.
ivanb 1 hour ago
Big-O is one thing. Big constant factor, heap fragmentation and cache locality are other useful characteristics of data structures.
aidenn0 2 hours ago
Persistent/functional data-structures aside, bags are the most useful data type that is omitted from many container-libraries (whether or not the containers are part of the language stdlib).
valorzard 9 hours ago
I remember watching you give a version of this talk at the Bay Area Lisp meetup!
nothrabannosir 5 hours ago
Nice thanks, is there a single-HTML-page view available by any chance?
goku12 4 hours ago
I'm not the author and I can't find what you're looking for. But you could make it easily if you prefer it.

The documentation [1] seems to be in texinfo format that's commonly used for making info files used distributed with GNU and Emacs. It is converted into multipage HTML using two commands in the Makefile. You could modify them trivially to build what you want. I use it along with Sigil (epub editor) to build EPubs of user manuals for my EReader.

[1] https://gitlab.common-lisp.net/fset/fset/-/tree/master/Doc/M...

sillysaurusx 4 hours ago
I went ahead and did that. Here's the single page HTML view: https://fset-modern-cl.surge.sh/

Here's the diff. Claude helped me track down the link -> ref problem. https://github.com/shawwn/fset/commit/ce42cffde11fb84c075ddb...

Surprisingly it took 10 minutes total. Surge seems nice. (npm i -g surge)

LeCompteSftware 4 hours ago
Just FYI, this section at the end about R6RS Scheme is a little confused: https://fset.common-lisp.dev/Modern-CL/Top_html/Scheme-_0028...

   Strings are immutable [in Scheme]. Functional point update operations are not provided, presumably out of time complexity concerns, but string-append and substring are provided, and there are functions to convert to and from lists of characters; I guess the idea is that fine-grained string construction will be done using lists and then converted. Amusingly, there’s string-copy, though it’s hard to see why one would ever use it.
Strings are actually mutable in R6RS. See https://www.r6rs.org/final/html/r6rs/r6rs-Z-H-14.html#node_s... - there is an imperative update-in-place function which mutates the argument. So of course string-copy really is useful, you might want to mutate a string and keep an unaltered copy. And the intent of string->list is to automatically let your list-processing code become string-processing code. It is way too strong to say "Functional point update operations are not provided, presumably out of time complexity concerns" - R6RS actively encourages functional operations on strings by calling string->list first, even though that's O(n) overhead.

The overall point you are making seems clearly correct: R6RS Scheme does not provide any "mostly functional" datatypes beyond basic s-expressions, so it would take a lot of work to develop Clojure/FSet-style tools. But it's strange to so badly misstate what strings in Scheme are like.

perrygeo 2 days ago
Hidden 13 paragraphs down the third page is the first actual description of the project:

> So FSet has a dual mission: first, to bring Common Lisp up to date, by giving it a much richer ensemble of functional collection data structures, to greatly expand the space of algorithms that can be written in an elegant functional style and still run efficiently; and second, as with Clojure, to support and encourage the use of functional collections for general programming.

Cool project but the docs could be greatly improved by putting the purpose of the project front and center. Don't make readers guess.

ScottBurson 2 days ago
Okay, I buried the lede :-)

Good suggestion, thanks.

ScottBurson 1 day ago
If you see this — have another look — I think I've improved it.
arikrahman 7 hours ago
Not OP but it looks great! Your humility is much appreciated. I am excited for the Lisp community, and will follow this approach to CL as I do with Jank's approach to Clojure.
girvo 3 hours ago
I didn’t see the old one, but the current page made it clear straight away!
binary132 5 hours ago
I don’t know how it was before, but I found this immediately.
tug2024 1 hour ago
[dead]