On Friday, May 11, 2012 16:30:22 Walter Bright wrote: > On 5/11/2012 1:20 PM, Jonathan M Davis wrote: > > That's definitely an example of something that depends on your background. > > std.algorithm.any does _exactly_ what it would do in a functional > > language. > > How intuitive an API is depends a lot on how much the person writing the > > API thinks like you. > > That is amusing. I've been writing a bunch of range/algorithm code myself > lately, and I find it's a struggle because it is simply not how I think > about code. I think in terms of C style loops, and solutions just pop out > of my fingers on the keyboard. With ranges, I have to forcibly think in a > different way, it's a lot like transitioning from walking to using a > snowboard.
Yeah. Range-based functions tend to be rather functional in nature. So, if you're used to functional languages, they're generally straightforward. But if you're _not_ used to funcitonal languages, you're likely to be more used to using loops instead of functions for a lot of stuff, and so it's gonig to be a bit disconcerting at first. Personally, I've programmed a fair bit in haskell (though not as much is imperative or OO languages such as C++ or Java), so they come quite naturally at this point. - Jonathan M Davis