3 ms·
Common Lisp provides an explicit macro for this called formatter. The macro produces a function. The format function allows a functional argument in place of th
by kazinator 4y ago
Common Lisp provides an explicit macro for this called formatter. The macro produces a function. The format function allows a functional argument in place of the format string for this reason.
(format t (formatter "~a-~b") x y)
is like
(format t "~a-~b" x y)
except that "~a-~b" is transformed into a lambda which takes a stream and two arguments, and which does the specified formatting.
- nerdponx 4y agoThere are so many corners of the spec that I have not yet explored, so I always appreciate trivia like this. However I was thinking more like the macro that the article was proposing.