4 ms·
C++ devs are encouraged to do loopless programming by using algorithms in the standard library; plus C++20 ranges should improve the ease of loopless programmin
by stabbles 7y ago
C++ devs are encouraged to do loopless programming by using algorithms in the standard library; plus C++20 ranges should improve the ease of loopless programming.
Where J shines is array based programming. The C++ algorithms are concerned with vectors, but in J you can combine matrices, vectors and scalars in concise expressions.
- 7thaccount 7y agoMy favorite example is not the commonly seen average function in the J library (avg:= +/ % $), but the one that Dyalog APL has with their interactive tutorial that looked a little weird to me until I figured out it didn't just work over lists, but arbitrary dimensions like an array of 2x2 matrices. I just laughed to myself...oh what magic the gods have wrought. Unfortunately, my programming needs are high performance scientific computing where APL just doesn't have enough horsepower in most cases (J has some ability to call out to BLAS/LAPACK, but Julia makes it so easy to work with sparse matrices that it has become my go-to Lang for that work) and I also do scripting (Python, Bash, Powershell, and a little Perl6) and J/APL are a little awkward in these areas IMO.
- blt 7y agoThe C++ <algorithm> library has a huge limitation: algorithms return a single iterator that cannot be further consumed by other algorithms. This makes it impossible to chain algorithms in a manner like LINQ. The ranges library will make a dramatic difference for this programming style.