Changes

Jump to navigation Jump to search

Readability

972 bytes added, 15:44, 24 September 2020
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. =..."
'''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 [[Books#APL_.E2.80.95_An_Interactive_Approach|APL – an Interactive Approach]], the authors the authors describe the following code as “almost pornographic”:<!--- Intentionally not syntax coloured --->
:<code>r←(+/x×y)÷((+/(x←x-(+/x)÷⍴x)*2)×+/(y←y-(+/y)÷⍴y)*2)×.5</code>

The [[APL2]] Idiom list includes the following entry:
:{| style=width:100%
|<source lang=apl inline>X←'line1',0⍴Y←'line2'</source>||<source lang=apl inline>⍝ Pornography. Combining two lines into one.</source>
|}
[[Morten Kromberg]] asked one of his colleagues to “Please avoid this kind of pornography:”
:<source lang=apl inline>
ns(⍎container.⎕NS)←⍬
</source>
A much more readable version would be:
:<source lang=apl inline>
ns←⍎ns container.⎕NS ⍬
</source>

Navigation menu