No permutations function in the library?


#1

Is there a permutations function in the library? If not there should be. I have been tinkering with a function relating to permutations are words for anagrams and also there is https://medium.com/@voddan/a-handful-of-kotlin-permutations-7659c555d421#.20muzwc9w


#2

Generally, “It should be” is not sufficient motivation to add something to the standard library. We have a goal to keep the library small and include only those APIs which have enough use cases and would be beneficial to the significant part of language users.

The API to be included in the standard library must go through some proposal and review process. We had recently set up such a process (KEEP). If you have an idea for a new API you can create your own proposal and file it as a pull request to KEEP repository.
Thanks to the [template] (https://github.com/Kotlin/KEEP/blob/master/proposals/stdlib/TEMPLATE.md) composing such a proposal becomes quite straightforward. We have written some proposals by ourselves and have already received a couple of proposals from the community https://github.com/Kotlin/KEEP/issues?q=is%3Aissue+is%3Aopen+label%3Astdlib.

Once they are baked enough, we’ll discuss them and include their implementations in the library.


#3

I’ll take a look at this next month.

Clearly stuff can go into artefacts in Bintray and Maven Central and it is easy to use given Gradle or Maven. So having smaller core library is not as big a deal as it can be in other languages.

There is a language marketing issues here to bear in mind. If Kotlin is to get into data science there needs to be a good quality library with all this stuff in.

The “should be” really comes from Python where all this stuff is in the standard library. People doing Python → Kotlin will have a lot of surprises.


#4

@Russel my point of view on this is that a bunch of python-like capabilities should be included in a “math” module in kotlinx (not the stdlib). I planed to examine a bunch of languages famous for their math/scientific applications, namely Python/Matlab/R# and collect the most useful parts into a library. We may join forces if you are interested.


#5

If there was to be a kotlinx.XXX (where XXX is some suitable name) and it was being managed as effectively a rolling release to somewhere that Gradle (and Maven?) could pick it up then I think this is a splendid idea. Obviously in the Python world (I do not know the R or Matlab worlds) there is NumPy (not as good as people make out just now, but could be again) and then all the SciPy, Pandas, Matplotlib, Scikit/Learn stuff built on NumPy and other bits of Python. There are person centuries of code in there which is why for data scientists it is “I can do all my stuff with very little effort”. Language like D are looking to see if they can get into this world since D is statically compiled native code and so algorithms are hugely faster than Python/NumPy. My hesitation is that will these people move into a JVM-based world?


#6

I’ve quickly created a kotlinx.math project [1] for a start. Don’t hesitate to fork or clone it; this could be eventually forked to the “kotlin” GitHub organization.

@voddan: Is it okay to use the permutation code in your Gist for kotlinx.math?

[1] https://github.com/hastebrot/kotlinx.math


#7

Cool, I’ll stay in touch!

@hastebrot use the code right away if you think it is useful. I believe it can be optimised for speed and GC using more imperative code without generics


#8

Thanks.

The first goal can be to provide some useful math functions that are fast enough for basic use. A complee math library is a huge effort. I primary use Python libraries like https://github.com/sympy/sympy and https://github.com/fredrik-johansson/mpmath

If needed there could be additional subprojects for things like statistics, linear algebra and group theory; but these things could maybe overshoot the goal of a small extension library like kotlinx.math.


#9

I believe the first thing to do is to list the things we obviously need at hand. Like support for BigNumber or basic statistic algorithms. We may take those from popular python libraries, for example. A good way to collect the info is to use the issues in the repo. Also let’s discuss that on slack, I created #kotlinx


#10

How to relate this kotlinx.math to the kotlinx-math at https://github.com/yongjhih/kotlin-extensions/tree/master/kotlinx-math