[pro] Chains of multiple-value-bind...

Nick Levine ndl at ravenbrook.com
Fri Nov 26 14:32:39 UTC 2010


   From: Pascal Costanza <pc at p-cos.net>
   Date: Fri, 26 Nov 2010 14:36:57 +0100

   (defmacro multiple-value-case (&body clauses)
     (when clauses
       (destructuring-bind (first &rest rest) clauses
	 (cond ((member (first first) '(t otherwise))
		(when clauses (warn "Dead code: ~S." clauses))

Surely:

(when rest (warn "Dead code: ~S." rest))

-n

		`(progn ,@(rest first)))
	       (t (destructuring-bind ((&rest lambda-list) expression (guard) &rest body) first
		      `(multiple-value-bind ,lambda-list ,expression
			 (if ,guard (progn , at body)
			   (multiple-value-case , at rest)))))))))






More information about the pro mailing list