The Golden Crema: Appendices and Afterwords
How to run the examples
At the time this book was written, ECMAScript 2015 was not yet widely available. All of the examples in this book were tested using either Google Traceur Compiler, Babel, or both. Traceur and Babel are both transpilers, they work by parsing ECMAScript 2015 code, then emitting valid ECMAScript-5 code that produces the same semantics.
For example, this ECMAScript 2015 code:
const before = (decoration) =>
(method) =>
function () {
decoration.apply(this, arguments);
return method.apply(this, arguments)
};
Is translated into this ECMAScript-5 code:
"use strict"
var before = function (decoration) {
return function (method) {
return function () {
decoration.apply(this, arguments);
return method.apply(this, arguments);
};
};
};
If we make it even more idiomatic, we could write:
const before = (decoration) =>
(method) =>
function (...args) {
decoration.apply(this, args);
return method.apply(this, args)
};
And it would be “transpiled” into:
var before = function (decoration) {
return function (method) {
return function () {
for (let _len = arguments.length, args = Array(_len), _key = 0; _key < _le\
n; _key++) {
args[_key] = arguments[_key];
}
decoration.apply(this, args);
return method.apply(this, args);
};
};
};
Both tools offer an online area where you can type ECMAScript code into a web browser and see the ECMAScript-5 equivalent, and you can run the code as well. To see the result of your expressions, you may have to use the console in your web browser.
So instead of just writing:
(() => 2 + 2)()
And having 4 displayed, you’d need to write:
console.log(
(() => 2 + 2)()
)
And 4 would appear in your browser’s development console.
You can also install the transpilers on your development system and use them with Node on the command line. The care and feeding of node and npm are beyond the scope of this book, but both tools offer clear instructions for those who have already installed node.
Thanks!
Daniel Friedman and Matthias Felleisen
JavaScript Allongé was inspired by The Little Schemer by Daniel Friedman and Matthias Felleisen. But where The Little Schemer’s primary focus is recursion, JavaScript Allongé’s primary focus is functions as first-class values.
Richard Feynman
Richard Feynman’s QED was another inspiration: A book that explains Quantum Electrodynamics and the “Sum of the Histories” methodology using the simple expedient of explaining how light reflects off a mirror, and showing how most of the things we think are happening–such as light travelling on a straight line, the angle of reflection equalling the angle of refraction, or that a beam of light only interacts with a small portion of the mirror, or that it reflects off a plane–are all wrong. And everything is explained in simple, concise terms that build upon each other logically.
Reading JavaScript Allongé on Kindle
JavaScript Allongé has over 400 pages and many photographs. For this reason, the .mobi version of the book is too big to be sent to your Kindle via email, and that is the feature that LeanPub uses when you purchase the book.
So, if you wish to read JavaScript Allongé on your Kindle:
- Download it to your Windows or OS X device (a/k/a “PC” or “Macintosh”).
- Use Send to Kindle for PC or Send to Kindle for Mac to send it to the Kindle.
- From time to time while editing, an uncompressed image sneaks into the manuscript. When this happens, the
.mobimay exceed the 50MB limit for the Send to Kindle desktop application. If this happens, please attach your Kindle to your computer with a USB cable and synchronize directly.
Thank you!
Copyright Notice
The original words in this book are (c) 2012-2015, Reginald Braithwaite. All rights reserved.
images
- The picture of the author is (c) 2008, Joseph Hurtado, All Rights Reserved.
- Cover image (c) 2010, avlxyz. Some rights reserved.
- Double ristretto menu (c) 2010, Michael Allen Smith. Some rights reserved.
- Short espresso shot in a white cup with blunt handle (c) 2007, EVERYDAYLIFEMODERN. Some rights reserved.
- Espresso shot in a caffe molinari cup (c) 2007, EVERYDAYLIFEMODERN. Some rights reserved.
- Beans in a Bag (c) 2008, Stirling Noyes. Some Rights Reserved.
- Free Samples (c) 2011, Myrtle Bech Digitel. Some Rights Reserved.
- Free Coffees image (c) 2010, Michael Francis McCarthy. Some Rights Reserved.
- La Marzocco (c) 2009, Michael Allen Smith. Some rights reserved.
- Cafe Diplomatico (c) 2011, Missi. Some rights reserved.
- Sugar Service (c) 2008 Tiago Fernandes. Some rights reserved.
- Biscotti on a Rack (c) 2010 Kirsten Loza. Some rights reserved.
- Coffee Spoons (c) 2010 Jenny Downing. Some rights reserved.
- Drawing a Doppio (c) 2008 Osman Bas. Some rights reserved.
- Cupping Coffees (c) 2011 Dennis Tang. Some rights reserved.
- Three Coffee Roasters (c) 2009 Michael Allen Smith. Some rights reserved.
- Blue Diedrich Roaster (c) 2010 Michael Allen Smith. Some rights reserved.
- Red Diedrich Roaster (c) 2009 Richard Masoner. Some rights reserved.
- Roaster with Tree Leaves (c) 2007 ting. Some rights reserved.
- Half Drunk (c) 2010 Nicholas Lundgaard. Some rights reserved.
- Anticipation (c) 2012 Paul McCoubrie. Some rights reserved.
- Ooh! (c) 2012 Michael Coghlan. Some rights reserved.
- Intestines of an Espresso Machine (c) 2011 Angie Chung. Some rights reserved.
- Bezzera Espresso Machine (c) 2011 Andrew Nash. Some rights reserved. *Beans Ripening on a Branch (c) 2008 John Pavelka. Some rights reserved.
- Cafe Macchiato on Gazotta Della Sport (c) 2008 Jon Shave. Some rights reserved.
- Jars of Coffee Beans (c) 2012 Memphis CVB. Some rights reserved.
- Types of Coffee Drinks (c) 2012 Michael Coghlan. Some rights reserved.
- Coffee Trees (c) 2011 Dave Townsend. Some rights reserved.
- Cafe do Brasil (c) 2003 Temporalata. Some rights reserved.
- Brown Cups (c) 2007 Michael Allen Smith. Some rights reserved.
- Mirage (c) 2010 Mira Helder. Some rights reserved.
- Coffee Van with Bullet Holes (c) 2006 Jon Crel. Some rights reserved.
- Disassembled Elektra (c) 2009 Nicholas Lundgaard. Some rights reserved.
- Nederland Buffalo Bills Coffee Shop (c) 2009 Charlie Stinchcomb. Some rights reserved.
- For the love of coffee (c) 2007 Lotzman Katzman. Some rights reserved.
- Saltspring Processing Facility Pictures (c) 2011 Kris Krug. Some rights reserved.
- Coffee and Mathematics (c) 2007 Some rights reserved.
- Coffee and a Book (c) 2009 Some rights reserved.
- Stacked Coffee Cups (c) 2010 Sankarshan Sen. Some rights reserved.
- Coffee Cow (c) 2012 Candy Schwartz Some rights reserved.
- CERN Coffee (c) 2005 Karoly Lorentey Some rights reserved.
- Coffee Labels (c) 2011 Kris Krüg Some rights reserved.
- banco do café (c) 2008 Fernando Mafra Some rights reserved.
- coffee pots (c) 2009 Jonas Forth Some rights reserved.
- 5 Barrel Roaster (c) 2013 David Lytle Some rights reserved.
- Pantone mugs (c) 2011 Joe Wolf Some rights reserved.
- Coffee and Chess (c) 2013 Adam Tinworth Some rights reserved.
- Vac Pot Upper Chamber (c) 2007 Michael Allen Smith Some rights reserved.
- Decaf espresso (c) 2009 Aris Vrakas Some rights reserved.
- Con Panna (c) 2013 Vee Satayamas Some rights reserved.
- Tiny’s Coffeehouse (c) 2004 Peter Merholz Some rights reserved.
- Thinking about programming (c) 2011 Renaud Camus Some rights reserved.
- Biscotti og kaffe (c) 2008 Some rights reserved.
- Espresso, Empty (c) 2012 Till Westermayer Some rights reserved.
- The End (c) 2013 peddhapati Some rights reserved.
- The Future of Coffee is Black (c)2013 mjaysplanet Some rights reserved.
About The Author
When he’s not shipping JavaScript, Ruby, CoffeeScript and Java applications scaling out to millions of users, Reg “Raganwald” Braithwaite has authored libraries for JavaScript, CoffeeScript, and Ruby programming such as Allong.es, Method Combinators, Katy, JQuery Combinators, YouAreDaChef, andand, and others.
He writes about programming on “Raganwald,” as well as general-purpose ruminations on “Braythwayt Dot Com”.
contact
Twitter: @raganwald Email: reg@braythwayt.com