]> gitweb.factorcode.org Git - factor.git/commitdiff
Add push-at to core
authorSlava Pestov <slava@slava-pestovs-macbook-pro.local>
Fri, 13 Jun 2008 07:09:16 +0000 (02:09 -0500)
committerSlava Pestov <slava@slava-pestovs-macbook-pro.local>
Fri, 13 Jun 2008 07:09:16 +0000 (02:09 -0500)
core/assocs/assocs.factor
core/optimizer/def-use/def-use.factor
extra/assocs/lib/lib.factor
extra/gap-buffer/cursortree/cursortree.factor
extra/help/lint/lint.factor
extra/io/unix/backend/backend.factor
extra/unicode/data/data.factor
extra/xmode/rules/rules.factor

index ca49b550b0d1896d34756503429a7ed244bcddb1..c87547527884ce0c21fe1cd0b79c35b9ec4d1887 100755 (executable)
@@ -150,6 +150,9 @@ M: assoc assoc-clone-like ( assoc exemplar -- newassoc )
 : value-at ( value assoc -- key/f )
     swap [ = nip ] curry assoc-find 2drop ;
 
+: push-at ( value key assoc -- )
+    [ ?push ] change-at ;
+
 : zip ( keys values -- alist )
     2array flip ; inline
 
index a2e9f881354705c79f372b9457cbbab1e3dd7f40..d4905a171808ac44da84f2fcab7480e957023e2a 100755 (executable)
@@ -13,7 +13,7 @@ SYMBOL: def-use
     used-by empty? ;
 
 : uses-values ( node seq -- )
-    [ def-use get [ ?push ] change-at ] with each ;
+    [ def-use get push-at ] with each ;
 
 : defs-values ( seq -- )
     #! If there is no value, set it to a new empty vector,
@@ -132,5 +132,4 @@ M: #r> kill-node*
     #! degree of accuracy; the new values should be marked as
     #! having _some_ usage, so that flushing doesn't erronously
     #! flush them away.
-    nest-def-use keys
-    def-use get [ [ t swap ?push ] change-at ] curry each ;
+    nest-def-use keys def-use get [ t -rot push-at ] curry each ;
index c3e487a9fce6c598e9680b36557a66eca482ea41..1c89c1eb16c3e485d3921312b615dd1fd3ac0013 100755 (executable)
@@ -17,9 +17,6 @@ IN: assocs.lib
 : replace-at ( assoc value key -- assoc )
     >r >r dup r> 1vector r> rot set-at ;
 
-: insert-at ( value key assoc -- )
-    [ ?push ] change-at ;
-
 : peek-at* ( assoc key -- obj ? )
     swap at* dup [ >r peek r> ] when ;
 
@@ -32,7 +29,7 @@ IN: assocs.lib
 : multi-assoc-each ( assoc quot -- )
     [ with each ] curry assoc-each ; inline
 
-: insert ( value variable -- ) namespace insert-at ;
+: insert ( value variable -- ) namespace push-at ;
 
 : generate-key ( assoc -- str )
     >r 32 random-bits >hex r>
index a3a5075820f54c1dfe5ac015f0d9a1ab3b2c3fb2..4249aea2d988bc1d60fbe14ef7138e745fcc85fe 100644 (file)
@@ -1,6 +1,6 @@
 ! Copyright (C) 2007 Alex Chapman All Rights Reserved.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: assocs assocs.lib kernel gap-buffer generic trees trees.avl math
+USING: assocs kernel gap-buffer generic trees trees.avl math
 sequences quotations ;
 IN: gap-buffer.cursortree
 
@@ -21,7 +21,7 @@ TUPLE: right-cursor ;
 
 : cursor-index ( cursor -- i ) cursor-i ;
 
-: add-cursor ( cursortree cursor -- ) dup cursor-index rot insert-at ; 
+: add-cursor ( cursortree cursor -- ) dup cursor-index rot push-at ; 
 
 : remove-cursor ( cursortree cursor -- )
     tuck cursor-index swap cursortree-cursors at* [ delete ] [ 2drop ] if ;
index 00a8e287e637fb9d158b020fa6a6d2e5693af1e9..eef2463019dddd523f7094745f62c46b1461a587 100755 (executable)
@@ -114,7 +114,7 @@ M: help-error error.
     H{ } clone [
         [
             >r >r dup >link where dup
-            [ first r> at r> [ ?push ] change-at ]
+            [ first r> at r> push-at ]
             [ r> r> 2drop 2drop ]
             if
         ] 2curry each
index 67856a05703d3d7471049bbd8440fd838b8f1cc9..8e76be263292b150f30231e94307a9c6d7be5657 100755 (executable)
@@ -44,14 +44,11 @@ TUPLE: mx fd reads writes ;
 
 GENERIC: add-input-callback ( thread fd mx -- )
 
-: add-callback ( thread fd assoc -- )
-    [ ?push ] change-at ;
-
-M: mx add-input-callback reads>> add-callback ;
+M: mx add-input-callback reads>> push-at ;
 
 GENERIC: add-output-callback ( thread fd mx -- )
 
-M: mx add-output-callback writes>> add-callback ;
+M: mx add-output-callback writes>> push-at ;
 
 GENERIC: remove-input-callbacks ( fd mx -- callbacks )
 
index 8ef8658adb4514f2506ee46794c1cfe8aa5da43a..5fb769e499bfbaa7d0a2da2723622c6346aacdbd 100755 (executable)
@@ -1,7 +1,7 @@
 USING: assocs math kernel sequences io.files hashtables
 quotations splitting grouping arrays math.parser hash2 math.order
 byte-arrays words namespaces words compiler.units parser
-io.encodings.ascii values interval-maps ascii sets assocs.lib
+io.encodings.ascii values interval-maps ascii sets
 combinators.lib combinators locals math.ranges sorting ;
 IN: unicode.data
 
@@ -151,7 +151,7 @@ C: <code-point> code-point
 
 : properties>intervals ( properties -- assoc[str,interval] )
     dup values prune [ f ] H{ } map>assoc
-    [ [ insert-at ] curry assoc-each ] keep
+    [ [ push-at ] curry assoc-each ] keep
     [ <interval-set> ] assoc-map ;
 
 : load-properties ( -- assoc )
index df5580fc68466054536db189a978a439517411b4..daaeac70a4fae8ca3ec26b5526b406405d72a619 100755 (executable)
@@ -42,7 +42,7 @@ MEMO: standard-rule-set ( id -- ruleset )
     rule-set-imports push ;
 
 : inverted-index ( hashes key index -- )
-    [ swapd [ ?push ] change-at ] 2curry each ;
+    [ swapd push-at ] 2curry each ;
 
 : ?push-all ( seq1 seq2 -- seq1+seq2 )
     [