]> gitweb.factorcode.org Git - factor.git/commitdiff
Remove nipd, 3nip, 4nip and tuckd from basis/shuffle
authorSlava Pestov <slava@slava-pestovs-macbook-pro.local>
Tue, 10 Feb 2009 00:11:42 +0000 (18:11 -0600)
committerSlava Pestov <slava@slava-pestovs-macbook-pro.local>
Tue, 10 Feb 2009 00:11:42 +0000 (18:11 -0600)
basis/csv/csv-tests.factor
basis/db/postgresql/lib/lib.factor
basis/math/polynomials/polynomials.factor
basis/regexp/traversal/traversal.factor
basis/shuffle/shuffle-tests.factor
basis/shuffle/shuffle.factor
extra/project-euler/002/002.factor
extra/reports/noise/noise.factor

index 4d78c2af8605f62add06918fad9ec144a02b0695..50bc3836f5f40d37d595d407125c89da05acc658 100644 (file)
@@ -1,11 +1,11 @@
-USING: io.streams.string csv tools.test shuffle kernel strings
+USING: io.streams.string csv tools.test kernel strings
 io.pathnames io.files.unique io.encodings.utf8 io.files
 io.directories ;
 IN: csv.tests
 
 ! I like to name my unit tests
 : named-unit-test ( name output input -- ) 
-  nipd unit-test ; inline
+  unit-test drop ; inline
 
 ! tests nicked from the wikipedia csv article
 ! http://en.wikipedia.org/wiki/Comma-separated_values
index 05114a4deb8128d31a7596011b4b20b623ebecbe..0d50d1ab2c915f5cddb8fa31bca87c3dc23a3676 100644 (file)
@@ -3,7 +3,7 @@
 USING: arrays continuations db io kernel math namespaces
 quotations sequences db.postgresql.ffi alien alien.c-types
 db.types tools.walker ascii splitting math.parser combinators
-libc shuffle calendar.format byte-arrays destructors prettyprint
+libc calendar.format byte-arrays destructors prettyprint
 accessors strings serialize io.encodings.binary io.encodings.utf8
 alien.strings io.streams.byte-array summary present urls
 specialized-arrays.uint specialized-arrays.alien db.private ;
@@ -117,7 +117,7 @@ M: postgresql-result-null summary ( obj -- str )
 
 : pq-get-string ( handle row column -- obj )
     3dup PQgetvalue utf8 alien>string
-    dup empty? [ [ pq-get-is-null f ] dip ? ] [ 3nip ] if ;
+    dup empty? [ [ pq-get-is-null f ] dip ? ] [ [ 3drop ] dip ] if ;
 
 : pq-get-number ( handle row column -- obj )
     pq-get-string dup [ string>number ] when ;
@@ -134,7 +134,7 @@ M: postgresql-malloc-destructor dispose ( obj -- )
 : pq-get-blob ( handle row column -- obj/f )
     [ PQgetvalue ] 3keep 3dup PQgetlength
     dup 0 > [
-        3nip
+        [ 3drop ] dip
         [
             memory>byte-array >string
             0 <uint>
index 1ece3d915e0b434fe9436a27d6b2c8f56b55efb8..749bde3a10caebeb082d7869cd7fba4827ac4d49 100644 (file)
@@ -1,6 +1,6 @@
 ! Copyright (C) 2008 Doug Coleman.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: arrays kernel make math math.order math.vectors sequences shuffle
+USING: arrays kernel make math math.order math.vectors sequences
     splitting vectors ;
 IN: math.polynomials
 
@@ -75,7 +75,7 @@ PRIVATE>
 PRIVATE>
 
 : pgcd ( p q -- a d )
-    swap V{ 0 } clone V{ 1 } clone 2swap (pgcd) [ >array ] bi@ ;
+    [ V{ 0 } clone V{ 1 } clone ] 2dip swap (pgcd) [ >array ] bi@ ;
 
 : pdiff ( p -- p' )
     dup length v* { 0 } ?head drop ;
index d8c25eda18ffcea56cc2a0a759c7d48f20fb3747..104a6c2ce1c2159445e2ba8175d55520e5e295b1 100644 (file)
@@ -2,8 +2,7 @@
 ! See http://factorcode.org/license.txt for BSD license.
 USING: accessors assocs combinators kernel math
 quotations sequences regexp.parser regexp.classes fry arrays
-combinators.short-circuit regexp.utils prettyprint regexp.nfa
-shuffle ;
+combinators.short-circuit regexp.utils prettyprint regexp.nfa ;
 IN: regexp.traversal
 
 TUPLE: dfa-traverser
@@ -170,7 +169,7 @@ M: capture-group-off flag-action ( dfa-traverser flag -- )
     ] [ drop ] if ;
 
 : match-default ( transition from-state table -- to-state/f )
-    nipd transitions>> at t swap at ;
+    [ drop ] 2dip transitions>> at t swap at ;
 
 : match-transition ( obj from-state dfa -- to-state/f )
     { [ match-literal ] [ match-class ] [ match-default ] } 3|| ;
index f190544e198aef7a4998bb8b7ecc0aaca28e9754..f8f83a9c0871db141c52c05b750cb27219e83e37 100644 (file)
@@ -1,5 +1,3 @@
 USING: shuffle tools.test ;
 
-[ 8 ] [ 5 6 7 8 3nip ] unit-test
-[ 3 1 2 3 ] [ 1 2 3 tuckd ] unit-test
 [ 1 2 3 4 ] [ 3 4 1 2 2swap ] unit-test
index b195e4abf903bd261d199d61741af8a4577cc9b7..10fb8b01ddb37fd8867a6ac5aa0d7a8d1779f5fe 100644 (file)
@@ -6,14 +6,6 @@ IN: shuffle
 
 : 2swap ( x y z t -- z t x y ) 2 2 mnswap ; inline
 
-: nipd ( a b c -- b c ) rot drop ; inline
-
-: 3nip ( a b c d -- d ) 3 nnip ; inline
-
-: 4nip ( a b c d e -- e ) 4 nnip ; inline
-
 : 4dup ( a b c d -- a b c d a b c d ) 4 ndup ; inline
 
 : 4drop ( a b c d -- ) 3drop drop ; inline
-
-: tuckd ( x y z -- z x y z ) 2 ntuck ; inline
index da20c874b5c5bb150619ccc89d2c427383f0b82d..9c462b6b2e23b5da48f7cee43a96c923ae49cddb 100644 (file)
@@ -1,6 +1,6 @@
 ! Copyright (c) 2007, 2008 Aaron Schaefer, Alexander Solovyov, Vishal Talwar.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: kernel math sequences shuffle ;
+USING: kernel math sequences ;
 IN: project-euler.002
 
 ! http://projecteuler.net/index.php?section=problems&id=2
@@ -41,7 +41,7 @@ PRIVATE>
 ! -------------------
 
 : fib-upto* ( n -- seq )
-    0 1 [ pick over >= ] [ tuck + dup ] [ ] produce 3nip
+    0 1 [ pick over >= ] [ tuck + dup ] [ ] produce [ 3drop ] dip
     but-last-slice { 0 1 } prepend ;
 
 : euler002a ( -- answer )
index 3e47adac0b08909ad5ed53db9e654110a8e5d71f..89e00f88c56670bb4dc05eeaf5b0f279cb9b96e4 100755 (executable)
@@ -25,7 +25,6 @@ IN: reports.noise
         { 3drop 1 }\r
         { 3dup 2 }\r
         { 3keep 3 }\r
-        { 3nip 4 }\r
         { 3slip 3 }\r
         { 4drop 2 }\r
         { 4dup 3 }\r
@@ -50,7 +49,6 @@ IN: reports.noise
         { ndrop 2 }\r
         { ndup 3 }\r
         { nip 2 }\r
-        { nipd 3 }\r
         { nkeep 5 }\r
         { npick 6 }\r
         { nrot 5 }\r
@@ -66,7 +64,6 @@ IN: reports.noise
         { swap 1 }\r
         { swapd 3 }\r
         { tuck 2 }\r
-        { tuckd 4 }\r
         { with 1/2 }\r
 \r
         { bi 1/2 }\r