Re: Number of return values of topological-sort
Dr. Arne Babenhauserheide 01 Jul 2024 19:33 UTC
Shiro Kawai <xxxxxx@gmail.com> writes:
> On Sun, Jun 30, 2024 at 11:06 PM Maxime Devos <xxxxxx@telenet.be> wrote:
>
> Optional return values work in Scheme too (e.g. consider call-with-values + case-lambda, ignore values you are not interested in). I
>
> The issue is that if the API allows variable number of return values, you always need to handle it
> in the receiving side.
In all implementations I use, you can always ignore all values except
for the first by just using the return. Do you know ones that treat
multiple-values return differently?
(define deps (topological-sort ...)) ;; gets the first value
You have to explicitly request multiple values to see values two and
three.
(let-values (((res msg info) (topological-sort ...)))) ;; three values
That’s why I now changed the documentation to match the implementation:
always return three values.
Best wishes,
Arne
--
Unpolitisch sein
heißt politisch sein,
ohne es zu merken.
draketo.de