summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRich Hickey <richhickey@gmail.com>2008-06-20 18:02:30 +0000
committerRich Hickey <richhickey@gmail.com>2008-06-20 18:02:30 +0000
commit7774621725227f70473c6e42c6d96585bb644d0a (patch)
treebc74d783b7d97e866e2da501bd48ddb761b38de7
parentf67252e090fd6492efe1bb668ea545099ab75ad6 (diff)
fixed natural join with empty set input
-rw-r--r--src/set.clj5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/set.clj b/src/set.clj
index b678009b..e5e34cc0 100644
--- a/src/set.clj
+++ b/src/set.clj
@@ -69,7 +69,7 @@
join. When passed an additional keymap, joins on the corresponding
keys."
([xrel yrel] ;natural join
- (when (and (seq xrel) (seq yrel))
+ (if (and (seq xrel) (seq yrel))
(let [ks (intersection (set (keys (first xrel))) (set (keys (first yrel))))
[r s] (if (<= (count xrel) (count yrel))
[xrel yrel]
@@ -80,7 +80,8 @@
(if found
(reduce #(conj %1 (merge %2 x)) ret found)
ret)))
- #{} s))))
+ #{} s))
+ #{}))
([xrel yrel km] ;arbitrary key mapping
(let [[r s k] (if (<= (count xrel) (count yrel))
[xrel yrel (map-invert km)]