[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
TAKE, DROP & sharing
Oops. DROP and TAKE-RIGHT should guarantee sharing.
TAKE and DROP-RIGHT should guarantee copying (which is only
relevant if you are taking everything, or dropping nothing).
I'll change the spec.
-Olin
Date: Mon, 9 Aug 1999 15:08:00 -0400 (EDT)
From: Alan Bawden <Alan@xxxxxxxxxxx>
To: Olin Shivers <shivers@xxxxxxxxxx>
Subject: SRFI-1
I just read your final draft of SRFI-1. I only have -one- problem with
this version:
At one point you remark that you have renamed `list-tail' to be `drop'.
Then in the definition of `drop' (and `take') you say:
The returned list may share a common tail with the argument list.
The word "may" here is at odds with my reading of the R5RS description of
`list-tail' which I think is trying to say that the results of `list-tail'
WILL share a common tail with the argument list. I certainly have code
that does:
(set-car! (list-tail l i) v)
in the expectation of changing the original list. But your description of
`drop' makes me think that
(set-car! (drop l i) v)
might not do that.
I might also expect that `take-right' would be guaranteed to share with the
original list.
Hmm... Perhaps I should suggest that your proposal should include the
obvious `list-set!' procedure which alway struck me as a rather glaring
omission from the various RnRS. If I had that, it would probably eliminate
every place I've ever called `list-tail'...