Is it possible to write the following without using backquote?
(defmacro while (test &rest body)
`(do ()
((not ,test))
,@body))
Thought I'd try this as an experiment to understand benefit of backquote.
I got as far as this:
(let* ((test '(> 10))
(x 0)
(body '((princ x) (incf x))))
(list 'do nil (list (list 'not test))))
Which successfully generates:
(DO NIL ((NOT (> 10))))
To finish this I need a way to spread the n
elements of the list body
into the generated form.
I know that's the entire purpose of the unquote splice ,@
but is this actually impossible without it? Curious... It's similar to what apply
does but I don't want to call a function at this point obviously.