Earlier quoted context omitted.
Kotlin isn't the first language offering any of these features, not even remotely. Even if you look only at the JVM: Scala is much older.
I think the point is Kotlin incorporated great stuff from a few languages, Scala being one of them.
Kotlin for data analysis
91–100 of 105 posts
Re: Kotlin for data analysis
#92Earlier quoted context omitted.
Kotlin just needs some stubborn people not to use python just because everyone else does, and build up the Kotlin ecosystem. That's how progress is made.
If someone wants to pay me to do this, I have some free time Mondays and Wednesdays.
Re: Kotlin for data analysis
#93Earlier quoted context omitted.
Yes but it's reasonable that they didn't. For quick hacky scripts you really want a lightweight syntax that supports interactive REPL exploration. Kotlin is the first language that manages to combine a strict static type system with a Python-weight syntax, and there's a REPL too although I don't think it gets much use. These days notebooks are a better replacement for REPLs anyway when doing data analysis, but Kotlin…
Kotlin isn't the first language offering any of these features, not even remotely. Even if you look only at the JVM: Scala is much older.
Re: Kotlin for data analysis
#94Earlier quoted context omitted.
Couldn't agree more if I tried. Scope functions are also great. And the syntactic sugar where `foo({ a -> a })` and `foo { a -> b }` are the same makes code so much more readable. I've done Python for a project at a previous job for a few months and it made me realize just how awful Python is, especially because you can't chain functions on collections as easily as you can in Kotlin. I also made me realize that I don…
> And the syntactic sugar where `foo({ a -> a })` and `foo { a -> b }` are the same makes code so much more readable. That's 1-to-1 copied from Groovy by the way :)
Re: Kotlin for data analysis
#95Earlier quoted context omitted.
Kotlin isn't the first language offering any of these features, not even remotely. Even if you look only at the JVM: Scala is much older.
Scala isn't "python weight" as it's much keener on obscure operators and other syntax sugar than Kotlin or Python.
Kotlin has grown into a much quirkier language overall, its grammar is significantly bigger than that of Scala.
Re: Kotlin for data analysis
#96Earlier quoted context omitted.
Not that I especially want to defend Python, but can you elaborate a bit on why you find that chain easier to read? The Python version is straightforward enough - if it's just the absence of newlines you can write hundred_or_less_even_seconds = [ timedelta(seconds=it) for it in range(1, 1001) if it Also, I don't know Kotlin well enough, but is what you wrote going to be efficient? The Python version iterates once and…
What if you want to filter on the mapped value in python? Or group by something and work further on the groups? It's almost unreadable after a few operations.
foos = (make_foo(bar) for bar in bars)
acceptable_foos = (foo for foo in foos if acceptable(foo))
...
Depending on your circumstances, this may or may not be awkward (coming up with temporary names can be hard), or may or may not be a good idea anyway (naming things can help make the code more self-documenting). I can't reckon how it could become unreadable, per se - what do you mean by that?Re: Kotlin for data analysis
#97Earlier quoted context omitted.
> The interpreter is not that fast, the language is not that expressive, what passes for package management is a bad joke, etc. I can work with it but I'm not necessarily loving it. These are rather disingenuous criticisms of python. The utility of any language is measured by its use as a means to some end. It's clear that Python's ecosystem has prospered not just because it's a fad, but because it's actually useful.…
Python in data is similar to C in systems: it's not the best language for the job, but it was good enough at a critical point in history that it became the standard by happenstance—there weren't enough things wrong with it to repel the Brownian motion of developers from seeding the ecosystem—and now it's the best language for the job because it's the standard. > These are rather disingenuous criticisms of python. The…
For example > Package management is a disaster > The interpreter is slow > The syntax is not expressive
Is your particular experience with pip bad? Or is it poetry/conda or another upstart project? Are you working with a monorepo? In what use case is the interpreter slow? The syntax is not expressive (for what)?
My point about tooling/utility is that how you use a tool matters a lot (and maybe I didn't express that in my original reply).
Re: Kotlin for data analysis
#98Earlier quoted context omitted.
> The interpreter is not that fast, the language is not that expressive, what passes for package management is a bad joke, etc. I can work with it but I'm not necessarily loving it. These are rather disingenuous criticisms of python. The utility of any language is measured by its use as a means to some end. It's clear that Python's ecosystem has prospered not just because it's a fad, but because it's actually useful.…
Python in data is similar to C in systems: it's not the best language for the job, but it was good enough at a critical point in history that it became the standard by happenstance—there weren't enough things wrong with it to repel the Brownian motion of developers from seeding the ecosystem—and now it's the best language for the job because it's the standard. > These are rather disingenuous criticisms of python. The…
I'll leave this here as well, I think it sufficiently implies the notion of Python being a fad and not particularly useful.
Re: Kotlin for data analysis
#99Earlier quoted context omitted.
Great languages don't exist in isolation. Kotlin without its main platforms (JVM and Android) and the ecosystem of Java libraries doesn't stand a chance against the current landscape of modern hybrid languages. Unless something major happens on the WebAssembly front maybe, but even there I don't see how Kotlin would be particularly well positioned.
True, but the JVM is so cumbersome that I will use something else instead.
Re: Kotlin for data analysis
#100Earlier quoted context omitted.
A bit of a contrived example, but something like this (two for statements): [x*y for x in range (10) for y in range(10)] It's not often, but occasionally there are moments where I'm writing code in Kotlin and wish I could use a list comprehension. I do prefer Kotlin overall, but there's a few things that I think would be "nice to have" from Python. Especially the yield keyword, such a wonderful way to write your own…
Like this? sequence { for (x in 0.. Now, technically, Kotlin doesn't have list comprehensions, only the equivalent of generator expressions in Python, so you have to tack an extra `.toList()` on at the end if you want a list, but you can write pretty much any for comprehension in Python in a similar way in Kotlin. On the other hand, you're not limited to for loops/ifs inside such a generator, but can use fairly arbit…
buildList { for (x in 0..