Live data from Hacker News

Kotlin for data analysis

kotlinlang.org

91–100 of 105 posts

Re: Kotlin for data analysis

#91
post #90

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.

... which is the exact opposite of being "the first".

Re: Kotlin for data analysis

#92
post #26
post #13

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

I'd follow suit

Re: Kotlin for data analysis

#93

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

Scala isn't "python weight" as it's much keener on obscure operators and other syntax sugar than Kotlin or Python.

Re: Kotlin for data analysis

#94
post #81
post #65

Earlier 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 :)

Always strange how genes survived over time.

Re: Kotlin for data analysis

#95

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.

Scala isn't "python weight" as it's much keener on obscure operators and other syntax sugar than Kotlin or Python.

What are the obscure methods in the standard library?

Kotlin has grown into a much quirkier language overall, its grammar is significantly bigger than that of Scala.

Re: Kotlin for data analysis

#96
post #27

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

In that case I think the "Pythonic" thing to do would be to have some named intermediate steps:

  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

#97
post #41

Earlier 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 have no qualms with the OPs comment other than the same criticisms I highlighted could be applied to just about any other language in a similarly vague context. So what justice do those criticisms do if we're not being specific about them?

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

#98
post #41

Earlier 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…

> People use python because everybody else uses python. That's it. It's not particularly good at anything it does. But it will get the job done and I can do it. But that just isn't good enough for me. It's the visual basic for data science. And that's not a compliment. Being idiot proof is it's main feature. But that doesn't make it the smart choice.

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

#99

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

You can also try to use Kotlin Multiplatform to compile to JavaScript, Native and WASM. JVM was just the initial platform target.

Re: Kotlin for data analysis

#100

Earlier 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…

You could also build the list directly.

  buildList { for (x in 0..
Post reply on HN