New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add isEven and isOdd to Basics #367

Closed
sindikat opened this Issue Aug 24, 2015 · 9 comments

Comments

Projects
None yet
4 participants
@sindikat

sindikat commented Aug 24, 2015

isEven is referenced on Basics docs, although the function is undefined. Both functions are used quite often, and they are tiny, so there's no trouble in adding them to Basics. Yes, the user can write (\x -> x%2==0), but isEven has little chance of name collision, used often and wouldn't require the user to write yet another small helper function.

@evancz

This comment has been minimized.

Show comment
Hide comment
@evancz

evancz Aug 24, 2015

Member

This is the policy on adding new stuff to core. I don't really believe the assertion that "Both functions are used quite often". To push this a bit further, can you come up with a list of languages and whether they have this? Like, for Python, Java, JavaScript, Ruby, OCaml, SML, Clojure, Scala, etc. do they have this imported by default? Or something else? If so, what is it?

Member

evancz commented Aug 24, 2015

This is the policy on adding new stuff to core. I don't really believe the assertion that "Both functions are used quite often". To push this a bit further, can you come up with a list of languages and whether they have this? Like, for Python, Java, JavaScript, Ruby, OCaml, SML, Clojure, Scala, etc. do they have this imported by default? Or something else? If so, what is it?

@evancz evancz closed this Aug 24, 2015

@sindikat

This comment has been minimized.

Show comment
Hide comment
@sindikat

sindikat Aug 24, 2015

FWIW, Clojure, Racket, Common Lisp and Emacs Lisp do import this or similar functions by default. I created this thread, because from meta-issue on API changes I understood I should create a new issue for any proposal for core that is somewhat viable. Other than that, I'm pretty happy to use *-extra packages.

sindikat commented Aug 24, 2015

FWIW, Clojure, Racket, Common Lisp and Emacs Lisp do import this or similar functions by default. I created this thread, because from meta-issue on API changes I understood I should create a new issue for any proposal for core that is somewhat viable. Other than that, I'm pretty happy to use *-extra packages.

@evancz

This comment has been minimized.

Show comment
Hide comment
@evancz

evancz Aug 24, 2015

Member

What about the other languages I asked about? So far sounds like a lisp thing.

Member

evancz commented Aug 24, 2015

What about the other languages I asked about? So far sounds like a lisp thing.

@maurisvh

This comment has been minimized.

Show comment
Hide comment
@maurisvh

maurisvh Sep 5, 2015

FWIW, I'm writing a little Arithmetic library with things like this in it, based loosely on Haskell's prelude + arithmoi. That sounds like a better place for things like this. (Is Arithmetic a good name, though?)

maurisvh commented Sep 5, 2015

FWIW, I'm writing a little Arithmetic library with things like this in it, based loosely on Haskell's prelude + arithmoi. That sounds like a better place for things like this. (Is Arithmetic a good name, though?)

@evancz

This comment has been minimized.

Show comment
Hide comment
@evancz

evancz Sep 7, 2015

Member

Yeah, that's the right way to go for now. Arithmetic sounds like a nice name to me :)

Member

evancz commented Sep 7, 2015

Yeah, that's the right way to go for now. Arithmetic sounds like a nice name to me :)

@sindikat

This comment has been minimized.

Show comment
Hide comment
@sindikat

sindikat Sep 7, 2015

👍 for having isEven and isOdd in Arithmetic. Also, there is a package math in Racket, which is very advanced and has all kinds of functions. If Arithmetic aspires to be anything like a general math-related library, it should be called math, I think.

sindikat commented Sep 7, 2015

👍 for having isEven and isOdd in Arithmetic. Also, there is a package math in Racket, which is very advanced and has all kinds of functions. If Arithmetic aspires to be anything like a general math-related library, it should be called math, I think.

@maurisvh

This comment has been minimized.

Show comment
Hide comment
@maurisvh

maurisvh Sep 16, 2015

To me, Math sounds like sin, cos, exp, ln... and Arithmetic sounds like isEven, isOdd, primes, gcd, lcm, Euclidean division... i.e., analysis vs. number theory. For some reason I feel like grouping them together would be messy, but maybe there's no reason not to?

(Also, some stuff got in the way, but I will continue work on the package soon. I'm basically translating arithmoi functions from Haskell to Elm to the best of my ability, which means it's quite involved, especially the prime stuff, but everything should be pretty fast!)

maurisvh commented Sep 16, 2015

To me, Math sounds like sin, cos, exp, ln... and Arithmetic sounds like isEven, isOdd, primes, gcd, lcm, Euclidean division... i.e., analysis vs. number theory. For some reason I feel like grouping them together would be messy, but maybe there's no reason not to?

(Also, some stuff got in the way, but I will continue work on the package soon. I'm basically translating arithmoi functions from Haskell to Elm to the best of my ability, which means it's quite involved, especially the prime stuff, but everything should be pretty fast!)

@sindikat

This comment has been minimized.

Show comment
Hide comment
@sindikat

sindikat Sep 16, 2015

Just like there's Html, Html.Events, Html.Attributes, maybe there should be Math.Arithmetic, Math.Number (for number theory), Math.Trigonometry? Anyway, thanks for working on that :)

sindikat commented Sep 16, 2015

Just like there's Html, Html.Events, Html.Attributes, maybe there should be Math.Arithmetic, Math.Number (for number theory), Math.Trigonometry? Anyway, thanks for working on that :)

@lynn

This comment has been minimized.

Show comment
Hide comment
@lynn

lynn Mar 14, 2016

I wrote elm-arithmetic, which includes isEven and isOdd, among a bunch of other useful functions.

lynn commented Mar 14, 2016

I wrote elm-arithmetic, which includes isEven and isOdd, among a bunch of other useful functions.

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