A place to add some missing filter functions: filterfirst, filtersingle, filterlast, etc.
Author bradcarman
1 Star
Updated Last
8 Months Ago
Started In
October 2022


Build Status Coverage

This package provides some simple functions I often find I would like to have in the Julia language, similar to the find functions (i.e. findfirst, findlast, etc.), which return the object rather than the index. This also includes filtersingle which provides the same functionality as c# Enumerable.Single method.

For example:

    struct Person

    brad = Person(1, "Brad")
    julia = Person(1, "Julia")
    audra = Person(2, "Audra")
    ellie = Person(3, "Ellie")

    people = [brad, audra, ellie, julia]

    x = filtersingle(x-> == 3, people) #returns the object `ellie`
    x = filtersingle(x-> == 1, people) #throws an exception
    x = filterfirst(x-> == 1, people) #returns `brad`

Required Packages

No packages found.

Used By Packages