bool find1(int[] haystack, int needle)
{
    foreach (v; haystack)
    {
        if (v == needle)
        {
            return true;
        }
    }

    return false;
}

int[] find2(int[] haystack, int needle)
{
    while (haystack.length > 0 && haystack[0] != needle)
    {
        haystack = haystack[1 .. $];
    }

    return haystack;
}

unittest
{
    int[] a = [];
    assert(find2(a, 5) == []);
    a = [ 1, 2, 3 ];
    assert(find2(a, 0) == []);
    assert(find2(a, 1).length == 3);
    assert(find2(a, 2).length == 2);
    assert(a[0 .. $ - find2(a, 3).length] == [ 1, 2 ]);
}
