@MinervasRefuge Fear of Macros is nice. I went through it on the stream and adapted to guile specifics: https://youtu.be/Ag4movPnGa8?list=PLZmotIJq3yOJzhA0T6Y6EH2gxMfIm5pVQ
Also, take a look at syntax-rules primer: http://www.phyast.pitt.edu/~micheles/syntax-rules.pdf
And Writing Powerful Macros: https://mnieper.github.io/scheme-macros/README.html
SSS (The Supreme Sexp System) proudly announces version v2.3.23 of the project:
https://codeberg.org/jjba23/sss
It brings stability fixes and small improvements, to #hyprland and #labwc configurations, as well as the ability to turn #emacs #lisp #keyboard #macros into clean persistent code that can be bound to keys.
SSS is a Lisp machine adventure with #gnu #linux #guix where #hacking culture is celebrated.
Can you get enough Emacs really ?
I find it a bit ironic: I can't write a Scheme macro, which pre-evaluates arguments for arbitrary form. Because I can't determine if form is a macro or procedure application and thus can't handle those use cases differently.
I keep learning a lot about Scheme hygienic macros and macroexpander and today we talked about using macro as identifiers in arbitrary position of s-expression, syntax parameters, variable transformers and identifier-syntax helper.
TIL: There is an identifier-syntax macro that you can use to implement syntax-id-rules or do other fancy macro stuff.
My small overview of "JRM’s Syntax-rules Primer for the Merely Eccentric" paper about Scheme macros and useful tricks for writing them. Difficulty: medium-easy.
mpv https://youtu.be/A2vi3vQ15kM
Paper:
- http://www.phyast.pitt.edu/~micheles/syntax-rules.pdf
- https://hipster.home.xs4all.nl/lib/scheme/gauche/define-syntax-primer.txt
Spoiler: at the end of the paper a minimal scheme evaluator implemented purely with macros.
TIL: There is a syntax-error macro and it throws exception at expand time, rather than runtime. This is really useful to make macro fail early and prevent oopsies during the program execution.
@hn50 this sounds geckibg #cursed.
“A Generic Approach to Parsing CSV into Case Classes in Scala 3”
https://yadukrishnan.live/a-generic-approach-to-parsing-csv-into-case-classes-in-scala-3
Today I learned that Racket and Guile represent syntax objects for lists differently.
I don't know yet which one I prefer, because in Guile `syntax` not always returns a syntax-object as one could expect, sometimes it returns a list.
(use-modules (system syntax))
(syntax? (syntax (+ 3 4))) ;; => #f
(syntax? (syntax hi)) ;; => #t
On the other hand TSPL4 book says that #'(+ 3 4) returns a valid list.
Who read RnRS? What does it say for this case?
Are there any similar to Racket's syntax-e and syntax->list functions in Guile Scheme?
To better understand hygienic macros in Scheme, in 45 minutes I will go through the first 3 chapters of Fear of Macros book on stream.
The examples are written in Racket, but we will be using Guile and porting examples to it if necessary.
We use scalasql at work (yes, I'd recommend) and we had a bug where we mistakenly created nested transactions (which scalasql doesn't support -- but it does support savepoints).
Anyway, we found a clever way to statically prevent nesting transactions using macros, which I thought I'd share as an illustration of the helpfulness of macros
https://gist.github.com/aboisvert/c716c9e08f6d91c2b427fd855e3b4645