1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-01-17 22:28:16 +01:00
This commit is contained in:
Justin Lin 2022-03-11 23:01:34 +08:00
parent 8a528e2e2b
commit c76766f5b4

View File

@ -1,8 +1,12 @@
function _greaterThan(elem1, elem2, i) =
i >= 0 && (
elem1[i] > elem2[i] || (elem1[i] == elem2[i] && _greaterThan(elem1, elem2, i - 1))
function greaterThan(elem1, elem2) =
let(
leng = len(elem1),
lt = [for(i = leng - 1; i > -1 && elem1[i] == elem2[i]; i = i - 1) i],
leng_lt = len(lt)
)
leng_lt < leng && (
let(i = leng_lt == 0 ? leng - 1 : lt[leng_lt - 1] - 1)
elem1[i] > elem2[i]
);
function greaterThan(elem1, elem2) = _greaterThan(elem1, elem2, len(elem1) - 1);
function lessThan(elem1, elem2) = !greaterThan(elem1, elem2) && elem1 != elem2;