Sort of a philosophy question:
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?
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?
~garethw