Changes

Jump to navigation Jump to search

Readability

3 bytes removed, 09:21, 27 September 2020
m
no edit summary
=== Gilman & Rose ===
In [[Books#APL_.E2.80.95_An_Interactive_Approach|APL ― An Interactive Approach]], the authors describe the following code, which computes the correlation coefficient, as “almost pornographic”:
:<source lang=none apl inline>r←(+/x×y)÷((+/(x←x-(+/x)÷⍴x)*2)×+/(y←y-(+/y)÷⍴y)*2)×.5</source>
By splitting the expression intro even a moderate number of pieces, a symmetry is revealed:
<source lang=noneapl>yVar←+/(y-(+/y)÷⍴y)*2
xVar←+/(x-(+/x)÷⍴x)*2
r←(+/x×y)÷(xVar×yVar)×0.5</source>
The Multics APL manual goes on to use the terms ''monstrosity'' and ''eyesore'' for code published in an APL newsletter, such as
:<source lang=none apl inline>Z[B+(C∧X∊D)/⍳⍴X;]+(24p' Y9 X9 ')[(C←(-≠\''''=X)∧A≤⍴D)/A←(D←'⍵⍺')⍳X;]</source>
The manual suggests that this code should be split into the following expressions:
<source lang=apl>

Navigation menu