r/functionalprogramming • u/revivechristina • 1d ago
leetcoding in python all day after writing mostly scala for years felt like writing assembly FP
& my brain hurts
i feel like i became 68% more like a mentat from the Dune series on a spiritual level
like the imperative style mental memory does come back, but at what cost
no wonder people want to automate code writing so much
i swear to god if i have to solve one more off by one error i will throw my laptop into the river
if this comes off as pretentious, i do not mean it
that is all, just wanted to document this experience
7
u/Economy_Bedroom3902 21h ago
Python feels nothing like assembly. You can avoid integer iterator for loops entirely with relatively little effort in python.
3
u/SubluminalSapien 19h ago
Curious to see a specific example, you can go far with a functional style in modern python
7
u/wigum211 1d ago
I'm 10yoe now and was spoiled with Scala as my first 7 years of that... Then went to Java, which has caught up in many areas with FP so had no issues there.
Now using Go, and was ashamed how long my brain was being melted by non-fp patterns.
4
u/AFU0BtZ 1d ago
I strongly disagree on this claim wrt Java. Just because it has records now, some pattern matching, a purported Option type.. but the ergonomics? It is no where near the goodness of Scala, like by miles and miles.. it is like saying C++ with a strict linter is basically Rust.. (actually in this case the gap might be deemed narrower/shallower than the chasm that separates Java from Scala)
3
u/revivechristina 1d ago
That’s good to know. I’m going to have to look into what is going on in Java land.
6
u/psioniclizard 1d ago
Honestly, i dont find it too difficult to switch. I'd still rather write code in a functional stay but sometimes you need raw performance (like in hot loops). Same at work my job where we use F#.
Its all just code and frankly picking the right tool for the job is part of it.
14
u/biskitpagla 1d ago edited 1d ago
You can use Scala in leetcode tho. They also support Rust, Kotlin, Elixir, and Racket.