diff --git a/src/util/sorted.scad b/src/util/sorted.scad index 85231b49..13e55b3a 100644 --- a/src/util/sorted.scad +++ b/src/util/sorted.scad @@ -11,6 +11,7 @@ use <_impl/_sorted_impl.scad>; function sorted(lt, cmp = undef, key = undef) = - !is_undef(cmp) ? _sorted_cmp(lt, cmp) : - !is_undef(key) ? _sorted_key(lt, key) : - _sorted_default(lt); \ No newline at end of file + let(is_cmp_undef = is_undef(cmp)) + is_cmp_undef && is_undef(key) ? _sorted_default(lt) : + is_cmp_undef ? _sorted_key(lt, key) : + _sorted_cmp(lt, cmp); \ No newline at end of file