Something that comes up for me periodically is the need to build a list where either a value should appear or nothing (i.e. not nil)
So far my best stab is:
You can't use (REMOVE-IF #'NULL list) if there are necessary NILs in other parts of the list, and the ugliness of building complicated list structure via CONS and APPEND is the reason we have backquote in the first place.
So far my best stab is:
`(foo
bar
,@(when baz
(list baz))
quux)
But building a dummy list to splice in seems ugly. Does anyone have suggestions (or have I missed something simple)?You can't use (REMOVE-IF #'NULL list) if there are necessary NILs in other parts of the list, and the ugliness of building complicated list structure via CONS and APPEND is the reason we have backquote in the first place.