|
|
|
|
|
by Jtsummers
3499 days ago
|
|
Practice will help make the former more readable. It helps, for me, that I have more of a math background (academically) than CS (dual majors, but strongly preferred the math coursework). For me, I see three ways to write, as an example, a summation: n
Σ g(i)
i=1
vs.
seq(1,n).map(g).sum() // or something similar
vs.
for(i = 1; i < n; i++)
sum = g(i)
In my mind, the first is what I see, and is what shows up on paper. The second is what I want to write (and will in any language that lets me). The third is what I often have to write when a language requires that I be more explicit (like C). |
|