On Dec 29, 12:44 am, "Mark Engelberg" <mark.engelb...@gmail.com>
wrote:
> So I understand that we're supposed to discuss ideas here to try to
> gain "mindshare" which is why last week I brought up the issue with
> Clojure missing mod (which works differently from rem on negative
> numbers).  So really, no one else cares about this, or was the post
> just lost in the shuffle of holiday time?
>
> On Mon, Dec 22, 2008 at 4:04 AM, Mark Engelberg
>
> <mark.engelb...@gmail.com> wrote:
> > Anyone know why there is no modulo or mod function in Clojure's core?
> > I know there is a rem function, but that's not the same thing.  mod
> > and rem behave differently when the first number is negative.
>
> > (mod -2 5) -> 3
> > (rem -2 5) -> -2
>
> > modulo n is important for making things stay in the range from 0 to
> > n-1, for example, if you're working with vectors of length n.  You
> > need to ensure that negative numbers wrap around to the positive
> > range.  rem does not do this.
>
> > I'm more familiar with Scheme than CL, and I know PLT Scheme provides
> > both modulo and remainder.  But according to the Wikipedia
> > (http://en.wikipedia.org/wiki/Modulo_operation), Common Lisp also
> > provides both mod and rem functions.  So why not Clojure?  Is it a
> > Java defeciency?

Holidays here.

Feel free to create an issue for this:

http://code.google.com/p/clojure/issues/list

Patch (from a registered contributor) welcome.

Rich

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to