Login
You're viewing the techdon.dev public feed.
  • Oct 27, 2026, 12:52 PM

    Am I being dumb or do deconstructor procedures in a curried language, or any multiple value procedures, always have to be in continuation-passing style?

    In Scheme we have multiple value return with the explicit rationale that it makes procedure call and return isomorphic (which is concretely visible in the fundamental call-with-values procedure, which passes the return values of one procedure call to the arguments of another).

    So the constructor of a pair has the type (α, β) → γ, while the deconstructor has type γ → (α, β). (These are the standard cons procedure and the car+cdr procedure from SRFI 1, respectively.)

    If functions are curried, you in theory get that isomorphism by having everything take and return 1 value instead of taking and returning n values. Multiple value calls are, essentially, simulated. But how does that work in practice for simulating multiple value return?

    The curried equivalent to the above is a constructor of type α → β → γ, but the deconstructor as far as I can tell has to have type γ → (α → β → κ) → κ where κ is the return type of a caller-provided continuation function?

    Is there any way to avoid the explicit continuation?

    💬 0🔄 2⭐ 1