Function toNumericRange

Converts a range with arbitrary element types (usually strings) to a range of reals lazily. Ignores any elements that could not be successfully converted. Useful for creating an input range that can be used with this lib out of a File without having to read the whole file into an array first. The advantages to this over just using std.algorithm.map are that it's less typing and that it ignores non-convertible elements, such as blank lines.

ToNumericRange!R toNumericRange(R) (
  R rangeIn
)
if (isInputRange!R);

If rangeIn is an inputRange, then the result of this function is an input range. Otherwise, the result is a forward range.

Note

The reason this struct doesn't have length or random access, even if this is supported by rangeIn, is because it has to be able to filter out non-convertible elements.

Examples

// Perform a T-test to see whether the mean of the data being input as text
// from stdin is different from zero.  This data might not even fit in memory
// if it were read in eagerly.

auto myRange = toNumericRange( stdin.byLine() );
TestRes result = studentsTTest(myRange);
writeln(result);