Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site decwrl.UUCP Path: utzoo!linus!security!genrad!decvax!decwrl!daemon From: daemon@decwrl.UUCP Newsgroups: net.lang Subject: APL order of evaluation Message-ID: <4213@decwrl.UUCP> Date: Mon, 21-Nov-83 07:52:19 EST Article-I.D.: decwrl.4213 Posted: Mon Nov 21 07:52:19 1983 Date-Received: Tue, 22-Nov-83 01:57:40 EST Sender: daemon@decwrl.UUCP Organization: DEC Western Research Lab, Los Altos, CA Lines: 39 From: Ed Featherston HL01-1/P06 225-5241 Begin Forwarded Message: ------------------------------------------- Newsgroup : net.lang >From : ORPHAN::BLICKSTEIN Organization : Digital Equipment Corp. Subject: APL order of evaluation. Your original program was correct. First, your program contained no APL operators. Operators in APL are quasi-functions that take other functions as arguments like +/ (reduction is the operator and it has + as an argument). The other operators are compression, inner & outer product, etc. APL functions are more than right associative. They are evaluated right to left. this means that for I+I<-1 the assignment (assignment is a function in APL) happens before the addition and so I has a value before the arguments to addition are evaluated. Also, there is a defined order for argument evaluation: right to left again. This means that (I <- 2) + I <-3 is 5, not 4. Because of the right to left rule, any expression which contains two adjacent right parenthesis has redundant parenthesis, as in your corrected version. Dave Blickstein Technical Languages Digital Equipment Corp. Mail address : ...decvax!decwrl!rhea!orphan!blickstein ------------------------------------------- End Forwarded Message