From 671aac9d55805739887f31cd6f2837523a07a6f1 Mon Sep 17 00:00:00 2001 From: Justin Lin Date: Fri, 29 Apr 2022 11:06:35 +0800 Subject: [PATCH] refactor --- src/util/sorted.scad | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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