liveBook · Manning

Rot13

As explained in Functional Programming in JavaScript

A simple substitution cipher that rotates alphabetic characters by 13 positions.

ROT13 rotates alphabetic characters by 13 positions, producing the same output for the same input string. That stable result makes it useful as a memoization example and as a small web trick for hiding puzzle answers or discount codes. section 7.3

The treatment focuses on why a repeatable function benefits from caching, then shows ROT13 as the concrete case. It stays at the level of usage and performance benefit rather than detailing the cipher rules. section 7.3

ROT13 discount code

A discount code like functional_js_50_off becomes shapgvbany_wf_50_bss after ROT13, showing the cipher on a real string.

How Functional Programming in JavaScript covers it

How deep it goes
Defines ROT13 briefly and stops short of the full cipher details, using it mainly as a performance example.
Examples
Uses a discount-code string and repeated calls to show encoded output and cache reuse.
What it assumes
Assumes only basic string handling and introduces the idea of a repeatable pure result from zero.
What you can do after
Apply it via memoization and get faster repeated calls from cached results.
How it connects
Connects to memoization, referential transparency, caching, and performance timing.

Also explained in

Compare how 3 books explain rot13 →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Functional Programming in JavaScript. The section links point to the parts of the book it draws on.