Skip to content

Commit

Permalink
extra: using empty? in some places.
Browse files Browse the repository at this point in the history
  • Loading branch information
mrjbq7 committed Dec 5, 2014
1 parent 3416021 commit 31b2249
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 13 deletions.
2 changes: 1 addition & 1 deletion extra/benchmark/tcp-echo0/tcp-echo0.factor
Expand Up @@ -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 ;

Expand Down
2 changes: 1 addition & 1 deletion extra/fuel/xref/xref.factor
Expand Up @@ -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 ;
Expand Down
10 changes: 4 additions & 6 deletions extra/math/text/english/english.factor
Expand Up @@ -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 = [
Expand Down
10 changes: 5 additions & 5 deletions extra/mongodb/driver/driver.factor
Expand Up @@ -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 ;

Expand Down

0 comments on commit 31b2249

Please sign in to comment.