mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-08-20 05:21:38 +02:00
add lo, hi params
This commit is contained in:
@@ -10,10 +10,10 @@
|
|||||||
|
|
||||||
use <_impl/_binary_search_impl.scad>;
|
use <_impl/_binary_search_impl.scad>;
|
||||||
|
|
||||||
function binary_search(sorted, target) =
|
function binary_search(sorted, target, lo = 0, hi = undef) =
|
||||||
_binary_search_impl(
|
_binary_search_impl(
|
||||||
sorted,
|
sorted,
|
||||||
is_function(target) ? target : function(elem) elem == target ? 0 : elem > target ? 1 : -1,
|
is_function(target) ? target : function(elem) elem == target ? 0 : elem > target ? 1 : -1,
|
||||||
0,
|
lo,
|
||||||
len(sorted) - 1
|
is_undef(hi) ? len(sorted) - 1 : hi
|
||||||
);
|
);
|
Reference in New Issue
Block a user