so how would I wrote a macro that reverses an expression using sysntax rules only in #guile ?
@AbbieNormal
Can you provide an example of what you are looking for?
I'm considering of porting to guile this paragraph (Transform!)
https://www.greghendershott.com/fear-of-macros/Transform_.html
ans when I reach 3.3 I can't reproduce the reversion of an expression
@AbbieNormal
Maybe I can try something tonight.
(If only I had Guile on my Android phone...)
@AbbieNormal
The eval call smells bad to me haha
(define-syntax reverse-me
(syntax-rules ()
((reverse-me args args* ...)
(eval (reverse (list args args* ... values)) (interaction-environment)))))
mmmh
this solutions does work, I guess, but I'm afraid it's not idiomatic Guile or Scheme
Do you really need to involve environments and eval to reverse an expression ?
@AbbieNormal
Haha there are surely other ways. I don't really know what idiomatic means.
I just hacked in the REPL for 10 minutes. Trying to get the same output as the exercise example 👍
in fact I think I got it 👀
@AbbieNormal I can't make it to work in my REPL 😕
the thing is I'm reading that Racket tutorial and parallely also the Guile manual
But the mismatches are more and wider than I thought
there were some misunderstandings on my side
Now, I think I mapped most of the Racket tutorial on Guile things
Notably, the Racket tutorial doesn't treat syntax-rules because Racket hasn't them
It jumps durectly to syntax-case
And the define-syntax-rule in Racket is for syntax-case, in Guile is for syntax-rules, as far as I understand
ah, it's 2 different chapters in the official documentation, good to know
But I was referring to this tutorial
> It’s called syntax-case, and has a shorthand for simple situations called define-syntax-rule.
Oh, I see. The author forgot the intermediate step: syntax-rules is a shorthand of syntax-case for simple (the vast majority of) situations, and define-syntax-rule is for the simplest case of syntax-rules.
@jeko
I call i tlike this
(reverse-me ("mom!" "hi"))
it's a bit naive, admittedly 😐