1
0
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:
Justin Lin
2021-03-05 08:59:37 +08:00
parent 7230541091
commit 210e103791

5
src/util/find_index.scad Normal file
View 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);