[r6rs-discuss] "Unspecified"

From: Sam Tobin-Hochstadt <samth>
Date: Mon Oct 2 09:46:36 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
Received on Mon Oct 02 2006 - 09:46:29 UTC

This archive was generated by hypermail 2.3.0 : Wed Oct 23 2024 - 09:15:00 UTC