OK, it seems that I have found the way:
(define-syntax (call-my-func stx)
(syntax-parse stx
[x:id #'(my-func)]
[(x:id) #'((my-func))]
[(x:id arg ...) #'((my-func) arg ...)])
)
It suits my needs, although is not as simple as would
be a "replace call-my-func with (my-func) disregarding
the circumstances" macro.
Just out of curiosity: is the latter possible?
Best regards,
Dmitry
On 11/19/2016 01:10 PM, Dmitry Pavlov wrote:
Hello,
I was wondering how I can define a macro that acts without parentheses.
Here is what I came up with:
(define (my-func) "abc")
(define-syntax (call-my-func stx)
(syntax-case stx ()
(_ #'(my-func))))
It was fine at the first glance:
call-my-func
"abc"
But then I tried
(call-my-func)
"abc"
This pose a problem to me in the case when (my-func) returns not
a constant but a function to be called.
Besides, it breaks my common sense of Lisp that is
"an extra pair of parentheses does change things".
Could anybody school me on this topic please?
Best regards,
Dmitry
--
You received this message because you are subscribed to the Google Groups "Racket
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.