Skip to content

Add filter function #243

@jmh530

Description

@jmh530

I don't see a way to do the following (easily) without resorting to phobos

import mir.ndslice.slice: sliced;
import mir.math.stat: mean;
import std.algorithm: filter;

void main() {
    auto x = [0.0, 1, 2, 3, 4, 5, 6].sliced;
    auto y = x.filter!(a => a < 3).mean;
    assert(y == 1);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions