mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-08-10 16:54:23 +02:00
refactor
This commit is contained in:
@@ -1,3 +0,0 @@
|
||||
function _every(lt, test, leng, i = 0) =
|
||||
i == leng ? true :
|
||||
!test(lt[i]) ? false : _every(lt, test, leng, i + 1);
|
@@ -1,3 +0,0 @@
|
||||
function _find_index(lt, test, leng, i = 0) =
|
||||
i == leng ? -1 :
|
||||
test(lt[i]) ? i : _find_index(lt, test, leng, i + 1);
|
@@ -1,3 +0,0 @@
|
||||
function _some(lt, test, leng, i = 0) =
|
||||
i == leng ? false :
|
||||
test(lt[i]) ? true : _some(lt, test, leng, i + 1);
|
@@ -8,6 +8,6 @@
|
||||
*
|
||||
**/
|
||||
|
||||
use <_impl/_every.scad>;
|
||||
|
||||
function every(lt, test) = _every(lt, test, len(lt));
|
||||
function every(lt, test) =
|
||||
let(leng = len(lt))
|
||||
len([for(i = 0; i < leng && test(lt[i]); i = i + 1) 0]) == leng;
|
@@ -8,6 +8,10 @@
|
||||
*
|
||||
**/
|
||||
|
||||
use <_impl/_find_index_impl.scad>;
|
||||
|
||||
function find_index(lt, test) = _find_index(lt, test, len(lt));
|
||||
function find_index(lt, test) =
|
||||
let(
|
||||
leng = len(lt),
|
||||
indices = [for(i = 0; i < leng && !test(lt[i]); i = i + 1) i],
|
||||
leng_indices = len(indices)
|
||||
)
|
||||
leng_indices == leng ? -1 : leng_indices;
|
@@ -8,6 +8,6 @@
|
||||
*
|
||||
**/
|
||||
|
||||
use <_impl/_some.scad>;
|
||||
|
||||
function some(lt, test) = _some(lt, test, len(lt));
|
||||
function some(lt, test) =
|
||||
let(leng = len(lt))
|
||||
len([for(i = 0; i < leng && !test(lt[i]); i = i + 1) 0]) < leng;
|
Reference in New Issue
Block a user