Search code examples
common-lisp

Mutiple value bind in do loop in Common Lisp


How do you bind multiple values returned from a function, inside a do loop? The following is obviously very wrong, but is something like this possible?

(do (((x y z) (3-val-fn) (3-val-fn)))
    ((equal y 'some-val) y)
    (values x y z))

Or maybe there is a way to do this using multiple-value-bind?


Solution

  • How about?:

    (loop for (x y z) = (multiple-value-list (3-val-fn))
     ...etc)
    

    I'd offer more but cannot understand the do-loop.