#|

I  wrote  this macro  for explaining  'MAPCAR  in terms  of  'LOOP  to
pizzapal deep within one of James' mastodon threads.

|#

(defmacro loopcar (fun &rest lists
                     &aux (syms (loop for x in lists
                                     collect (gensym))))
`(loop ,@(loop for list in lists
               for sym in syms
               nconcing  (list :for syn :in list))
      collecting (funcall ,fun ,@syms)))

#|

We were also talking  about how big the common lisp standard  is:  But
there's  so much useful stuff in there (that  went into my explanation
of 'MAPCAR). I had actually been hoping to find a simple definition of
mapcar's   behaviour   analogous   to  this  definitionally    correct
description of mapcon in terms of maplist:

(mapcon f x1 ... xn)
:= (apply #'nconc (maplist f x1 ... xn))

but mapcar and maplist get prose definitions. Maybe

(labels
((%cars (lists)
  (if (null lists) nil
   (cons (caar lists) (%cars  (cdr lists)))))
 (%cdrs (lists)
  (if (null lists) nil
   (cons (cdar lists)  (%cdrs (cdr lists)))))
 (%mapcar (f &rest rest)
  (if (some 'null rest) nil
   (cons (apply f (%cars rest)) (%mapcar  f (%cdrs rest))))))
 (%mapcar f x1 ... xn))

Though  we would  never  see this in common  lisp because  we have the
mapcar family in the standard.

|#