No permutations function in the library?


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


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] ( 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

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


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.


@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.


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?


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?



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



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 and

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.


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


How to relate this kotlinx.math to the kotlinx-math at