From 987bc3be5b78b88cb55c5f2eaa594654bd6a3229 Mon Sep 17 00:00:00 2001 From: Justin Lin Date: Sat, 12 Mar 2022 18:24:00 +0800 Subject: [PATCH] refactor --- src/util/_impl/_vt_default_comparator.scad | 4 ++-- src/util/every.scad | 2 +- src/util/find_index.scad | 2 +- src/util/some.scad | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/util/_impl/_vt_default_comparator.scad b/src/util/_impl/_vt_default_comparator.scad index c30a463a..a433bb17 100644 --- a/src/util/_impl/_vt_default_comparator.scad +++ b/src/util/_impl/_vt_default_comparator.scad @@ -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] ); diff --git a/src/util/every.scad b/src/util/every.scad index 95f2a37d..f7f54eb1 100644 --- a/src/util/every.scad +++ b/src/util/every.scad @@ -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; \ No newline at end of file + len([for(i = 0; i < leng && test(lt[i]); i = i + 1) undef]) == leng; \ No newline at end of file diff --git a/src/util/find_index.scad b/src/util/find_index.scad index d2ab823c..84efa26d 100644 --- a/src/util/find_index.scad +++ b/src/util/find_index.scad @@ -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; \ No newline at end of file diff --git a/src/util/some.scad b/src/util/some.scad index 2f1a4c40..a58732ae 100644 --- a/src/util/some.scad +++ b/src/util/some.scad @@ -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; \ No newline at end of file + len([for(i = 0; i < leng && !test(lt[i]); i = i + 1) undef]) < leng; \ No newline at end of file