| To: | kaelin@bridge.com (Kaelin Colclasure) |
|---|---|
| Subject: | Re: ??? call-with-values ??? |
| From: | shriram@cs.rice.edu (Shriram Krishnamurthi) |
| Date: | Thu, 3 Nov 1994 15:37:57 -0600 (CST) |
| Cc: | scsh@martigny.ai.mit.edu |
This is the same mechanism proposed (and accepted) for R5RS. A few
examples, which I've lifted directly out of Ashley and Dybvig's paper
in LFP 94:
(define split
(lambda (ls)
(if (or (null? ls) (null? (cdr ls)))
(values ls '())
(call-with-values
(lambda () (split (cddr ls)))
(lambda (odds evens)
(values (cons (car ls) odds)
(cons (cadr ls) evens)))))))
(split '(a b c d e f))
==> (a c e)
(b d f)
(call-with-values
(lambda () 4)
(lambda (x) x))
==> 4
(call-with-values
(lambda ()
(call/cc (lambda (k) (k 2 3))))
(lambda (x y) (list x y)))
==> (2 3)
Hopefully these will help.
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | Re: FIX for make problem, Bill Sommerfeld |
|---|---|
| Next by Date: | Re: FIX for make problem, Scott Schwartz |
| Previous by Thread: | ??? call-with-values ???, Kaelin Colclasure |
| Next by Thread: | Re: ??? call-with-values ???, Kaelin Colclasure |
| Indexes: | [Date] [Thread] [Top] [All Lists] |