guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: early termination for `map'


From: Ludovic Courtès
Subject: Re: early termination for `map'
Date: Thu, 05 May 2011 22:21:27 +0200
User-agent: Gnus/5.110017 (No Gnus v0.17) Emacs/24.0.50 (gnu/linux)

Andy Wingo <address@hidden> writes:

> On Thu 05 May 2011 18:26, address@hidden (Ludovic Courtès) writes:
>
>> Andy Wingo <address@hidden> writes:
>>
>>> If you call `map' or `for-each' with more than one list, our versions of
>>> these operators will detect if the lists are of unequal length, and
>>> throw an error in that case.
>>>
>>> However, SRFI-1 has long provided an extension to this, to allow for
>>> early termination when any of the lists runs out.  R6RS adopted this,
>>> and it looks like R7RS will ratify that.
>>>
>>> So perhaps it's time for us to change as well.
>>
>> To change the default ‘map’ & ‘for-each’ to do like SRFI-1’s, right?
>
> Yeah, that was the proposal; but the argument is a bit weaker, now that
> I found that the R6RS did not go with this change.  So I don't really
> know.

Oh, OK.

> The reason I was thinking of doing this is because it turns out to help
> performance to have map in scheme, at this point; or at least not hurt
> it, and things will get better when we grow an optimizer.

Yes, and I think we can keep rewriting SRFI-1 in Scheme, even in 2.0.

> So I implemented map in Scheme, with circularity detection and all, only
> to find strange errors in the ecmascript compiler (!).  Turns out those
> errors happened when loading goops, because it tried to extend a
> primitive generic, but map wasn't a primitive any more, and instead of
> failing nicely it corrupted memory.

Ooh, interesting.  :-)

Thanks,
Ludo’.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]