Also, "mod" seems too strict about numbers it accepts (only integers!):
user=> (rem 1 2/3) 1/3 user=> (mod 1 2/3) java.lang.IllegalArgumentException: mod requires two integers (NO_SOURCE_FILE:0) user=> (rem 4.5 2.0) 0.5 user=> (mod 4.5 2.0) java.lang.IllegalArgumentException: mod requires two integers (NO_SOURCE_FILE:0) Frantisek On Feb 10, 10:30 pm, Chouser <chou...@gmail.com> wrote: > Is 'mod' working correctly? > > user=> (map #(mod % 3) (range -9 9)) > (3 1 2 3 1 2 3 1 2 0 1 2 0 1 2 0 1 2) > > It disagrees with, for example, Ruby: > > irb(main):002:0> (-9..9).map{|x| x % 3} > => [0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0] > > And python: > > >>> map( lambda x: x % 3, range(-9,9) ) > > [0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2] > > --Chouser --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~----------~----~----~----~------~----~------~--~---