]> gitweb.factorcode.org Git - factor.git/commitdiff
extra: using empty? in some places.
authorJohn Benediktsson <mrjbq7@gmail.com>
Fri, 5 Dec 2014 03:13:08 +0000 (19:13 -0800)
committerJohn Benediktsson <mrjbq7@gmail.com>
Fri, 5 Dec 2014 03:13:08 +0000 (19:13 -0800)
extra/benchmark/tcp-echo0/tcp-echo0.factor
extra/fuel/xref/xref.factor
extra/math/text/english/english.factor
extra/mongodb/driver/driver.factor

index 5b0c3c7772320ded38642b13bf931fd6496d240a..60500b3aa8de307f00aa3fda0a28524b0069c60a 100644 (file)
@@ -46,7 +46,7 @@ M: tcp-echo handle-client*
     <tcp-echo> [
         \ threaded-server get server>address binary [
             #times [ #bytes read-write ] times
-            contents length 0 = [ incorrect-#bytes ] unless
+            contents empty? [ incorrect-#bytes ] unless
         ] with-client
     ] with-threaded-server ;
 
index 1111a3eafddf5810433c475ca69db0a17e87ac33..3c1752257cf5e48b36ed404eef7d9cf06e4b90c9 100644 (file)
@@ -31,7 +31,7 @@ IN: fuel.xref
     >alist natural-sort ;
 
 : filter-prefix ( seq prefix -- seq )
-    [ drop-prefix nip length 0 = ] curry filter members ;
+    [ drop-prefix nip empty? ] curry filter members ;
 
 MEMO: (vocab-words) ( name -- seq )
     >vocab-link words [ name>> ] map ;
index 9c8d6af869860d505bdbe7a829d52bf61f724087..5a4d7ae0f900afe6967760002583f75ddcdf10e4 100644 (file)
@@ -65,12 +65,10 @@ SYMBOL: and-needed?
     [ " " glue ] unless-empty ;
 
 : append-with-conjunction ( str1 str2 -- newstr )
-    over length 0 = [
-        nip
-    ] [
-        swap and-needed? get " and " ", " ?
-        glue and-needed? off
-    ] if ;
+    swap [
+        and-needed? get " and " ", " ? glue
+        and-needed? off
+    ] unless-empty ;
 
 : (recombine) ( str index seq -- newstr )
     2dup nth 0 = [
index 043e89752885ea53d5add0c3b7aaebe9728d35a9..184cd1146701c6367366302f2d8951242551264e 100644 (file)
@@ -144,21 +144,21 @@ M: mdb-collection create-collection ( collection -- )
     ] bi ; inline
 
 : build-collection-map ( -- assoc )
-    H{ } clone load-collection-list      
+    H{ } clone load-collection-list
     [ [ "name" ] dip at "." split second <mdb-collection> ] map
     over '[ [ ] [ name>> ] bi _ set-at ] each ;
 
 : ensure-collection-map ( mdb-instance -- assoc )
-    dup collections>> dup keys length 0 = 
+    dup collections>> dup assoc-empty?
     [ drop build-collection-map [ >>collections drop ] keep ]
-    [ nip ] if ; 
+    [ nip ] if ;
 
 : (ensure-collection) ( collection mdb-instance -- collection )
     ensure-collection-map [ dup ] dip key?
     [ ] [ [ ensure-valid-collection-name ]
           [ create-collection ]
-          [ ] tri ] if ; 
-      
+          [ ] tri ] if ;
+
 : reserved-namespace? ( name -- ? )
     [ "$cmd" = ] [ "system" head? ] bi or ;