(mac awhen (expr . body)
`(std.let it ,expr (std.if it (std.do ,@body))))
This assumes that awhen is being defined and exported from the std module too, so that it can also be used in expansions. Slightly more verbose, but that's optional hygiene if you want it.
Comments
To make it clear, the example below would become:
This assumes that awhen is being defined and exported from the std module too, so that it can also be used in expansions. Slightly more verbose, but that's optional hygiene if you want it.