Re: [racket-users] xexpr cond failing

2020-03-01 Thread Sorawee Porncharoenwase
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

Re: [racket-users] xexpr cond failing

2020-03-01 Thread Sorawee Porncharoenwase
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

Re: [racket-users] xexpr cond failing

2020-03-01 Thread liendolucas84
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!

Re: [racket-users] xexpr cond failing

2020-03-01 Thread Sorawee Porncharoenwase
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

[racket-users] xexpr cond failing

2020-03-01 Thread liendolucas84
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