mongodb: using "if-empty" makes it cleaner.

db4
John Benediktsson 2011-09-21 19:31:08 -07:00
parent 315896c857
commit 08aa100eb7
2 changed files with 2 additions and 2 deletions

View File

@ -242,7 +242,7 @@ M: mdb-cursor find
: find-one ( mdb-query-msg -- result/f )
fix-query-collection
1 >>return# send-query-plain objects>>
dup empty? [ drop f ] [ first ] if ;
[ f ] [ first ] if-empty ;
: count ( mdb-query-msg -- result )
[ count-cmd make-cmd ] dip

View File

@ -269,7 +269,7 @@ M: gridfs-input-stream stream-element-type drop +byte+ ;
M: gridfs-input-stream stream-read ( n stream -- seq/f )
over <byte-vector> [ (stream-read) ] [ ] bi
dup empty? [ drop f ] [ >byte-array ] if ;
[ f ] [ >byte-array ] if-empty ;
M: gridfs-input-stream stream-read-partial ( n stream -- seq/f )
(stream-read-partial) ;