Arithmetic functions only operate on numbers, the behavior is undefined for any other input types.
Richard Hull June 4, 2013 at 9:22 PM
Found a corner case where this implementation of mod fails - if the modulus is a stringified number then it doesn't work. Clearly a string ought not be passed in the first place, but there is no indication other than a wrong result.
compare (rem 10 "4") and (mod 10 "4") and (mod 10 4) then try (rem 10 "3") and (mod 10 "3") and (mod 10 3)
JavaScript's % (modulo) operator gives incorrect answers for negative numbers, e.g.
which carries over to cljs.core/mod
This blog: http://javascript.about.com/od/problemsolving/a/modulobug.htm
suggests defining modulo as:
ClojureScript's mod should use this workaround