When I first learned of multiple return values, I thought it sounded like a great idea, but in most cases where I tried to use them, I found them ultimately awkward and less convenient than simply returning the values I need in a list or cons pair and letting the caller sort them out.

I'm curious if anyone could suggest a kind of pattern than might indicate where multiple return values might be useful.

The few places that I can name off the top of my head where CL functions return multiple values (floor, get-hash), seem to be cases where the work to produce one value essentially produces a second value "for free". Is that a good litmus test? Are there reasons one might return multiple values for another reason? Pure efficiency, maybe?

Maybe they are awkward, but they make a companion part to multiple arguments on the call stack and I think they should be used in cases like a polar2rectangular function, although the treating with them is dirty, but we have macros to wrap/fix that.Yes, I've missed better destructuring of multiple values few times and rahter I've used a list too.

Thanks as always for the replies. I do understand the difference between the two, sylwester - my question was about deciding which is more appropriate in a given context.

Goheeca's example of polar2rect is an interesting example. My inclination would have be to use a cons here, since the x and y coords would often travel around together, returned from one function, passed into the arguments of the next, but maybe along with others. Multiple return-values seem like they might get a bit awkward here.

I take your point, but it sidesteps my question. It wasn't whether a list is a great representation of structured data; it was when to use any composite data structure - list, struct, object, anything - versus multiple values. It is a deeper question than mere selection of an appropriate single type.

The first merely requires getting tab-completion activated in your editor of choice. I'm not an 'only emacs will do' zealot, but I haven't gotten further than doing 1-line edits in vim, so I can't help you with that.

The second can be a grey area, I personally still wouldn't return a composite type for less than 7-10 results (unless a composite type was called for).

The third isn't a reason not to use multiple values, it's a reason not to use MULTIPLE-VALUE-BIND (directly). A 5-minute macro to unify the syntax:

This handles LET*, MULTIPLE-VALUE-BIND, and DESTRUCTURING-BIND, and I would hope you could easily see how to extend it to others. There's a number of things that you might want to customise about this macro, or you could find a library with a different macro (I know that there's at least one, but I can't remember where I saw it).

The important (and delightful) thing about lisps is that, unlike blubs, you are only as far away from a convenient solution as your ingenuity and imagination!

Thanks for DESTRUCTURING-BIND bit. It actually tipped me from multiple values to be somewhat indifferent towards it all. With DESTRUCTURING-BIND and MULTIPLE-VALUE-LIST returning values and list is pretty much two ways to do the same and the difference is performance. However you made it clear performance wasn't a key issue (as it should't be in most cases). So when indifferent should one use multiple values because it performs better=