R.filter!(..).sort!(..)
Arjan
arjan at ask.me.to
Tue Nov 28 13:57:30 UTC 2017
On Tuesday, 28 November 2017 at 13:24:09 UTC, Steven
Schveighoffer wrote:
> On 11/28/17 8:10 AM, Arjan wrote:
>> [...]
>
> The library is correctly telling you that your filtered range
> is not random access. It can't be, because it lazily applies
> the filter (that is, it filters on each element as you popFront
> them). So how can it know what the e.g. 3rd element is, if you
> haven't run any filters yet?
>
> The array version works because you are applying the filter
> completely and storing the results elsewhere in one step.
>
> -Steve
Well I would have liked an error msg something like:
isRandomAccessRange!Range for Range=.. failed! Or unable to
sort!() a lazy Range.
More information about the Digitalmars-d-learn
mailing list