• setsubyou@lemmy.world
    link
    fedilink
    arrow-up
    0
    ·
    11 days ago

    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
      link
      fedilink
      English
      arrow-up
      0
      ·
      11 days 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, …