[racket-dev] take, drop, split-at, etc -- and argument order, again
A few minutes ago, Eli Barzilay wrote:
>
> Here's why I think it might be useless:
>
> For just `takef-right', it's possible to do something smart that
> scans the list in order, keeping a pointer to the beginning of
> the "current good block". This avoids a double scan *but* the
> payment is in applying the predicate on all emlements. There
> might be a point in that in some cases, but probably in most
> cases it's best to apply it in reverse order, get the index, then
> do the usual thing.
Clarify this: the last conclusion is because in many cases the
applying the predicate on all items could be more expensive that the
allocation needed for a reverse copy.
--
((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay:
http://barzilay.org/ Maze is Life!