Author: Angus Croll
His book opens with the account of a dream in which he assigned homework to Ernest Hemingway and 24 other "literary luminaries". Prior to writing the book trying this formula with Ernest Hemingway led to a well received blog post.
As Croll puts it in the Introduction:
JavaScrpt has plenty in common with natural language. It is at its most expressive when combining simple idioms in original ways; its syntax, which is limited yet flexible, promotes innovation without compromising readability.
The book adopts a formulaic approach. There are five Assignment sections - Fibonacci, Factorial, Happy Numbers, Prime Numbers and Say It - and in each five famous authors submit their answers to a programming problem that is briefly described on the before we meet the "students" who are asked to tackle it.
Jane Austen's solution to wring a function that returns a factorial manages to work in her most quoted line
James Joyce also tackles this problem and his variable names include what Croll describes as "amusingly intuitive portmanteaus" which are characteristic of his writing.
The assignment to write a function that determines if the supplied argument supplied is a happy number is handed out to Geoffrey Chaucer and some unlikely fellow travellers, J.D Salinger, Tupak Shakur, Virginia Woolf and Vladimir Nabokov, demonstrating an eclectic taste in literature.
Douglas Adams' comment at the start of his program to return prime numbers is amusing - and predictable once you've seen it:
The final section is a non-mathematical exercise - to write a chainable function. This provides an opportunity to introduce the work of Sylvia Plath, Italo Calvino. J.K. Rowling and Arundhati Roy. It also includes a program that fails. In the solution proposed by Franz Kafka the function invokes itself again and again and begins recursing endlessly with no hope of redemption. Which as, Croll points out, is very Kafkaesque.
|Last Updated ( Monday, 12 January 2015 )