Readit News logoReadit News
tkrn commented on Steel Bank Common Lisp   sbcl.org/... · Posted by u/tosh
reikonomusha · 20 days ago
Coalton [1] adds Haskell-style types (so typed lists, type classes, parametric polymorphism, ...) to Common Lisp, and compiles to especially efficient code in SBCL.

[1] https://coalton-lang.github.io/

tkrn · 20 days ago
Describing Coalton as a CL add-on or even as a DSL has always seemed wrong to me. It's of course very tightly integrated with the Common Lisp runtime but it's also very different as an actual language. And I mean that in a positive way as being different from CL is both an achievement but also a requirement for doing what it does.

I just found it funny how Clojure's lack of cons pairs is enough to cause religious debates about its Lisp nature while (ISTR) adding symbols to Coalton basically requires foreign calls to the host system, but it still counts as a CL-with-types.

tkrn commented on Steel Bank Common Lisp   sbcl.org/... · Posted by u/tosh
vindarel · 20 days ago
tkrn · 20 days ago
Nice, pretty much what I had in mind. I think there could be some interesting potential there tooling wise. Combining a highly dynamic interactive environment with a good statically typed language sounds fascinating to me and it's something that at least to my knowledge has never been seriously tried. Only Strongtalk comes to mind but I have no idea how it was like in practice, and I assume the type system was something closer to Java.
tkrn commented on Steel Bank Common Lisp   sbcl.org/... · Posted by u/tosh
ivanb · 20 days ago
Coalton is nice but it requires a wrapper around every form you feed a REPL or around the whole file.

If on the other hand SBCL had a more powerful type system or extension points for a pluggable type system...

tkrn · 20 days ago
Wouldn't that be something that the tooling could deal with easily? I don't know if there is anything like that yet, but the last time I took a quick look at Coalton it seemed like some basic SLIME and ASDF etc support with its own filetype and Emacs mode to go with it could be potentially useful and fun little project.
tkrn commented on Steel Bank Common Lisp   sbcl.org/... · Posted by u/tosh
uhoh-itsmaciek · 20 days ago
The program with possibly my favorite error message: https://sourceforge.net/p/sbcl/sbcl/ci/master/tree/src/runti...
tkrn · 20 days ago
SAVE-LISP-AND-DIE is also pretty metal function name. Goes nicely with the shout-case too.
tkrn commented on LispE: Lisp Interpreter with Pattern Programming and Lazy Evaluation   github.com/naver/lispe... · Posted by u/PaulHoule
shakna · a month ago
Pairs are used by about 3-quarters of the standard library of Scheme, so I really would not consider its use to be a code smell.

You should be using the pairs when using make-hash, for example.

Cons also doesn't always return a pair. Its main purpose is for prepending to a list. Only when "the second argument is not empty and not itself produced by cons" does it produce a pair.

Which means '(a . b) is clearer code in intent, than (cons a b).

tkrn · a month ago
Good points. I don't think pairs are a code smell when used reasonably in situations where a pair of two values makes sense, like in your make-hash example. Ideally though I'd like to have a real, distinct (immutable) pair/association type separate from the cons/list and maybe use the dot syntax for that instead.

Deeply nested pair & list constructs that need to be unpacked with complex car/cdr combinations is what IMHO gets messy and I take the appearance of cddar & co in code as a sign that I should start thinking about using proper data structures.

tkrn commented on LispE: Lisp Interpreter with Pattern Programming and Lazy Evaluation   github.com/naver/lispe... · Posted by u/PaulHoule
shakna · a month ago
> LispE provides an alternative to parentheses with the composition operator: "."

That is a... Choice.

Breaking the pair operator in favour of something new.

tkrn · a month ago
I agree that there is maybe too much potential for confusion with that, but is the dot operator (or read syntax?) actually used that much these days?

Personally I have mostly sometimes used it with Emacs Lisp, but in general relying too much on plain cons cells and cadring down the cars of their cddars feels like a code smell to me and if I need a pair I can always just use cons? As the (only, I think?) infix operator in traditional lisps it has always felt extra-ordinarily useless to me (outside of Schemes use of it lambda lists), but maybe I'm just missing something.

tkrn commented on LispE: Lisp Interpreter with Pattern Programming and Lazy Evaluation   github.com/naver/lispe... · Posted by u/PaulHoule
shiandow · a month ago
I don't think it's too bad orthogonality wise, though it is a bit weird to introduce infix notation. It would almost make more sense to write

((. sum numbers) (1 2 3))

tkrn · a month ago
I'm not too fond of adding extra syntax or infix operators to Lisps but I have been thinking lately if maybe some limited form of infix macros could be useful, mainly in binding forms and such. E.g anaphoric ifs were a thing in the past for binding conditional expression's value; currently the preferred method seems to be if-let, or when-let and maybe unless-let too, and of course also the let* variants. And for completeness one might also need cond-let with its own different semantics. Oh, and maybe letrec and a few others too. But at that point it might make sense to come up with some kind of define-let-form macro facility to deal with the general pattern.

But all that gives me a nagging feeling that maybe traditional Lisp macros don't really compose that well? So as a band-aid I had the idea to introduce special infix macros so one could for example do "(if (expr as: var) (something-something var))", or maybe "(something-something var where: var expr)" and so on. I'm not sure what the exact semantics should be though, especially with the as: form. It's probably just a result of doing too much Smalltalk lately, but out of all the "let's fix lisp's syntax" ideas I don't think I have seen exactly this one before, so that's something I guess. (As an alternative we could also of course just replace the lambda form with something less verbose so one could "(if expr [var | something-something var])" and then make the conditionals regular functions, or even generic ones specialized on booleans. Or maybe I'll just get back to hacking my init.el for now and try to cleanse my mind of these impure thoughts.)

tkrn commented on A 4k-Room Text Adventure Written by One Human in QBasic No AI   the-ventureweaver.itch.io... · Posted by u/ATiredGoat
EvanAnderson · 5 months ago
Similar background here. The public library had Apple II machines and I became quite enamored with making proto-text adventures in Applesoft BASIC. Because you had to sign-up for time I wrote a lot of my programs longhand on nth generation photocopies of "program template" sheets that they handed out at the library (lined paper with columns for line numbers, statements, comments, etc).

The spaghetti code was astounding, and I remember squeezing line numbers between existing code-- adding a "31 GOTO 40" so I could squeeze a "room" into lines 32-39.

I never did grok the idea of building an "engine". Mostly I had PRINTs, INPUTs, and IF/GOTOs.

tkrn · 5 months ago
>The spaghetti code was astounding, and I remember squeezing line numbers between existing code-- adding a "31 GOTO 40" so I could squeeze a "room" into lines 32-39.

I spent too many nights trying to implement complex text adventures in Commodore 64 Basic and I'm sure that instead of permanently damaging me (at least in the sense that Dijkstra meant) it just made me appreciate more all the abstractions later languages introduced to me.

tkrn commented on A 4k-Room Text Adventure Written by One Human in QBasic No AI   the-ventureweaver.itch.io... · Posted by u/ATiredGoat
ianbicking · 5 months ago
Text adventures and AI-driven interactions are surprisingly different I've found... https://ianbicking.org/blog/2025/07/intra-llm-text-adventure – still not sure what the right fusion might be.
tkrn · 5 months ago
I could see LLMs being useful as just an UI layer on top of traditional interactive fiction engines? Having a voice-operated IF assistant/narrator paired with tools for note taking and such could offer an accessible alternative interface to the large existing IF library (or maybe something like that exists already?).

Taken further the assistant's role could be expanded with greater autonomy. Games could include metadata and authors hints & directives for the narrator. Or a limited interface for manipulating the game state and shifting the traditional IF model closer to a two player collaborative game. Using the LLM to transform and extend pre-authored text might actually offer new narrative possibilities, assuming the model could do it subtly and well enough, the style, POV, mood an so on of prewritten content could be freely modified in some interesting ways. E.g introduce unreliable narrators, describe the player's actions from a point of a security camera or their dog, rewind and replay events from some other characters POV. Simulate psychological issues by subtly rewriting the player's (or the narrator's or NPCs) perception of the world and have them navigate a little twisty maze of emotional states, all different.

Restricting the model into operating strictly within the limits of human authored content could bypass some of the usual problems associated with purely AI generated games and the approach seems fitting for the genre and it's pre-existing rich tooling and talent.

tkrn commented on Janet: Lightweight, Expressive, Modern Lisp   janet-lang.org... · Posted by u/veqq
ggm · 8 months ago
If a language lacks cons can it truly be held to be a lisp or has heresy taken over?
tkrn · 8 months ago
Although I'm a recovering sexp addict I must confess that I fail to see what makes the cons cell so important to those purer in their faith?

To me the homoiconity of Lisp is mainly about code-as-data, the exact nature of the data doesn't matter to me that much as long as it's a first class citizen and enclosed in nicely balanced parenthesis (though sadly here Janet seems to have fallen to the temptations of the curly braces, and thus, is indeed heresy).

u/tkrn

KarmaCake day17March 23, 2025View Original