you are viewing a single comment's thread
view the rest of the comments
[–] 5 points 3 years ago (2 children)

This post confuses me. Why would code be simpler than the math notation? Both involve symbolic abstraction of basically the same complexity

  • source
  • hideshow 4 child comments
  • [–] 5 points 3 years ago (2 children)

    Its got to be a relatively small group who knows enough to understand loops and is also afraid of math symbols.

  • source
  • parent
  • hideshow 4 child comments
  • [–] 3 points 3 years ago (1 child)

    Maybe not so small?

    I never encountered these math symbols but for loops are like step 3 in any programming language after variables and conditionals

  • source
  • parent
  • hideshow 2 child comments
  • [–] 1 point 3 years ago

    lol, like 2.5% of the USA are programmers and even if we say twice that number have experimented and taken programming classes, that's like 1 in 20 people who would even have ever encountered a for loop. This nsf report says ~70% of highschoolers have taken Algebra 2 or a more advanced math course, which is when sum notation is usually introduced. I think 70% is a little greater than 5%!

  • source
  • parent
  • [–] 0 points 3 years ago (1 child)

    Math notation is just terrible in general because a lot of it is shorthand made up by someone who likes single-letter variables. A symbol you can't type, something above, something below.

    A for loop is clear and descriptive.
    Or if you're feeling fancy, you could go functional with reduce(add, range(0, 5), 0).

  • source
  • parent
  • hideshow 2 child comments
  • [–] -1 points 3 years ago

    Mathematical notation was designed to be written by hand. It is at least as clear and descriptive as any syntax from a programming language. You're pretending that the abstraction behind a for loop is somehow less than that behind a sum or product notation.

  • source
  • parent