assocs: 50% faster zip.
parent
40e79d4b56
commit
664908c78f
|
@ -182,7 +182,7 @@ M: assoc value-at* swap [ = nip ] curry assoc-find nip ;
|
||||||
[ ?push ] change-at ;
|
[ ?push ] change-at ;
|
||||||
|
|
||||||
: zip ( keys values -- alist )
|
: zip ( keys values -- alist )
|
||||||
2array flip ; inline
|
[ 2array ] { } 2map-as ; inline
|
||||||
|
|
||||||
: unzip ( assoc -- keys values )
|
: unzip ( assoc -- keys values )
|
||||||
dup assoc-empty? [ drop { } { } ] [ >alist flip first2 ] if ;
|
dup assoc-empty? [ drop { } { } ] [ >alist flip first2 ] if ;
|
||||||
|
|
Loading…
Reference in New Issue