I wanted a function literal in Clojure that can take any number of arguments, but doesn't actually use them. So I've discovered %& ('rest arg' for function literal) and #_ ('discard' reader macro).
But how they work together surprises me:
=> (macroexpand `#(... #_ %&))
(fn* [& rest__125459__125460__auto__] (...))
This looks like what I wanted (and seems to work in the end), but is it how the discard macro supposed to work? The doc says:
The form following #_ is completely skipped by the reader.
But apparently here the ignored %& form has a side-effect, that is it affects the function literal args list. Should I rely on this behavior or does it look more like a bug?
I spoke too soon, probably not a bug, maybe it should be disallowed and give an error. But really
#_is for discarding forms, and%&is not a form but also a reader macro.So
#_%&is just like#_@,#_;and doesn't work. The discard reader#_is only to be used with "real forms" like()or[](etc)