News for hackers. Stuff that matters.
Re:What if you couldn’t program with loops? by bctnry on Monday July 15, 2019 @12:33AM (#20438142)
I was hoping for APL/J-style stuff or something like using `map` and `forEach` but no. That's a big letdown.
Re:What if you couldn’t program with loops? by necovek on Monday July 15, 2019 @01:02AM (#20438275)
I would consider those "some kind of loop".
Re:What if you couldn’t program with loops? by squiggleblaz on Monday July 15, 2019 @01:53AM (#20438484)
I was hoping for a massive parallel solution! You just run the same function on a million cores at once, with different inputs.

But I think there's a big difference between a language that lets you expect that iteration b will happen after iteration a, vs a language that merely gives you guarantee the result is derived from application of the function onto the necessary inputs.

The latter can be correctly parallelised, but the former can only ever be executed in serial. `map f [1,2,3]` (in Haskell) can be solved in parallel or in serial. `[1,2,3].map(f)` (in modern JS) must be executed in serial, since f might be the result of `() => { var j = 0; return (i) => { j += i; return j }}`.

Re:What if you couldn’t program with loops? by akavi on Monday July 15, 2019 @10:27AM (#20441118)
`map` is strictly less "powerful" than a "loop", so I'd argue that's misleading.

Which I'd also argue is a good thing. Using the least powerful construct available both communicates to future readers of the code, and allows higher level optimization (eg, `map` is trivially parallelizable, an arbitrary loop is not)

Re:What if you couldn’t program with loops? by thaumasiotes on Monday July 15, 2019 @03:35PM (#20444345)
But `map` is not a primitive. It's just a function implemented with... a loop. It's hard to argue that that doesn't make it "some kind of loop".
Re:What if you couldn’t program with loops? by myhf on Monday July 15, 2019 @02:14AM (#20438554)
For some clarification of the "loopless" terminology in J:

https://code.jsoftware.com/wiki/Vocabulary/Loopless