]> gitweb.factorcode.org Git - factor.git/commitdiff
sequences: normalize all the "?set-nth" words, probably this should be a stdlib thing.
authorJohn Benediktsson <mrjbq7@gmail.com>
Wed, 20 Feb 2013 00:52:40 +0000 (16:52 -0800)
committerJohn Benediktsson <mrjbq7@gmail.com>
Wed, 20 Feb 2013 00:52:40 +0000 (16:52 -0800)
basis/bit-sets/bit-sets.factor
basis/game/input/iokit/iokit.factor
basis/unicode/data/data.factor
extra/maze/maze.factor

index 495180c094e46d7e5fc8b76e85282e778a709cc6..e7bde4b50674eb16d573a985739653de68632340 100644 (file)
@@ -19,13 +19,18 @@ M: bit-set adjoin
     ! go in the set
     [ t ] 2dip table>> set-nth ;
 
+<PRIVATE
+
+: ?set-nth ( elt n seq -- )
+    2dup bounds-check? [ set-nth-unsafe ] [ 3drop ] if ; inline
+
+PRIVATE>
+
 M: bit-set delete
     ! This isn't allowed to throw an error if the elt wasn't
     ! in the set
     over integer? [
-        table>> 2dup bounds-check? [
-            [ f ] 2dip set-nth
-        ] [ 2drop ] if
+        [ f ] 2dip table>> ?set-nth
     ] [ 2drop ] if ;
 
 ! If you do binary set operations with a bit-set, it's expected
index 49121964e15e5ce51fe4a460a86375909e3dce6d..1112bacc95144fee65e89ae25e033966278df241 100644 (file)
@@ -177,8 +177,8 @@ CONSTANT: pov-values
 
 HINTS: record-controller { controller-state alien } ;
 
-: ?set-nth ( value nth seq -- )
-    2dup bounds-check? [ set-nth-unsafe ] [ 3drop ] if ;
+: ?set-nth ( elt n seq -- )
+    2dup bounds-check? [ set-nth-unsafe ] [ 3drop ] if ; inline
 
 : record-keyboard ( keyboard-state value -- )
     dup IOHIDValueGetElement dup keyboard-key? [
index 03fc3b98ad3856141d45a58652bb5a703a6613d8..8bf275925f2c8f98a99bf54b563e31d1ca47d58e 100644 (file)
@@ -138,8 +138,8 @@ PRIVATE>
 
 ! the maximum unicode char in the first 3 planes
 
-: ?set-nth ( val index seq -- )
-    2dup bounds-check? [ set-nth ] [ 3drop ] if ;
+: ?set-nth ( elt n seq -- )
+    2dup bounds-check? [ set-nth-unsafe ] [ 3drop ] if ; inline
 
 :: fill-ranges ( table -- table )
     name-map sort-values keys
index ecf3c49c8930d9746188a9cb61104315982d99ac..4d964af132cdb589b74cd747648cede811d6dbbe 100644 (file)
@@ -10,8 +10,12 @@ SYMBOL: visited
 
 : unvisited? ( cell -- ? ) first2 visited get ?nth ?nth ;
 
-: ?set-nth ( elt i seq -- )
-    2dup bounds-check? [ set-nth ] [ 3drop ] if ;
+<PRIVATE
+
+: ?set-nth ( elt n seq -- )
+    2dup bounds-check? [ set-nth-unsafe ] [ 3drop ] if ; inline
+
+PRIVATE>
 
 : visit ( cell -- ) f swap first2 visited get ?nth ?set-nth ;