[plt-scheme] How do I convert (values ...) to something I can do something with?
On Thu, Mar 11, 2010 at 02:08:14PM +1300, Tony Garnock-Jones wrote:
> 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)
> (cond
> ... (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
> (sometimes))))))))).
Which is why I'm getting on my old hobby-horse and somplaining again
about Lisp's bracket syntax. It's really useful to have a symbol (I've
used '/' that indicates 'all the rest of this list is really a sublist'.
Then you could have written
> However, (you /do /end /up /nesting /continuations /fairly /deeply
> /sometimes).
-- hendrik