you are viewing a single comment's thread
view the rest of the comments
[–] 2 points 1 month ago (1 child)

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.

  • source
  • hideshow 1 child comment
  • [–] 2 points 1 month ago* (last edited 1 month 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, ...

  • source
  • parent