Content deleted Content added
Array operations vs "structured programming" |
|||
Line 96:
It's not that structured programming is an absolute '''good''' in and of itself, but is, rather, a '''gimmick''' required to bring some semblance of order to more primitive programming languages lacking sophisticated array capabilities.
[[User:Dav4is|-R.]] 21:46, 2005 May 23 (UTC)
: I think that is going a bit far, and I am a full-time APL programemr, and a former chair of ACM/SIGAPL. It might be more accurate to say that in many cases structured programming and array operations can achieve the same result with different methods. There are some cases where other languages use structured constructs to do array processing. In particular the FOR loop was origianlly designed as a way to loop through the elements of an array in early FORTRAN, although it has been used for other purposes since. On the other hand, I have frequently seen array constructs used basically to simulate a classic structured construct in APL. For example the code:
:{branch to} (<vector of line labels>)[<vector of possible values> {iota} {current value}
:is a common APL idiom used to simulate a CASE structure, and used for exactly toe purpsoe of a classic case structure, i.e. to transfer control to one of several code sections based on the current value of a varaible or expression, such that each possible value has a code section associated with it.
:The general purpose of structured programming is to organize the flow of control. The general purpose of array operations is to organize the data and provide specialized tools to work with it without needing explicit contol flow for the low-level element-by-element processing. But many, indeed most significant, APL programs still need to manage control flow. Classic APL did this by simulating the structured constructs in most cases. Modern APL generally incorporates versions of structured programming constructs, such as ":IF/:ElseIf/:Else/:EndIf", ":Repeat/:Until", and ":For/:In/:EndFor" and the like. [[User:DESiegel|DES]] 21:25, 24 May 2005 (UTC)
|