[Issue 4492] New: Version of take() which takes from the back of a range

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Jul 21 16:41:08 PDT 2010


http://d.puremagic.com/issues/show_bug.cgi?id=4492

           Summary: Version of take() which takes from the back of a range
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Phobos
        AssignedTo: nobody at puremagic.com
        ReportedBy: jmdavisProg at gmail.com


--- Comment #0 from Jonathan M Davis <jmdavisProg at gmail.com> 2010-07-21 16:41:01 PDT ---
Most of the functions that we have in phobos at this point seem to deal with
the front of a range rather than the back. Naturally, for a lot of stuff,
that's exactly what you want, and there _are_ ranges which don't have a back,
but for some functions, it would be nice to have a corresponding function which
acts on the back of a range. The one which immediately comes to mind is take().
There's no way to take the back n elements of a range.

There are ways to get more or less the same thing - you can copy the range and
then pop off elements from the front - but there are situations where taking
from the back of a range would be useful. So, I suggest that std.range have a
function named takeBack() - or something similar - which does the same thing as
take() except that it takes from the back of the range rather than the front.

Now, there may be reasons which I haven't thought of why this wouldn't work
very well (unlike take(), it obviously wouldn't work with infinite ranges), but
I would think that it would be useful enough to at least look into adding it.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list