couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From robertkowal...@apache.org
Subject [15/50] [abbrv] couchdb-mango git commit: Format Condense Fold
Date Tue, 03 Feb 2015 15:13:22 GMT
Format Condense Fold

- Make foldl less condense and easier to read.
- 38863-in-operator-arrays


Project: http://git-wip-us.apache.org/repos/asf/couchdb-mango/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-mango/commit/52544a5e
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-mango/tree/52544a5e
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-mango/diff/52544a5e

Branch: refs/heads/master
Commit: 52544a5e1db47178791f757f7b6e21707acaf00d
Parents: 2d0cd0c
Author: Tony Sun <llamage@Tonys-MacBook-Pro.local>
Authored: Wed Nov 5 09:58:04 2014 -0800
Committer: Tony Sun <llamage@Tonys-MacBook-Pro.local>
Committed: Wed Nov 5 09:58:04 2014 -0800

----------------------------------------------------------------------
 src/mango_selector.erl | 7 +++++++
 1 file changed, 7 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-mango/blob/52544a5e/src/mango_selector.erl
----------------------------------------------------------------------
diff --git a/src/mango_selector.erl b/src/mango_selector.erl
index d392abe..97f4123 100644
--- a/src/mango_selector.erl
+++ b/src/mango_selector.erl
@@ -652,6 +652,13 @@ match({[{<<"$gt">>, Arg}]}, Value, Cmp) ->
     Cmp(Value, Arg) > 0;
 
 match({[{<<"$in">>, Args}]}, Values, Cmp) when is_list(Values)->
+    Pred = fun(Arg) ->
+        lists:foldl(fun(Value,Match) ->
+            (Cmp(Value, Arg) == 0) or Match
+        end, false, Values)
+    end,
+    lists:any(Pred, Args);
+match({[{<<"$in">>, Args}]}, Values, Cmp) when is_list(Values)->
     Pred = fun(Arg) -> lists:foldl(fun(Value,Match) ->
         (Cmp(Value, Arg) == 0) or Match end, false, Values)
     end,


Mime
View raw message