News for hackers. Stuff that matters.
Re:Swift and the Legacy of Functional Programming by Jtsummers on Monday November 21, 2016 @12:57PM (#13007405)
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).
Re:Swift and the Legacy of Functional Programming by baraah on Monday November 21, 2016 @08:04PM (#13010768)
Shouldn't that be += in the third example?
Re:Swift and the Legacy of Functional Programming by Jtsummers on Monday November 21, 2016 @08:19PM (#13010848)
Yep. Another reason a simple 'sum' is nicer than what C gives us.

Or a reason to go back to checking all code I try to type in.

Re:Swift and the Legacy of Functional Programming by antfarm on Friday November 25, 2016 @12:04PM (#13038090)
Or:

  (1...i).reduce(0) { $0 + g($1) }