Re:From Competitive Programming to APL
by forgotpwd16 on Friday June 04, 2021 @06:09AM
(#27392161)
For starters, it can be argued that it remains closer to mathematical notation. Example:
which can be written, but then kinda differs from APL approach of combining primitives
compared to
Also the statement is more succinct, and that is better understood when you compare an APL one-liner with a multi-line code in the other two languages. I think this is its true strength.
[ Parent
| on HN ]
The compactness of APL is indeed quite intriguing. One could also write your example in Julia by:
sum(j -> j*2.0^(-j),1:n)
sum(function,array) applies function to all elements of array before the summation (without need to allocate an intermediate array).
I think the Fortran equivalent using an implied do-loop is
sum([(j*2**(-j),j=1,n)])
Modern Fortran is arguably an array programming language. It has array operations like Matlab, Python/Numpy, and R.I find it weird that that's called "modern" Fortran when that came with Fortran 90. Then I remember that even in 2010 academics (perhaps one of the biggest producers of Fortran today) still seemed to be hung up on F77.
You are right that the Fortran community took a long time adopt standards later than F77. Gfortran handles Fortran 90 and 95 well now, and I think F2003 and F2008 (although I don't use too many features from those standards and cannot say for sure from personal experience). I don't remember how mature gfortran was in 2010. Maybe then g95 was more mature.