Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upAdd isEven and isOdd to Basics #367
Comments
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
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?
|
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
closed this
Aug 24, 2015
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
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 |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
evancz
Aug 24, 2015
Member
What about the other languages I asked about? So far sounds like a lisp thing.
|
What about the other languages I asked about? So far sounds like a lisp thing. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
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 |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
evancz
Sep 7, 2015
Member
Yeah, that's the right way to go for now. Arithmetic sounds like a nice name to me :)
|
Yeah, that's the right way to go for now. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
sindikat
Sep 7, 2015
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
|
|
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
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, (Also, some stuff got in the way, but I will continue work on the package soon. I'm basically translating |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
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 |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
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 |
sindikat commentedAug 24, 2015
isEvenis referenced onBasicsdocs, although the function is undefined. Both functions are used quite often, and they are tiny, so there's no trouble in adding them toBasics. Yes, the user can write(\x -> x%2==0), butisEvenhas little chance of name collision, used often and wouldn't require the user to write yet another small helper function.