]> gitweb.factorcode.org Git - factor.git/commitdiff
assocs.extras: adding assoc-interleave
authorJohn Benediktsson <mrjbq7@gmail.com>
Wed, 31 May 2023 20:34:27 +0000 (13:34 -0700)
committerJohn Benediktsson <mrjbq7@gmail.com>
Wed, 31 May 2023 20:34:27 +0000 (13:34 -0700)
extra/assocs/extras/extras.factor

index 0bbc91d6eaa620a4bc64f9e2e5c790803128fc95..901797305f716ebffb1b2877cf6f4783e4eb0584 100644 (file)
@@ -343,3 +343,6 @@ PRIVATE>
 
 : collect-index-by ( ... seq quot: ( ... obj -- ... key ) -- ... assoc )
     [ H{ } clone ] 2dip collect-index-by! ; inline
+
+: assoc-interleave ( ... assoc between quot: ( ... key value -- ... ) -- ... )
+    [ >alist ] 2dip [ first2 ] prepose interleave ; inline