Actually you might want to use (list (let () body ...)) rather than (list
(begin body ...)) so that you can use define inside when/splice, just like
how you can do that in when.
On Sun, Mar 1, 2020 at 3:26 AM Sorawee Porncharoenwase <
sorawee.pw...@gmail.com> wrote:
> Well, you can always use
Well, you can always use macro!
(define-syntax-rule (when/splice test body ...)
(if test (list (begin body ...) '(
`(body
(form ((action "") (method "post"))
(label ((for "username")) "Username:")
(input ((type "text") (name "username") (maxlength "64")))
(label
Thank you very much for your reply Sorawee. I'll go with your proposed
solution for the time being. However it feels like I'm adding unnecessary
code to make the xexpr valid which can be really annoying if having nested
cases or other more complex situations. Thanks again for your fast reply!
One possible way is to have the first case returns a list of one element,
and the else case returns an empty list. You then splice this list
into body via
,@.
`(body
(form ((action "") (method "post"))
(label ((for "username")) "Username:")
(input ((type "text") (name
Hi everyone! Just joined the Racket User's group. I'm trying to
conditionally render a paragraph element using a cond and an xexpr but I
can't make the "xexpr?" function return a #t value and of course the
response/xexpr function call fails as well. I've kind of fix this by always
returning a
5 matches
Mail list logo