]> gitweb.factorcode.org Git - factor.git/commitdiff
assocs.extras: implement zip-longest with pad-longest
authorJohn Benediktsson <mrjbq7@gmail.com>
Tue, 24 Jan 2023 20:51:23 +0000 (12:51 -0800)
committerJohn Benediktsson <mrjbq7@gmail.com>
Tue, 24 Jan 2023 21:25:51 +0000 (13:25 -0800)
extra/assocs/extras/extras.factor

index f6d18c1ba88daf1ec43f62412dc49b1d941d3bb4..fe82d26dde09ecb32d4614c1ed889f6ee369a24b 100644 (file)
@@ -1,7 +1,7 @@
 ! Copyright (C) 2012 John Benediktsson, Doug Coleman
 ! See https://factorcode.org/license.txt for BSD license
 USING: arrays assocs assocs.private kernel math math.statistics
-sequences sets ;
+sequences sequences.extras sets ;
 IN: assocs.extras
 
 : push-at-each ( value keys assoc -- )
@@ -20,7 +20,7 @@ IN: assocs.extras
     [ deep-of-but-last ] dip spin set-at ; inline
 
 : zip-longest-with ( seq1 seq2 fill -- assoc )
-    [ 2dup max-length ] dip '[ _ _ pad-tail ] bi@ zip ;
+    pad-longest zip ;
 
 : zip-longest ( seq1 seq2 -- assoc )
     f zip-longest-with ;