Since `assoc-collapse` uses a clone of the first assoc in the input sequence as
basis for the resulting assoc, this was failing when the first element was `f`.
Change behavior to return a hashtable instead, since this is the
default behavior for `f new-assoc` as well.
H{ { 3 30 } { 4 40 } } 3array
[ min ] assoc-collapse
] unit-test
+
+{
+ H{ { 2 22 } { 3 30 } { 4 40 } }
+} [
+ f
+ H{ { 2 22 } { 3 33 } }
+ H{ { 3 30 } { 4 40 } } 3array
+ [ min ] assoc-collapse
+] unit-test
: assoc-collapse ( seq quot: ( value1 value2 -- new-value ) -- assoc )
over empty?
[ 2drop f ]
- [ [ unclip-slice clone ] [ [ assoc-merge! ] curry ] bi* reduce ] if ; inline
+ [ [ unclip-slice H{ } or clone ] [ [ assoc-merge! ] curry ] bi* reduce ] if ; inline
GENERIC: delete-value-at ( value assoc -- )