1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-08-01 04:20:27 +02:00
This commit is contained in:
Justin Lin
2021-03-07 09:33:53 +08:00
parent 9da95c39bc
commit 78a53df419
2 changed files with 15 additions and 4 deletions

View File

@@ -0,0 +1,3 @@
function _find_index(lt, test, leng, i = 0) =
i == leng ? -1 :
test(lt[i]) ? i : _find_index(lt, test, leng, i + 1);

View File

@@ -1,5 +1,13 @@
function find_index(lt, test) = _find_index(lt, test, len(lt));
/**
* find_index.scad
*
* @copyright Justin Lin, 2021
* @license https://opensource.org/licenses/lgpl-3.0.html
*
* @see https://openhome.cc/eGossip/OpenSCAD/lib3x-find_index.html
*
**/
function _find_index(lt, test, leng, i = 0) =
i == leng ? -1 :
test(lt[i]) ? i : _find_index(lt, test, leng, i + 1);
use <_impl/_find_index_impl.scad>;
function find_index(lt, test) = _find_index(lt, test, len(lt));