]> gitweb.factorcode.org Git - factor.git/commitdiff
io.streams.random: moving random-file here.
authorJohn Benediktsson <mrjbq7@gmail.com>
Fri, 26 Oct 2012 04:47:42 +0000 (21:47 -0700)
committerJohn Benediktsson <mrjbq7@gmail.com>
Fri, 26 Oct 2012 04:47:42 +0000 (21:47 -0700)
extra/io/random/random.factor
extra/io/streams/random/random.factor

index 30559196418a237617c7714fa2e8171ef7d1ee1f..6892158bb26392731269b6ee011bce63fe527261 100644 (file)
@@ -1,9 +1,8 @@
 ! Copyright (C) 2012 John Benediktsson
 ! See http://factorcode.org/license.txt for BSD license
 
-USING: combinators destructors fry io io.encodings.binary
-io.files io.streams.limited io.streams.random kernel locals
-math math.order random sequences sequences.private ;
+USING: fry io kernel locals math random sequences
+sequences.private ;
 
 IN: io.random
 
@@ -27,10 +26,3 @@ PRIVATE>
             r n < [ line r accum set-nth-unsafe ] when
         ] if
     ] each-numbered-line accum ;
-
-: random-file ( n path -- )
-    [
-        [ <random-stream> swap limit-stream ]
-        [ binary <file-writer> ] bi*
-        [ &dispose ] bi@ stream-copy
-    ] with-destructors ;
index 191d344930d3e83abfa9be9fa80997e69642e751..3ab2a482cbb5250580d33b47a8f200c701b560be 100644 (file)
@@ -1,6 +1,7 @@
 ! Copyright (C) 2010 Doug Coleman.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: destructors io kernel random sequences ;
+USING: destructors io io.encodings.binary io.files
+io.streams.limited kernel random sequences ;
 IN: io.streams.random
 
 TUPLE: random-stream ;
@@ -19,3 +20,10 @@ M: random-stream stream-read-partial-unsafe stream-read-unsafe ;
 M: random-stream dispose drop ;
 
 INSTANCE: random-stream input-stream
+
+: random-file ( n path -- )
+    [
+        [ <random-stream> swap limit-stream ]
+        [ binary <file-writer> ] bi*
+        [ &dispose ] bi@ stream-copy
+    ] with-destructors ;