mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-08-14 02:34:12 +02:00
refactor
This commit is contained in:
@@ -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),
|
||||
|
Reference in New Issue
Block a user