]> gitweb.factorcode.org Git - factor.git/blobdiff - core/sequences/sequences.factor
assocs: move with-assoc back to assocs
[factor.git] / core / sequences / sequences.factor
index 352ba460073202d8c6b176b3072027ce2c978ae6..7761b49bb7115459ec32d3e9a7d544c33a09f9cb 100644 (file)
@@ -724,11 +724,8 @@ PRIVATE>
 : last-index-from ( obj i seq -- n )
     rot [ = ] curry find-last-from drop ;
 
-: with-assoc ( assoc quot: ( ..a value key assoc -- ..b ) -- quot: ( ..a key value -- ..b ) )
-    curry [ swap ] prepose ; inline
-
 : indices ( obj seq -- indices )
-    swap [ = ] with-assoc V{ } clone [
+    swap [ = ] curry [ swap ] prepose V{ } clone [
         [ push ] curry [ [ drop ] if ] curry compose each-index
     ] keep ;
 
@@ -1179,7 +1176,7 @@ M: repetition sum [ elt>> ] [ length>> ] bi * ; inline
 : supremum ( seq -- elt ) [ ] [ max ] map-reduce ;
 
 : map-sum ( ... seq quot: ( ... elt -- ... n ) -- ... n )
-    [ 0 ] 2dip [ dip + ] with-assoc each ; inline
+    [ 0 ] 2dip [ dip + ] curry [ swap ] prepose each ; inline
 
 : count ( ... seq quot: ( ... elt -- ... ? ) -- ... n )
     [ 1 0 ? ] compose map-sum ; inline