]> gitweb.factorcode.org Git - factor.git/commitdiff
extra: use push-at-each
authorDoug Coleman <doug.coleman@gmail.com>
Mon, 8 Aug 2022 04:08:26 +0000 (23:08 -0500)
committerDoug Coleman <doug.coleman@gmail.com>
Mon, 8 Aug 2022 06:29:47 +0000 (01:29 -0500)
extra/assocs/extras/extras.factor
extra/lint/lint.factor
extra/sequences/abbrev/abbrev.factor

index 3425b13388831313ccdf170065096469f92594a8..98f9ebbb3eb2ebd4e1db006f58b5ace353b64e71 100644 (file)
@@ -4,6 +4,9 @@ USING: arrays assocs assocs.private kernel math math.statistics
 sequences sets ;
 IN: assocs.extras
 
+: push-at-each ( value keys assoc -- )
+    '[ _ push-at ] with each ; inline
+
 : deep-at ( assoc seq -- value/f )
     [ of ] each ; inline
 
@@ -148,7 +151,7 @@ PRIVATE>
 : expand-keys-push-at-as ( assoc exemplar -- hashtable' )
     [
         [ swap dup sequence? [ 1array ] unless ]
-        [ '[ _ push-at ] with each ]
+        [ push-at-each ]
     ] dip assoc>object ;
 
 : expand-keys-push-at ( assoc -- hashtable' )
@@ -235,9 +238,6 @@ PRIVATE>
     [ neg swap pick at+ ] assoc-each
     [ 0 > ] filter-values ;
 
-: push-at-each ( value keys assoc -- )
-    '[ _ push-at ] with each ; inline
-
 : collect-by-multi! ( ... assoc seq quot: ( ... obj -- ... key ) -- ... assoc )
     [ keep swap ] curry rot [
         [ push-at-each ] curry compose each
index 7f925fa9bee313f1a65dd8fb20fb3b8610f8e6b8..42639ce89395437d6c8bd1cdf02962debeddb017 100644 (file)
@@ -219,7 +219,7 @@ CONSTANT: trivial-defs
     [ { [ callable? ] [ ignore-def? not ] } 1&& ] deep-filter ;
 
 : (load-definitions) ( word def hash -- )
-    [ all-callables ] dip '[ _ push-at ] with each ;
+    [ all-callables ] dip push-at-each ;
 
 : load-definitions ( words -- hash )
     H{ } clone [ '[ dup def>> _ (load-definitions) ] each ] keep ;
index 8cde6f42e5efe7de0e687ed04e1c376d9c19f54b..0c5640f2edd06b809ade03aee3b120b138864826 100644 (file)
@@ -1,6 +1,6 @@
 ! Copyright (C) 2009 Maximilian Lupke.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: assocs kernel ranges sequences ;
+USING: assocs assocs.extras kernel ranges sequences ;
 IN: sequences.abbrev
 
 <PRIVATE
@@ -12,7 +12,7 @@ PRIVATE>
 
 : abbrev ( seqs -- assoc )
     H{ } clone [
-        '[ dup prefixes [ _ push-at ] with each ] each
+        swap [ dup prefixes rot push-at-each ] with each
     ] keep ;
 
 : unique-abbrev ( seqs -- assoc )