]> gitweb.factorcode.org Git - factor.git/commitdiff
extra: use loop>array in a few places.
authorJohn Benediktsson <mrjbq7@gmail.com>
Mon, 30 Nov 2020 22:31:58 +0000 (14:31 -0800)
committerJohn Benediktsson <mrjbq7@gmail.com>
Mon, 30 Nov 2020 22:31:58 +0000 (14:31 -0800)
extra/bencode/bencode.factor
extra/pcre/pcre.factor
extra/shapefiles/shapefiles.factor

index fc4537477f1717f149bc7fad7cebacbff5a4ac0c..e1c3efe0b05332f9ba47bd789067f37abc58e78b 100644 (file)
@@ -1,6 +1,6 @@
 USING: arrays assocs byte-arrays combinators io
 io.encodings.binary io.streams.byte-array io.streams.string
-kernel linked-assocs math math.parser sequences strings ;
+kernel linked-assocs math math.parser sequences sequences.extras strings ;
 IN: bencode
 
 GENERIC: >bencode ( obj -- bencode )
@@ -28,12 +28,12 @@ DEFER: read-bencode
     "e" read-until CHAR: e assert= string>number ;
 
 : read-list ( -- obj )
-    [ read-bencode dup ] [ ] produce nip ;
+    [ read-bencode ] loop>array ;
 
 : read-dictionary ( -- obj )
     [
-        read-bencode [ read-bencode 2array ] [ f ] if* dup
-    ] [ ] produce nip >linked-hash ;
+        read-bencode [ read-bencode 2array ] [ f ] if*
+    ] loop>array >linked-hash ;
 
 : read-string ( prefix -- obj )
     ":" read-until CHAR: : assert= swap prefix
index 3bff03aaab6f513e1a302263a20d3ab0731cdad6..3ac12f1097d83a42c14f14fc6473c4345658349d 100644 (file)
@@ -4,7 +4,8 @@
 USING: accessors alien alien.accessors alien.c-types alien.data
 alien.enums alien.strings arrays assocs combinators fry
 io.encodings.string io.encodings.utf8 kernel literals math
-math.bitwise math.parser pcre.ffi regexp sequences splitting strings ;
+math.bitwise math.parser pcre.ffi regexp sequences
+sequences.extras splitting strings ;
 IN: pcre
 
 ERROR: bad-option what ;
@@ -144,7 +145,7 @@ TUPLE: compiled-pcre pcre extra nametable ;
 GENERIC: findall ( subject obj -- matches )
 
 M: compiled-pcre findall
-    [ <matcher> [ findnext dup ] [ ] produce 2nip ]
+    [ <matcher> [ findnext ] loop>array nip ]
     [ nametable>> rot [ parse-match ] 2with { } map-as ] 2bi ;
 
 M: string findall
index ba5a5b98ad74e3a85fc4621c5b69c7e0be190af1..62a2ab59a2d156bd180d839e5f5496112febd867 100644 (file)
@@ -4,7 +4,7 @@
 USING: accessors byte-arrays classes combinators io
 io.binary.fast io.encodings.binary io.files
 io.streams.byte-array kernel locals math math.order
-math.statistics sequences sets ;
+math.statistics sequences sequences.extras sets ;
 
 IN: shapefiles
 
@@ -131,7 +131,7 @@ TUPLE: record number content-length shape ;
     4 read [ be> 4 read be> read-shape record boa ] [ f ] if* ;
 
 : read-records ( -- records )
-    [ read-record dup ] [ ] produce nip ;
+    [ read-record ] loop>array ;
 
 : read-shp ( -- header records )
     read-header read-records ;
@@ -145,7 +145,7 @@ TUPLE: index offset content-length ;
     4 read [ be> 4 read be> index boa ] [ f ] if* ;
 
 : read-indices ( -- indices )
-    [ read-index dup ] [ ] produce nip ;
+    [ read-index ] loop>array ;
 
 : read-shx ( -- header indices )
     read-header read-indices ;