[r6rs-discuss] "Unspecified"
Sam Tobin-Hochstadt
samth at ccs.neu.edu
Mon Oct 2 09:46:29 EDT 2006
On Mon, 2006-10-02 at 06:38 -0700, Per Bothner wrote:
> Sam Tobin-Hochstadt wrote:
> > Then we would be unable to use `vector-set!' in many contexts that
> > require a value, such as the following refactoring:
> >
> > (for-each (lambda (x) (vector-set! v x)) indexes)
> >
> > -->
> >
> > (for-each/logging (lambda (x) (vector-set! v x)) indexes)
> >
> > where:
> >
> > (define (for-each/logging f l)
> > (for-each (lambda (v) (display v) (newline) (f v)) l))
> >
> > Now we have an error if `vector-set!' returns no values.
>
> I'm not seeing this. It looks like the continuation and
> return value behavior of for-each/logging is the same as for-each.
You are correct. My intention was to write the following:
(define (for-each/logging f l)
(for-each (lambda (v) (let ([w (f v)]) (display w) (newline) w)) l))
which has the problem I was attempting to point out.
Thanks for the correction,
sam th
More information about the r6rs-discuss
mailing list