Readability

From APL Wiki
Revision as of 15:44, 24 September 2020 by Adám Brudzewsky (talk | contribs) (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. =...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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 ⍬