[racket] Can you avoid voids in quasiquote?

From: Matthew Butterick (mb at mbtype.com)
Date: Tue Jan 28 14:20:21 EST 2014

I frequently write quasiquoted xexprs that contain this kind of pattern:

`(p "foo" "bar" ,(when test-condition (do-something)))

When test-condition is #f, I get:

'(p "foo" "bar" #<void>)

Which is wrong. What I wanted was:

'(p "foo" "bar")

I can fix it by doing this:

(filter-not void? `(p "foo" "bar" ,(when test-condition (do-something))))

Is this the best way? Or is there a cleverer way to make the nested
expression completely disappear?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20140128/1b9030cc/attachment.html>

Posted on the users mailing list.