In Racket, values
construct multiple return values (often abbrev. as multiple values or values). Except the case where it's a single value, values cannot be passed as argument(s). Values can't be kept in a variable. Values are mostly useful when returned from a function, and when used in forms like define-values
, etc. See this section of the Racket Reference for more details.
To use the terminology from the above link, (my-func [])
is a continuation that only accepts a single value. That's why in your program, it errors with the message "expects one, got two".
What you are trying to do can be accomplished with call-with-values
:
(call-with-values (lambda () (values 1 2)) my-func)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…