1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-08-14 10:44:48 +02:00
This commit is contained in:
Justin Lin
2021-03-06 09:59:40 +08:00
parent 56909f0918
commit 65c7ba3ae2

View File

@@ -1,9 +1,6 @@
use <../__comm__/_str_hash.scad>;
use <../util/slice.scad>;
function _find(lt, elem, eq, leng, i = 0) =
i == leng ? -1 :
eq(lt[i], elem) ? i : _find(lt, elem, eq, leng, i + 1);
use <../util/find_index.scad>;
function hashset_del(set, elem, eq = function(e1, e2) e1 == e2, hash = function(e) _str_hash(e)) =
let(
@@ -12,7 +9,7 @@ function hashset_del(set, elem, eq = function(e1, e2) e1 == e2, hash = function(
leng = len(bucket)
)
leng == 0 ? set :
let(i = _find(bucket, elem, eq, leng))
let(i = find_index(bucket, function(e) eq(e, elem)))
i == -1 ? set :
concat(
slice(set, 0, bidx),