Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Let `in` predicate accept any seq #99

merged 1 commit into from Aug 10, 2011


None yet
2 participants

lynaghk commented Aug 8, 2011

I was surprised that when I passed a list into in:

(-> tbl
    (select (where (in :column a_list))))

the compiled SQL only contained the first element of the list.
I dug into the source and found that it was because prefix operators check their arguments with vector?.
I changed this to the more general seq?, and it seems to work fine for me (both in the REPL, and all of the tests pass when running cake test).


bendlas commented Aug 8, 2011

Thanks for the PR.

Unfortunately, seq? is not a generalization of vector? because it returns false on vectors. The function you might have been looking for is sequential?.
Also, there is no testcase for IN, that would have caught that.

Would you mind adding test cases and correcting the code?

kind regards


lynaghk commented Aug 8, 2011

Thanks for the catch! I just started with Clojure, and I probably shouldn't be submitting pull requests at 10 p.m. anyway = )

I've amended the commit to use coll? and updated the test cases to try passing a vector, list, and set to in.


bendlas commented Aug 10, 2011

That seems to work fine, thanks!

@bendlas bendlas merged commit 3b5eadf into LauJensen:master Aug 10, 2011

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment