assocs: Add assoc-union-as. Use assoc-reject-like.
parent
4eadd4cbe0
commit
9ee109ae50
|
@ -169,7 +169,7 @@ SYMBOL: event-stream-callbacks
|
||||||
|
|
||||||
[
|
[
|
||||||
event-stream-callbacks
|
event-stream-callbacks
|
||||||
[ [ drop expired? ] assoc-reject H{ } assoc-like ] change-global
|
[ [ drop expired? ] H{ } assoc-reject-as ] change-global
|
||||||
] "core-foundation" add-startup-hook
|
] "core-foundation" add-startup-hook
|
||||||
|
|
||||||
: add-event-source-callback ( quot -- id )
|
: add-event-source-callback ( quot -- id )
|
||||||
|
|
|
@ -155,10 +155,13 @@ M: assoc values [ nip ] { } assoc>map ;
|
||||||
: assoc-union! ( assoc1 assoc2 -- assoc1 )
|
: assoc-union! ( assoc1 assoc2 -- assoc1 )
|
||||||
over [ set-at ] with-assoc assoc-each ;
|
over [ set-at ] with-assoc assoc-each ;
|
||||||
|
|
||||||
: assoc-union ( assoc1 assoc2 -- union )
|
: assoc-union-as ( assoc1 assoc2 exemplar -- union )
|
||||||
[ [ [ assoc-size ] bi@ + ] [ drop ] 2bi new-assoc ] 2keep
|
[ [ [ assoc-size ] bi@ + ] dip new-assoc ] 3keep drop
|
||||||
[ assoc-union! ] bi@ ;
|
[ assoc-union! ] bi@ ;
|
||||||
|
|
||||||
|
: assoc-union ( assoc1 assoc2 -- union )
|
||||||
|
over assoc-union-as ;
|
||||||
|
|
||||||
: assoc-combine ( seq -- union )
|
: assoc-combine ( seq -- union )
|
||||||
H{ } clone [ assoc-union! ] reduce ;
|
H{ } clone [ assoc-union! ] reduce ;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue