mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-08-20 21:41:41 +02:00
refactor
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
function greaterThan(elem1, elem2) =
|
||||
let(
|
||||
leng = len(elem1),
|
||||
lt = [for(i = leng - 1; i > -1 && elem1[i] == elem2[i]; i = i - 1) i],
|
||||
lt = [for(i = leng - 1; i > -1 && elem1[i] == elem2[i]; i = i - 1) undef],
|
||||
leng_lt = len(lt)
|
||||
)
|
||||
leng_lt < leng && (
|
||||
let(i = leng_lt == 0 ? leng - 1 : lt[leng_lt - 1] - 1)
|
||||
let(i = leng_lt == 0 ? leng - 1 : leng - leng_lt - 1)
|
||||
elem1[i] > elem2[i]
|
||||
);
|
||||
|
||||
|
@@ -10,4 +10,4 @@
|
||||
|
||||
function every(lt, test) =
|
||||
let(leng = len(lt))
|
||||
len([for(i = 0; i < leng && test(lt[i]); i = i + 1) 0]) == leng;
|
||||
len([for(i = 0; i < leng && test(lt[i]); i = i + 1) undef]) == leng;
|
@@ -11,7 +11,7 @@
|
||||
function find_index(lt, test) =
|
||||
let(
|
||||
leng = len(lt),
|
||||
indices = [for(i = 0; i < leng && !test(lt[i]); i = i + 1) i],
|
||||
indices = [for(i = 0; i < leng && !test(lt[i]); i = i + 1) undef],
|
||||
leng_indices = len(indices)
|
||||
)
|
||||
leng_indices == leng ? -1 : leng_indices;
|
@@ -10,4 +10,4 @@
|
||||
|
||||
function some(lt, test) =
|
||||
let(leng = len(lt))
|
||||
len([for(i = 0; i < leng && !test(lt[i]); i = i + 1) 0]) < leng;
|
||||
len([for(i = 0; i < leng && !test(lt[i]); i = i + 1) undef]) < leng;
|
Reference in New Issue
Block a user