Readability
Revision as of 16:29, 24 September 2020 by Adám Brudzewsky (talk | contribs) (Adám Brudzewsky moved page Pornography to Readability: Avoid censorship)
Pornography is a term traditionally used by APLers to describe code that is hard to read, or uses unusual constructs. Code golf often results in pornographic code.
Examples
In APL – an Interactive Approach, the authors the authors describe the following code as “almost pornographic”:
r←(+/x×y)÷((+/(x←x-(+/x)÷⍴x)*2)×+/(y←y-(+/y)÷⍴y)*2)×.5
The APL2 Idiom list includes the following entry:
X←'line1',0⍴Y←'line2'
⍝ Pornography. Combining two lines into one.
Morten Kromberg asked one of his colleagues to “Please avoid this kind of pornography:”
ns(⍎container.⎕NS)←⍬
A much more readable version would be:
ns←⍎ns container.⎕NS ⍬