Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site cornell.UUCP Path: utzoo!watmath!clyde!burl!mgnetp!ihnp4!houxm!houxz!vax135!cornell!gj From: gj@cornell.UUCP (Greg Johnson) Newsgroups: net.lang.apl Subject: another bug with scan... Message-ID: <565@cornell.UUCP> Date: Sat, 23-Jun-84 13:20:42 EDT Article-I.D.: cornell.565 Posted: Sat Jun 23 13:20:42 1984 Date-Received: Wed, 27-Jun-84 09:04:23 EDT Organization: Cornell Univ. CS Dept. Lines: 38 Lee Dickey mentioned that the scan operator in APL 11 does not work right for some non-associative operators. Here is another error: +\ iota 0 0 rho rho +\ iota 0 0 m { 1 2 0 3 rho 0 n { 1 2 3 0 rho 0 +\m rho rho +\m 1 2 0 3 +\n 0 rho rho +\n 0 It turns out that at least in the APL distributed with 4.2 BSD UNIX the problem illustrated above is easy to fix. The result of applying the scan operator to a function and then to some data is ALWAYS supposed to have the same shape as the data. If the last dimension of the data is zero, then the interpreter tries to return (as a scalar) the identity element of the function used with scan. In module ak.c there is an explicit test to see whether the last dimension is zero, and if it is the appropriate identity element is created. This entire "if" statement (it is about thirty lines long) can simply be commented out. Its first line is: if(idx.dimk == 0) { I found this bug while figuring out a solution to the "runs and wedges" problem of a few articles back. - Greg Johnson ...!ihnp4!cornell!gj gj@cornell