R (programming language)
“Pirates code in R.”
R is the name of an esoteric programming language used by pirates. It has no functions, because pirates never return anything. It is an object-oriented programming language that implements data hiding through multiple instances of a pointer referred to as "X" so no one knows where the real treasure is buried.
R has been criticized by Microsoft, Apple, Google, Mozilla, Linux and Your Mom for enabling a perfectly legal form of software piracy. From a technical perspective, it's lack of support for and discriminatory license restrictions against ninjas have gotten heated criticism from some self-appointed people who think they know something. Nevertheless, R remains the definitive programming language for pirates.
Example R programs[edit | edit source]
"Hello World!" in R[edit | edit source]
R! Ahoy, mayteys! Aye, polly is a parrot that tells the crew what the Captain is thinkin'. Gar. Ahoy, polly says, "Hello World!" Dead men tell no tales.
Line-by-line analysis of the above code[edit | edit source]
R! Ahoy, mayteys!
The phrase, "R!" tells the compiler that this is definitely an R program and it should not attempt to compile it for the benefit of a ninja. while "Ahoy, mayteys!" shows the program is entering the main function.
Aye, polly is a parrot that tells the crew what the Captain is thinkin'. Gar.
Parrots are how R refers to input and output streams. "the crew" refers to the user and "the Captain" refers to the R program itself. "Gar." tells R to wait until the constructor for the parrot class has finished running, then go on. We could name the parrot anything, but polly is an oft-used default term in the pirate community and does not cause conflicts because each pirate has his own parrot namespace, referred to as a "ship."
Ahoy, polly says, "Hello World!"
This would send the text, "Hello World!" to whatever the R interpreter has specified as the output for the program.
Dead men tell no tales.
This terminates an R program.
Iterative Fibonacci Algorithm Implementation in R[edit | edit source]
- Compare this with the Fibonacci algorithm implemented in several other, more popular programming languages
R! Ahoy, mayteys! Aye, polly is a parrot that tells the crew what the Captain is thinkin'. Gar. Arrr, polly eats a number o' crackers gi'en t' her by the crew. A pence for an old man o'de sea? Aye, i have one gold piece in my purse. Ye'll ne'er get me buried booty! Arrr, i have no gold in my boots. Ye'll ne'er get me buried booty! Arrr, x marks the spot whar the captain's treasure is buried Ye'll ne'er get me buried booty! Aye, x is a pace away for each cracker Polly ate. Gar, Where can I find a bottle o'rum? Ahoy, the amount o' gold in my treasure chest is the same as the amount o' gold in my purse and in my boots put together. A pence for an old man o'de sea? Aye, the amount o' gold in my purse is the same as in my boots. A pence for an old man o'de sea? Ahoy, the amount o' gold in my purse is the same as the amount o' gold in my treasure chest. A pence for an old man o'de sea? x marks the spot! Ahoy, polly says how much gold is in my treasure chest. Aye, me parrot concurs. Dead men tell no tales.