1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-08-19 04:51:26 +02:00

don't dedup when leng < 2

This commit is contained in:
Justin Lin
2021-03-05 22:39:25 +08:00
parent 13fd8c6d38
commit 2a5f39d4c2

View File

@@ -13,9 +13,9 @@ use <_impl/_dedup_impl.scad>;
use <sort.scad>;
function dedup(lt, eq = function(e1, e2) e1 == e2, hash = function(e) _str_hash(e)) =
lt == [] ? [] :
let(
leng_lt = len(lt),
let(leng_lt = len(lt))
leng_lt < 2 ? lt :
let(
bucket_numbers = ceil(sqrt(leng_lt)),
buckets = [for(i = [0:bucket_numbers - 1]) []],
deduped = _dedup(lt, leng_lt, buckets, eq, hash, bucket_numbers),