"Attila Lendvai" attila.lendvai@gmail.com writes:
(maybecall (not (listp thing)) #'list thing) == (ensure-list thing)
i don't see in which aspect it is better than writing
(unless (listp thing) (list thing))
This would return NIL if THING is not a list. MAYBECALL behaves like a identity function in that case, making it practical for chaining.
note that the rationale for ensure-list is that it's actually a bit shorter and also encodes the intention in a way that is much easier for a human to process (which, imho, can not be said for maybecall).
I haven't said anything about taking ENSURE-LIST &c out. MAYBECALL behaves to ENSURE-FOO as LAMBDA behaves to DEFUN/FLET.
An advantage of FUNCALL-IF is also single evaluation of its arguments, so I actually opt for its inclusion.
-T.c