[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: final issue -- partial examination of dotted lists
I already voted for 2., but I still want to add some comments:
The part of the question is, basically, whether (NULL-LIST? <atom>)
is allowed to return in a conforming implementation or has to
"signal an error" (in RnRS terms). I do not think that forcing
error detection is always a good thing. In Scheme, (car 5)
doesn't have to *signal* an error, and on some systems under
certain compiler options it may indeed crash the program
(but performance benefits of unchecked car might be significant).
The same system may offer special debug mode that sacrifices
speed for early error detection. And "early" may mean that
things like (find even? '(1 2 3 . d)), (map 5 '()) and
(length <a circular list>) are recognized as errors.
And this is good because (memq x '(1 2 3 . d)) is
an error no matter what happens to be the current
value of x (it may be a part of the user input).
If all such situations are left <unspecified>, both
strategies can be implemented and both implementations
will be conforming. There could be different SRFIs
giving exact specification for these situations
(MZScheme's "primitive exceptions" etc.) and
some implementations may choose to support
them (primitive exceptions are convenient in large
systems and if the program and the development
environment share address space), but I believe this
is outside the scope of the List library SRFI.
>The related issue for them is: are longer arguments allowed to be improper?
> append-map append-map!
> map filter-map map-in-order map!
> fold fold-right pair-fold pair-fold-right
My opinion is "no", and I would also specify that procedure arguments
should be procedures of the required arity even if there is no need
to call it in some situations:
(map 5 '()) => <unspecified>