Subject: lambda list in MULTIPLE-VALUE-BIND?
From: Erik Naggum <>
Date: 1998/03/07
Newsgroups: comp.lang.lisp
Message-ID: <>

  lately, I have been annoyed by a what I think is a limitation in the
  usability of multiple values.  in particular, I need to know whether I
  got a NIL back as a value or didn't get anything.  MULTIPLE-VALUE-BIND is
  insufficient in keeping track of the number of values involed.  in my
  view, it is as much an error for a function to return too few or too many
  values as it was to pass it the wrong number of arguments -- when those
  values are actually needed.

  now I wonder -- why was MULTIPLE-VALUE-BIND defined so simplistically?
  with just a list of symbols to be bound, it sort of defeats the purpose
  of a variable number of returned values, doesn't it?

  I can obtain the desired behavior with either of these macros (except

(defmacro multiple-value-destructuring-bind (lambda-list value-form &body body)
  `(destructuring-bind ,lambda-list (multiple-value-list ,value-form)

(defmacro multiple-value-destructuring-bind (lambda-list value-form &body body)
  `(multiple-value-call (lambda ,lambda-list ,@body) ,value-form))

  these are fairly expensive when the function receiving multiple values
  from some other function _already_ knows how many values it receives and
  could signal an error when the number doesn't match expectations.

  is there a better way to check the number of returned values than with
  MULTIPLE-VALUE-CALL, or is that the only special operator of consequence?

  God grant me serenity to accept the code I cannot change,
  courage to change the code I can, and wisdom to know the difference.