]> gitweb.factorcode.org Git - factor.git/commitdiff
exile roll and -roll to basis/shuffle and mark them deprecated
authorJoe Groff <arcata@gmail.com>
Fri, 30 Oct 2009 22:11:45 +0000 (17:11 -0500)
committerJoe Groff <arcata@gmail.com>
Fri, 30 Oct 2009 22:11:45 +0000 (17:11 -0500)
basis/bootstrap/compiler/compiler.factor
basis/compiler/tests/optimizer.factor
basis/compiler/tree/dead-code/dead-code-tests.factor
basis/shuffle/shuffle-docs.factor [new file with mode: 0644]
basis/shuffle/shuffle-tests.factor
basis/shuffle/shuffle.factor
core/kernel/kernel-docs.factor
core/kernel/kernel-tests.factor
core/kernel/kernel.factor
extra/reports/noise/noise.factor
extra/sudokus/sudokus.factor

index 4c96ed4000a638ad3bb1754eaa3f64402793941f..e401f85f6e0f685671cbf301b67550b32de1cf5d 100755 (executable)
@@ -4,7 +4,7 @@ USING: accessors cpu.architecture vocabs.loader system
 sequences namespaces parser kernel kernel.private classes
 classes.private arrays hashtables vectors classes.tuple sbufs
 hashtables.private sequences.private math classes.tuple.private
 sequences namespaces parser kernel kernel.private classes
 classes.private arrays hashtables vectors classes.tuple sbufs
 hashtables.private sequences.private math classes.tuple.private
-growable namespaces.private assocs words command-line vocabs io
+growable namespaces.private shuffle assocs words command-line vocabs io
 io.encodings.string libc splitting math.parser memory compiler.units
 math.order quotations quotations.private assocs.private ;
 FROM: compiler => enable-optimizer ;
 io.encodings.string libc splitting math.parser memory compiler.units
 math.order quotations quotations.private assocs.private ;
 FROM: compiler => enable-optimizer ;
index 3a0fada735e6674042aed635796ef8d59204e2f5..32f5750cd39fb482de9981af37d2492db18bfb2b 100644 (file)
@@ -4,7 +4,7 @@ sbufs strings tools.test vectors words sequences.private
 quotations classes classes.algebra classes.tuple.private
 continuations growable namespaces hints alien.accessors
 compiler.tree.builder compiler.tree.optimizer sequences.deep
 quotations classes classes.algebra classes.tuple.private
 continuations growable namespaces hints alien.accessors
 compiler.tree.builder compiler.tree.optimizer sequences.deep
-compiler definitions generic.single ;
+compiler definitions generic.single shuffle ;
 IN: compiler.tests.optimizer
 
 GENERIC: xyz ( obj -- obj )
 IN: compiler.tests.optimizer
 
 GENERIC: xyz ( obj -- obj )
@@ -446,4 +446,4 @@ M: object bad-dispatch-position-test* ;
 [ 1024 bignum ] [ 10 [ 1 >bignum swap >fixnum shift ] compile-call dup class ] unit-test
 
 ! Not sure if I want to fix this...
 [ 1024 bignum ] [ 10 [ 1 >bignum swap >fixnum shift ] compile-call dup class ] unit-test
 
 ! Not sure if I want to fix this...
-! [ t [ [ f ] [ 3 ] if >fixnum ] compile-call ] [ no-method? ] must-fail-with
\ No newline at end of file
+! [ t [ [ f ] [ 3 ] if >fixnum ] compile-call ] [ no-method? ] must-fail-with
index ed4df91eec0fd4304b51985f6afd22d72eaffebe..d859096e1db7c90793c4930e63cbc454b7769377 100644 (file)
@@ -6,7 +6,7 @@ compiler.tree.tuple-unboxing compiler.tree.debugger
 compiler.tree.recursive compiler.tree.normalization
 compiler.tree.checker tools.test kernel math stack-checker.state
 accessors combinators io prettyprint words sequences.deep
 compiler.tree.recursive compiler.tree.normalization
 compiler.tree.checker tools.test kernel math stack-checker.state
 accessors combinators io prettyprint words sequences.deep
-sequences.private arrays classes kernel.private ;
+sequences.private arrays classes kernel.private shuffle ;
 IN: compiler.tree.dead-code.tests
 
 : count-live-values ( quot -- n )
 IN: compiler.tree.dead-code.tests
 
 : count-live-values ( quot -- n )
diff --git a/basis/shuffle/shuffle-docs.factor b/basis/shuffle/shuffle-docs.factor
new file mode 100644 (file)
index 0000000..1539845
--- /dev/null
@@ -0,0 +1,5 @@
+USING: help.markup help.syntax ;
+IN: shuffle
+
+HELP: roll  $complex-shuffle ;
+HELP: -roll $complex-shuffle ;
index e091af2d06eed05140c14b02db1d38d48bbac411..4165efdcfdf94da344bcd50906d65bfdb04da966 100644 (file)
@@ -1,5 +1,10 @@
 USING: shuffle tools.test ;
 USING: shuffle tools.test ;
+IN: shuffle.tests
 
 [ 1 2 3 4 ] [ 3 4 1 2 2swap ] unit-test
 
 [ 4 2 3 ] [ 1 2 3 4 shuffle( a b c d -- d b c ) ] unit-test
 
 [ 1 2 3 4 ] [ 3 4 1 2 2swap ] unit-test
 
 [ 4 2 3 ] [ 1 2 3 4 shuffle( a b c d -- d b c ) ] unit-test
+
+[ 2 3 4 1 ] [ 1 2 3 4 roll ] unit-test
+[ 1 2 3 4 ] [ 2 3 4 1 -roll ] unit-test
+
index 079e81d082236dcecfb9a896b2bcacbbc5184f99..43c0b75be1cd91b38cb90af537a04eeeaee82407 100644 (file)
@@ -22,6 +22,10 @@ MACRO: shuffle-effect ( effect -- )
 SYNTAX: shuffle(
     ")" parse-effect suffix! \ shuffle-effect suffix! ;
 
 SYNTAX: shuffle(
     ")" parse-effect suffix! \ shuffle-effect suffix! ;
 
+: roll ( x y z t -- y z t x ) [ rot ] dip swap ; inline deprecated
+
+: -roll ( x y z t -- t x y z ) swap [ -rot ] dip ; inline deprecated
+
 : 2swap ( x y z t -- z t x y ) 2 2 mnswap ; inline
 
 : 4dup ( a b c d -- a b c d a b c d ) 4 ndup ; inline
 : 2swap ( x y z t -- z t x y ) 2 2 mnswap ; inline
 
 : 4dup ( a b c d -- a b c d a b c d ) 4 ndup ; inline
index b837c0a3ff4abf62053152d66b44b3989717b1a7..f7ae292630f87005a55f425b936403a79c93dcbd 100644 (file)
@@ -27,8 +27,6 @@ HELP: -rot  ( x y z -- z x y ) $complex-shuffle ;
 HELP: dupd  ( x y -- x x y )   $complex-shuffle ;
 HELP: swapd ( x y z -- y x z ) $complex-shuffle ;
 HELP: tuck  ( x y -- y x y )   $complex-shuffle ;
 HELP: dupd  ( x y -- x x y )   $complex-shuffle ;
 HELP: swapd ( x y z -- y x z ) $complex-shuffle ;
 HELP: tuck  ( x y -- y x y )   $complex-shuffle ;
-HELP: roll  $complex-shuffle ;
-HELP: -roll $complex-shuffle ;
 
 HELP: datastack ( -- ds )
 { $values { "ds" array } }
 
 HELP: datastack ( -- ds )
 { $values { "ds" array } }
@@ -280,11 +278,6 @@ HELP: 3bi
         "[ p ] [ q ] 3bi"
         "3dup p q"
     }
         "[ p ] [ q ] 3bi"
         "3dup p q"
     }
-    "If " { $snippet "[ p ]" } " and " { $snippet "[ q ]" } " have stack effect " { $snippet "( x y z -- w )" } ", then the following two lines are equivalent:"
-    { $code
-        "[ p ] [ q ] 3bi"
-        "3dup p -roll q"
-    }
     "In general, the following two lines are equivalent:"
     { $code
         "[ p ] [ q ] 3bi"
     "In general, the following two lines are equivalent:"
     { $code
         "[ p ] [ q ] 3bi"
@@ -835,8 +828,6 @@ $nl
     swapd
     rot
     -rot
     swapd
     rot
     -rot
-    roll
-    -roll
     spin
 } ;
 
     spin
 } ;
 
index 024254663ca0a28dadb1adff2183d2657c38005c..d9babb5fd7409d3663ece2b177d34c59a53c0fdc 100644 (file)
@@ -48,9 +48,6 @@ IN: kernel.tests
 
 [ -7 <byte-array> ] must-fail
 
 
 [ -7 <byte-array> ] must-fail
 
-[ 2 3 4 1 ] [ 1 2 3 4 roll ] unit-test
-[ 1 2 3 4 ] [ 2 3 4 1 -roll ] unit-test
-
 [ 3 ] [ t 3 and ] unit-test
 [ f ] [ f 3 and ] unit-test
 [ f ] [ 3 f and ] unit-test
 [ 3 ] [ t 3 and ] unit-test
 [ f ] [ f 3 and ] unit-test
 [ f ] [ 3 f and ] unit-test
index 6538109687b16ddd99c7dfe1629d53dd415b307a..22c96c43189437e3a8ea9a27173b7bee21e598c8 100644 (file)
@@ -10,10 +10,6 @@ DEFER: 3dip
 ! Stack stuff
 : spin ( x y z -- z y x ) swap rot ; inline
 
 ! Stack stuff
 : spin ( x y z -- z y x ) swap rot ; inline
 
-: roll ( x y z t -- y z t x ) [ rot ] dip swap ; inline
-
-: -roll ( x y z t -- t x y z ) swap [ -rot ] dip ; inline
-
 : 2over ( x y z -- x y z x y ) pick pick ; inline
 
 : clear ( -- ) { } set-datastack ;
 : 2over ( x y z -- x y z x y ) pick pick ; inline
 
 : clear ( -- ) { } set-datastack ;
@@ -63,9 +59,9 @@ DEFER: if
 
 : dip ( x quot -- x ) swap [ call ] dip ;
 
 
 : dip ( x quot -- x ) swap [ call ] dip ;
 
-: 2dip ( x y quot -- x y ) -rot [ call ] 2dip ;
+: 2dip ( x y quot -- x y ) swap [ dip ] dip ;
 
 
-: 3dip ( x y z quot -- x y z ) -roll [ call ] 3dip ;
+: 3dip ( x y z quot -- x y z ) swap [ 2dip ] dip ;
 
 : 4dip ( w x y z quot -- w x y z ) swap [ 3dip ] dip ; inline
 
 
 : 4dip ( w x y z quot -- w x y z ) swap [ 3dip ] dip ; inline
 
index cae2c20877c8b59e2a4b30525377a8292a988865..9eb2804b4298c7f89aaba649211618e83fc0352b 100755 (executable)
@@ -10,7 +10,6 @@ IN: reports.noise
 : badness ( word -- n )\r
     H{\r
         { -nrot 5 }\r
 : badness ( word -- n )\r
     H{\r
         { -nrot 5 }\r
-        { -roll 4 }\r
         { -rot 3 }\r
         { bi@ 1 }\r
         { 2curry 1 }\r
         { -rot 3 }\r
         { bi@ 1 }\r
         { 2curry 1 }\r
@@ -54,7 +53,6 @@ IN: reports.noise
         { nwith 4 }\r
         { over 2 }\r
         { pick 4 }\r
         { nwith 4 }\r
         { over 2 }\r
         { pick 4 }\r
-        { roll 4 }\r
         { rot 3 }\r
         { spin 3 }\r
         { swap 1 }\r
         { rot 3 }\r
         { spin 3 }\r
         { swap 1 }\r
index 9de9a6fe7c85f614f58866c27b297885e49b7d8c..ff20f1520469107d7e4b912eec893c132dc49a2b 100644 (file)
@@ -2,7 +2,7 @@ USING: accessors arrays combinators.short-circuit grouping kernel lists
 lists.lazy locals math math.functions math.parser math.ranges
 models.product monads random sequences sets ui ui.gadgets.controls
 ui.gadgets.layout models.combinators ui.gadgets.alerts vectors fry
 lists.lazy locals math math.functions math.parser math.ranges
 models.product monads random sequences sets ui ui.gadgets.controls
 ui.gadgets.layout models.combinators ui.gadgets.alerts vectors fry
-ui.gadgets.labels ;
+ui.gadgets.labels shuffle ;
 IN: sudokus
 
 : row ( index -- row ) 1 + 9 / ceiling ;
 IN: sudokus
 
 : row ( index -- row ) 1 + 9 / ceiling ;
@@ -37,4 +37,4 @@ IN: sudokus
         ] with-self , ] <vbox> { 280 220 } >>pref-dim
     "Sudoku Sleuth" open-window ] with-ui ;
 
         ] with-self , ] <vbox> { 280 220 } >>pref-dim
     "Sudoku Sleuth" open-window ] with-ui ;
 
-MAIN: do-sudoku
\ No newline at end of file
+MAIN: do-sudoku