Dan Bron wrote: >> The history of languages can be fascinating. > .... >> try to provide some of the 'nice' features of APL. > > I'm just really shocked that the "mainstream" languages haven't caught on > to / at the very least, yet. > > Who volunteers to write "For statement considered harmful"? > > -Dan >
I have never understood why more languages did not get the idea of having a statement applying a function to each element of an array. Here's a bit of history and speculation. For statements had their genesis in FORTRAN DO loops. Here's a program in original FORTRAN (circa 1956) from http://www.nsc.liu.se/~boein/f77to90/a7.html#f0 DIMENSION A(11) READ A 2 DO 3,8,11 J=1,11 3 I=11-J Y=SQRT(ABS(A(I+1)))+5*A(I+1)**3 IF (400>=Y) 8,4 4 PRINT I,999. GOTO 2 8 PRINT I,Y 11 STOP In the DO loop, the 3 statement numbers give the beginning and end of the body, and the next statement after the loop terminates. I think this was directly representable in IBM 704 assembly language. A statement which iterated through an entire array should have been a natural in FORTRAN, but it never happened. It may have been the hardware. Applying a function to a list appeared in the first significant LISP application, symbolic differentiation, in 1958. The operator (now called mapcar) was called maplist. This may not have been easily generalizable at the time to arrays because LISP lists are contrued recursively, not "flat" like an array. Perl is finally contemplating moving in an APL direction with "hyperoperators": see RFC 082 in http://dev.perl.org/perl6/doc/design/apo/A03.html Best wishes, John ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
