this post was submitted on 15 Sep 2026
35 points (100.0% liked)

Programming

28788 readers
203 users here now

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you're posting long videos try to add in some form of tldr for those who don't want to watch videos

Wormhole

Follow the wormhole through a path of communities !webdev@programming.dev



founded 3 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
[–] setsubyou@lemmy.world 2 points 3 weeks ago (1 children)

I don’t think it’s really less elegant in Python or Swift. Especially not in Swift where you can write it very concisely in some cases, like numbers.reduce(0, +). Admittedly Python is a bit more verbose.

But maybe Python and Swift programmers are not used to it in the same way as Clojure programmers are.

[–] eager_eagle@lemmy.world 2 points 3 weeks ago* (last edited 3 weeks ago)

also python has built-ins for sum, min, max, and math.prod - which account for a lot of use cases of reduce in a more readable way.

But if you're really crunching numbers, it's just better to go with something like numpy, pandas, polars, ...