• RagingNerdoholic@lemmy.ca
    link
    fedilink
    arrow-up
    1
    ·
    edit-2
    1 year ago

    Left representation is definitely more readable

    Hard disagree. The right can be read linearly. You know, the way humans read.

    I sucked balls at precalc, but I’m pretty decent at programming. I suppose, with enough practice, one becomes “fluent” in mathematical notation, but the C-style language definitely reads more naturally. The mathematical notation is what I’d call “too much abstraction.”

    and understanded by more people

    I don’t know the stats, but I have to imagine, by this point, there are more programmers than mathematicians.

    • Zeth0s@lemmy.world
      link
      fedilink
      arrow-up
      2
      ·
      edit-2
      1 year ago

      Sum and product are high school curriculum in many countries. Where I grew up sum symbol is curriculum in all high schools including trade schools.

      Regarding readability, this case is just the definition… Problem of for loops is that they become unreadable very quickly, so quickly that most of the modern languages focused on readability discourage use of for loop exactly for readability, replaced by list comprehension or map. Once you have a real world case, sum sign become incredibile more readable. That is the reason why the meme is not how one implement a sum in real world program. The corresponding in a modern, readable language is something like

      sum(x) # x is a list or generator
      prod(x) 
      

      that is the mathematical notation