Hey Roger:
While I do think that in and of themselves, many of these examples are
rather impressive to some degree, I do find that among PL researchers this
is not nearly as impressive, since many of them work on languages that
have similar things. For example, many would say that such things are not
so bad in other languages like Haskell or Scheme. If you know anything
about these other languages and can compare for me what you think, I would
appreciate it. In particular, I'm quite interesting in hearing what other
APLers think are the really differentiating features of APL compared to
other frontier PL languages. Granted, of course, APL is actually a mature,
very delivered product, while many research languages are quite
unfinished, but I do not think that we can say this about languages like
ArBB, Haskell, Scheme, ML, or Matlab. Here are some examples of those when
encoded into Scheme:
(map + x y) ; X and Y must be lists
(map * x y) ; X and Y must be lists
(map max x y) ; X and Y must be lists
(fold-left + 0 x) ; X must be a list
(fold-left * 1 x) ; X must be a list
(fold-left max -inf.0 x) ; X must be a list
(list-sort < ages) ; AGES must be a list
(map car (list-sort (lambda (x y) (< (cdr x) (cdr y))) (map cons names
ages)))
; NAMES and AGES must be lists
To some extent these are not as flexible as the APL primitives, and I
think that's a key difference, from my perspective. These primitives are a
lot nicer because they are much more generic than some of the equivalent
expressions in other languages, and as such, require less mental overhead
to work with. On the other hand, some might argue that this isn't such a
big deal.
On Mon, 30 Jan 2012 19:42:36 -0500, Roger Hui <
rogerhu...@gmail.com>
wrote:
> Long time APL/J users (myself included) sometimes forget that many
> simple expressions are impressive even though they are "old hat" and
> likely taught on the first day of an introductory APL course. For
> example:
>
> x+y - x plus y where x and y can be scalar, vector, matrix, ...
> x×y - x times y where x and y can be scalar, vector, matrix, ...
> x⌈y - x max y where x and y can be scalar, vector, matrix, ...
>
> +⌿x - the sum of x
> ×⌿x - the product of x
> ⌈⌿x - the maximum of x
>
> ⍋ages - the indices that would put ages in ascending order
> ages[⍋ages] - sort ages
> names[⍋ages;] - names sorted by ages
>
> If you don't think these are impressive, try writing them in any other
> programming language.
--
Aaron W. Hsu |
arc...@sacrideo.us |
http://www.sacrideo.us