Readability: Difference between revisions

From APL Wiki
Jump to navigation Jump to search
(Created page with "'''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. =...")
 
m (Adám Brudzewsky moved page Pornography to Readability: Avoid censorship)
(No difference)

Revision as of 16:29, 24 September 2020

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 ⍬