🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: net.lang.apl
Article #99

problem: find a linear-time algorithm...

#99
From: gjohnson
Date: Tue, 22 May 1984 15:01
32 lines
2113 bytes
Here is a problem/challenge:  Say you have two vectors A and B of
length n, and both of them are in ascending numeric order.  Write an
APL expression which sums those elements of B which occur somewhere in
A, and which operates in linear time.  Alternatively, prove that there
is no such APL expression.  (I have not solved this problem, but it
seems to me that the latter alternative more likely.)

There are a few ways to appropriately restrict the set of allowable
expressions.  For instance, there is an annual contest to take the
digits of the current year and write the shortest expressions involving
those digits which evaluate to each of the numbers from 1 to 100.  The
contest has certain rules about permissible APL expressions.

Assuming that "epsilon" operates in (m+n)log( n ) time, an nlog( n )
expression is:

	+/( B epsilon A ) / B

In a conventional programming language, one can write a loop which in
effect merges the two lists, and detects elements of B which occur in
A.  Of course, such a program would be unintelligible without careful
study, whereas anyone who knows APL would immediately recognize what
the above phrase does; in fact, the phrase might even be taken as a
specification of the problem.

Several researchers are active in "program transformation" techniques.
Might it be possible to extend APL so that one could take an easily
understandable APL expression and algebraically transform it into an
equivalent efficient but perhaps unintelligible expression?

				 - Greg Johnson
				   gjohnson@cornell
Technical Details
Message-ID: <118@cornell.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!burl!ulysses!mhuxl!houxm!hogpc!houti!ariel!vax135!cornell!gjohnson

Show Full Headers
Complete Article Headers
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: arc1-ca.pugleaf.net!utzoo!watmath!clyde!burl!ulysses!mhuxl!houxm!hogpc!houti!ariel!vax135!cornell!gjohnson
From: gjohnson@cornell.UUCP
Newsgroups: net.lang.apl
Subject: problem:  find a linear-time algorithm...
Message-ID: <118@cornell.UUCP>
Date: Tue, 22-May-84 11:01:01 EDT
Article-I.D.: cornell.118
Posted: Tue May 22 11:01:01 1984
Date-Received: Wed, 23-May-84 09:20:52 EDT
Organization: Cornell Univ. CS Dept.
Lines: 32