mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-08-18 20:41:18 +02:00
add find_index
This commit is contained in:
5
src/util/find_index.scad
Normal file
5
src/util/find_index.scad
Normal file
@@ -0,0 +1,5 @@
|
||||
function find_index(lt, test) = _find_index(lt, test, len(lt));
|
||||
|
||||
function _find_index(lt, test, leng, i = 0) =
|
||||
i == leng ? -1 :
|
||||
test(lt[i]) ? i : _find_index(lt, test, leng, i + 1);
|
Reference in New Issue
Block a user