JanetDocsSourcePlaygroundI'm feeling luckyCommunityGitHub sign in

spork/misc/binary-search

spork


    macro
    /usr/local/lib/janet/spork/misc.janet on line 473, column 1

    (binary-search x arr &opt <?)

    Returns the index of `x` in a sorted array or tuple or the index of 
    the next item if `x` is not present. This is the correct insert 
    index for `x` within `arr`. If a `<?` comparator is given, the 
    search uses that to compare elements, otherwise uses `<`.


0 examplesSign in to add an example
Loading...