handful and interval

Jonathan M Davis jmdavisProg at gmx.com
Sun Sep 2 16:45:17 PDT 2012


On Monday, September 03, 2012 01:37:19 Andrei Alexandrescu wrote:
> On 9/2/12 7:31 PM, Timon Gehr wrote:
> > On 09/02/2012 06:45 PM, Andrei Alexandrescu wrote:
> >> On 9/2/12 6:44 PM, Andrei Alexandrescu wrote:
> >> [snip]
> >> 
> >> The remaining question is where to put among and between. std.functional?
> >> 
> >> Andrei
> > 
> > They are not combinators. std.algorithm.
> 
> I'd argue they aren't quite algorithms either...

Well, from the looks of it, handful (or among or whatever you want to call it) 
is basically a functor for canFind (just with in instead of parens). So, it's 
an algorithm that's been thrown into a struct rather than kept as a separate 
function - kind of like map or other lazy, range-based functions except that 
it's using in instead of the range API. So, I think that it fits in 
std.algorithm reasonably well, but it _is_ also a bit of an odd fit. I think 
that the problem is that you're essentially introducing a new idiom, and it 
doesn't quite fit anywhere in what we have.

- Jonathan M Davis


More information about the Digitalmars-d mailing list