[Issue 4535] std.range could have a takeWhile!pred(range) function

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Aug 14 18:45:45 PDT 2010


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


Jonathan M Davis <jmdavisProg at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jmdavisProg at gmail.com


--- Comment #2 from Jonathan M Davis <jmdavisProg at gmail.com> 2010-08-14 18:45:43 PDT ---
I'd say that it mostly does, but it's not generic enough. until() has the
concept of a sentinel, while takeWhile() is based entirely on a predicate. I'm
not quite sure how their implementations would be different, but I'd expect
takeWhile() to be at least slightly more efficient (though perhaps negligably
so) than until(). I think that it would be beneficial to have the more generic
takeWhile(); if nothing else, the intent is clearer.

Of course, truth be told, I'm not a huge fan of until() anyway. I really think
that it should be more like find() except return what's before what you're
looking for rather than starting with it like find() does.

-- 
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