[plt-scheme] How do I convert (values ...) to something I can do something with?

From: Tony Garnock-Jones (tonyg at lshift.net)
Date: Wed Mar 10 20:08:14 EST 2010

Todd O'Bryan wrote:
> Stylistically, is one better/more idiomatic than the other? I thought
> about returning a list, but I have this aversion to complex nested
> structures that aren't self-descriptive.

There's always the third option: explicit continuation-passing. I use
this style a lot, preferring it to both (values) and (list) almost
always, and over records occasionally.

I think the combination of multiple-values and control over, um, control
is really nice:

  (define (find-something haystack needle-spec k-found k-notfound)
      ... (k-found needle something anotherthing)
      ... (k-notfound)

  (find-something my-haystack my-needle-spec
    (lambda (a b c) ...)
    (lambda () (error "oh dear")))

However, (you (do (end (up (nesting (continuations (fairly (deeply


Posted on the users mailing list.