A few thoughts about my experience with

This discussion was made with @alandipert but I erroneously made it private

Then I realized it could be of general interest

So let's begin


I' m dreaming of an lsp server for Guile

I find the interfaces for compilation and modules management are criptic

I found one, here

I wanted to use it as a source of examples

Watching that code, the main thing I was led to dig in is tree-il

tree-il is an intermediate language the compiler uses

it's the result of the first pass of compilation

Show thread


In Clojure I would have used a map with an arbitrary layout and arbitrary keys

In Guile it's not that simple

firstable, the pretty printer doesn't support the dictionary structures Guile supports, BUT alists

This alone makes exploratory programming impossible when using dictionary structures

Scheme is made to be expanded, the tooling is not

Show thread


but first I should state what I'm trying to do

I am trying to make a tree that can be pretty printed out of a tree-il structure

tree-ils are trees already but they cannot be pretty printed

I just want to visit a tree-il and build a new tree made of vanilla cons cells (that can be pretty printed)

Show thread


the reason why I wanto to do that is because I need to get acquainted with the whole tree-il story

probably the shortest route would be to implant a custom printer into the records used to represent the tree-il structure

they are regular vanilla scheme records and I remember reading somewhere that they can be given a custom printer

I don' t remember if this was in the pretty printing chapter or in the records chapters

but let's say this was not an option

Show thread


I'm using alists because they can be pretty printed

And I'm having a hard time in updating nested values

the interface for assoc-set! is a nightmare

Admittedly the manual explicitly states to avoid alists when you need to update your structure often

and then there's a corner case about updating nested structures I discovered just today

then there's lenses

and then there are clojure zippers, that Guile hasn't

Show thread


because I'm given a "fold" procedure to visit the tree-il structure, I need to pass a tree AND the current position at the intermediate steps

All this stuff together is overwhelming me

In Clojure much of these bricks would have been already available and I should have had to just lay them out

Show thread


Also, the clojure documentation is made mainly of examples

the Guile documentation is made of conversational descriptions of procedures signatures

and I have a hard time in moving from properties to use cases myself

it's like you have to write an article starting from the English grammar rules

so I need to read and re-read and re-read the manual and then mumble for days

it's frustrating

Show thread

@ekaitz_zarraga @alandipert

I didn't try records

I know I can pretty print a single record but I' m not sure about pretty printing a tree made with nested records

With cons cells it' s a no brainer


@ekaitz_zarraga @alandipert

tree-il are already records

Maybe I could just assign them a custom pretty printer ?

I know this can be done, with records, but again they are nested to make a tree

I don' t know 😐

@AbbieNormal @alandipert Oh. In Racket the literal for a (immutable) hash is #hash((key . value) (other-key . other-value)), and that's what you get when you (write my-hash).

It has been very useful to me, I wonder why guile went with this #hash<6/32> output instead. 😕
Sign in to participate in the conversation

The social network of the future: No ads, no corporate surveillance, ethical design, and decentralization! Own your data with Mastodon!