Right-to-left (was: Re: entry at other than main)

Dolf Grunbauer dolf at idca.tds.PHILIPS.nl
Fri Aug 25 16:45:23 AEST 1989


In article <10731 at riks.csl.sony.co.jp> diamond at riks. (Norman Diamond) writes:
>APL is the infamous right-to-left language.  (APL hackers know that
>theirs is the only correct language, because right-to-left prioritizing
>is the same as in English.  [stuff deleted])
>Norman Diamond, Sony Computer Science Lab (diamond%csl.sony.jp at relay.cs.net)

I was told that due to the many operators of APL, it is very hard (read:
impossible) to assign them a priority. So what they did was saying:
let's give them all the same priority and evaluate an expression like:
   x <- 3 * 4 + 5  (the '<-' in APL is '=' in C)
x becomes what is right of it, which is 3 times what is right of it,
which is 4 plus what is right of it, which is 5 and nothing to the right.
In other words: x <- 3 * (4 + (5))), or x = 27 (where in C x would be 17).
So, the evaluation is from left to right, but the result is easier to
understand when you read it from right to left. 
For those unknown to APL: do you know that APL is so compact that an
algorithm to get the first N primes can be written in just *ONE* expression
(of about 25 characters), including the reading of N from the terminal ?
Another interresting thing of APL is that it is impossible to write a
compiler for APL, and that is why there are only interpreters for APL.

-- 
Dolf Grunbauer          Tel: +31 55 432764  Internet dolf at idca.tds.philips.nl
Philips Telecommunication and Data Systems  UUCP ....!mcvax!philapd!dolf
Dept. SSP, P.O. Box 245, 7300 AE Apeldoorn, The Netherlands



More information about the Comp.lang.c mailing list