From f7692c92ce61c277a3f9a38c6bdbe712730d040a Mon Sep 17 00:00:00 2001 From: Jeremy Ashkenas Date: Thu, 29 Jan 2015 12:25:25 -0500 Subject: [PATCH] more text tweaks --- documentation/index.html.js | 18 ++--- index.html | 136 ++++++++++++++++++------------------ 2 files changed, 77 insertions(+), 77 deletions(-) diff --git a/documentation/index.html.js b/documentation/index.html.js index e3e9f982..1c59c6af 100644 --- a/documentation/index.html.js +++ b/documentation/index.html.js @@ -34,7 +34,7 @@ Operators and Aliases Classes, Inheritance, and Super Destructuring Assignment - Function Binding + Bound and Generator Functions Embedded JavaScript Switch and Try/Catch Chained Comparisons @@ -416,13 +416,6 @@ Expressions if the incoming argument is missing (null or undefined).

<%= codeFor('default_args', 'fill("cup")') %> -

- CoffeeScript function support - ES6 generator functions - through the yield keyword. There's no function*(){} - nonsense — a generator in CoffeeScript is simply a function that yields. -

- <%= codeFor('generators', 'ps.next().value') %>

@@ -800,7 +793,7 @@ Expressions

- Function binding + Bound Functions, Generator Functions In JavaScript, the this keyword is dynamically scoped to mean the object that the current function is attached to. If you pass a function as a callback or attach it to a different object, the original value of this @@ -827,6 +820,13 @@ Expressions be automatically bound to each instance of the class when the instance is constructed.

+

+ CoffeeScript functions also support + ES6 generator functions + through the yield keyword. There's no function*(){} + nonsense — a generator in CoffeeScript is simply a function that yields. +

+ <%= codeFor('generators', 'ps.next().value') %>

diff --git a/index.html b/index.html index 3678923e..9fb46c01 100644 --- a/index.html +++ b/index.html @@ -34,7 +34,7 @@ Operators and Aliases Classes, Inheritance, and Super Destructuring Assignment - Function Binding + Bound and Generator Functions Embedded JavaScript Switch and Try/Catch Chained Comparisons @@ -576,44 +576,6 @@ fill = function(container, liquid) { return "Filling the " + container + " with " + liquid + "..."; }; ;alert(fill("cup"));'>run: fill("cup")
-

- CoffeeScript function support - ES6 generator functions - through the yield keyword. There's no function*(){} - nonsense — a generator in CoffeeScript is simply a function that yields. -

-
perfectSquares = ->
-  num = 0
-  loop
-    num += 1
-    yield num * num
-  return
-
-window.ps or= perfectSquares()
var perfectSquares;
-
-perfectSquares = function*() {
-  var num;
-  num = 0;
-  while (true) {
-    num += 1;
-    (yield num * num);
-  }
-};
-
-window.ps || (window.ps = perfectSquares());
-
load
run: ps.next().value

@@ -663,7 +625,7 @@ kids = { age: 9 } }; -

load
load
load

+
load

@@ -725,7 +687,7 @@ changeNumbers = function

load
load
load

+
load

@@ -866,7 +828,7 @@ alert("Gold: " + gold); alert("Silver: " + silver); alert("The Field: " + rest); -

load
load
, 'spinach'< eat(food); } } -
load

+
load

Comprehensions should be able to handle most places where you otherwise would use a loop, each/forEach, map, or select/filter, for example: @@ -953,7 +915,7 @@ countdown = (functionreturn _results; })(); -

load
load
load
load
load
load
load

+
load

@@ -1145,7 +1107,7 @@ middle = numbers.slice(3, -22); copy = numbers.slice(0); -

load
load
load
load
load
load
load
load
run: six

@@ -1271,7 +1233,7 @@ globals = ((functionreturn _results; })()).slice(0, 10); -
load
load
load
load
load

+
load

The Existential Operator @@ -1454,7 +1416,7 @@ speed = 0; } footprints = typeof yeti !== "undefined" && yeti !== null ? yeti : "bear"; -

load
load
load

+
load

Soaking up nulls is similar to Ruby's andand gem, and to the @@ -1594,7 +1556,7 @@ tom = new Horse("Tommy the Pal sam.move(); tom.move(); -

load
load
load
load
run: "one_two".dasherize()

@@ -1703,7 +1665,7 @@ theBait = 1000; theSwitch = 0; _ref = [theSwitch, theBait], theBait = _ref[0], theSwitch = _ref[1]; -
load
load
load
load
load
load
load
load
load
load
load
load
\n @customer.purchase @cart"
load

+
load

If we had used -> in the callback above, @customer would have referred to the undefined "customer" property of the DOM element, @@ -1913,6 +1875,44 @@ Account = function +

+ CoffeeScript functions also support + ES6 generator functions + through the yield keyword. There's no function*(){} + nonsense — a generator in CoffeeScript is simply a function that yields. +

+
perfectSquares = ->
+  num = 0
+  loop
+    num += 1
+    yield num * num
+  return
+
+window.ps or= perfectSquares()
var perfectSquares;
+
+perfectSquares = function*() {
+  var num;
+  num = 0;
+  while (true) {
+    num += 1;
+    (yield num * num);
+  }
+};
+
+window.ps || (window.ps = perfectSquares());
+
load
run: ps.next().value