From ed01eebf161a180c412babe19043bad3aef2be83 Mon Sep 17 00:00:00 2001 From: Justin Lin Date: Sat, 12 Mar 2022 16:30:01 +0800 Subject: [PATCH] refactor --- src/util/_impl/_dedup_impl.scad | 2 +- src/util/_impl/_shuffle_impl.scad | 2 +- src/util/map/_impl/_hashmap_impl.scad | 2 +- src/util/set/_impl/_hashset_impl.scad | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/util/_impl/_dedup_impl.scad b/src/util/_impl/_dedup_impl.scad index 3c2e62b5..59834e88 100644 --- a/src/util/_impl/_dedup_impl.scad +++ b/src/util/_impl/_dedup_impl.scad @@ -10,7 +10,7 @@ function _dedup(elems, leng, buckets, eq, hash, bucket_numbers) = n_buckets ] ) - _dedup_add(n_buckets_lt[len(n_buckets_lt) - 1], [end, elems[end]], eq, hash, bucket_numbers); + _dedup_add(n_buckets_lt[end - 1], [end, elems[end]], eq, hash, bucket_numbers); function _dedup_add(buckets, i_elem, eq, hash, bucket_numbers) = diff --git a/src/util/_impl/_shuffle_impl.scad b/src/util/_impl/_shuffle_impl.scad index 4f7101ec..6f44edd9 100644 --- a/src/util/_impl/_shuffle_impl.scad +++ b/src/util/_impl/_shuffle_impl.scad @@ -4,4 +4,4 @@ function _shuffle(lt, indices, leng) = let(end = len(lt) - 1) end == 0 ? lt : let(cum = [for(i = 0, s = swap(lt, i, indices[i]); i < end; i = i + 1, s = swap(s, i, indices[i])) s]) - swap(cum[len(cum) - 1], end, indices[end]); \ No newline at end of file + swap(cum[end - 1], end, indices[end]); \ No newline at end of file diff --git a/src/util/map/_impl/_hashmap_impl.scad b/src/util/map/_impl/_hashmap_impl.scad index f35854a7..2c288384 100644 --- a/src/util/map/_impl/_hashmap_impl.scad +++ b/src/util/map/_impl/_hashmap_impl.scad @@ -10,4 +10,4 @@ function _hashmap(kv_lt, leng, buckets, b_numbers, eq, hash) = n_buckets ] ) - _hashmap_put(n_buckets_lt[len(n_buckets_lt) - 1], b_numbers, kv_lt[end][0], kv_lt[end][1], eq, hash); \ No newline at end of file + _hashmap_put(n_buckets_lt[end - 1], b_numbers, kv_lt[end][0], kv_lt[end][1], eq, hash); \ No newline at end of file diff --git a/src/util/set/_impl/_hashset_impl.scad b/src/util/set/_impl/_hashset_impl.scad index c1dd357c..70a60373 100644 --- a/src/util/set/_impl/_hashset_impl.scad +++ b/src/util/set/_impl/_hashset_impl.scad @@ -10,6 +10,6 @@ function _hashset(lt, leng, buckets, b_numbers, eq, hash) = n_buckets ] ) - _hashset_add(n_buckets_lt[len(n_buckets_lt) - 1], b_numbers, lt[end], eq, hash); + _hashset_add(n_buckets_lt[end - 1], b_numbers, lt[end], eq, hash);