Hacker News new | past | comments | ask | show | jobs | submit login

Maybe you haven't checked out Kotlin lately?

Kotlin has somewhat pattern matching: https://kotlinlang.org/docs/reference/control-flow.html#when...

Tail call optimization: https://kotlinlang.org/docs/reference/functions.html#tail-re...

Type classes: https://kotlinlang.org/docs/reference/sealed-classes.html

And I'm not sure what you mean by recursive data structures. Basically every C style language I'm aware of can contain a reference to another instance of its own type.

It's more java-y than Scala, but it's fundementally capable of a very FP style.




> Type classes: https://kotlinlang.org/docs/reference/sealed-classes.html

Those are not type-classes, at least not in the Haskell sense. They allow you to avoid an else branch, yes, which is actually quite useful; but one basic ability they're missing is the ability to define a new branch for a new instance of the type defined by library users.

Just as an example. They're really not much like type-classes at all.


I agree with Filligree that sealed classes are not really capable of emulating type classes. They can be used for algebraic data types, which is great, but for true extensible type classes you'd need something like Scala traits.


> Type classes: https://kotlinlang.org/docs/reference/sealed-classes.html

Sealed classes are an odd/wonky take on sum types, they're not even remotely close to type classes.


Tail recursion is a special case of tail calls that can be turned into loops. Their keyword is called tailrec, so it's probably not real TCO. Real tail call optimization can't easily be turned into loops in the general case.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: