Skip to content

Commit 8143b9f

Browse files
committed
Edited ch04.asciidoc with Atlas code editor
1 parent d2e6a88 commit 8143b9f

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

ch04.asciidoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,7 @@ new Promise((resolve, reject) => { throw new Error('oops') })
203203

204204
Errors that occur while executing a fulfillment or rejection reaction behave in the same way: they result in a promise being rejected, the one returned by the `.then` or `.catch` call that was passed the reaction where the error originated. It's easier to explain this with code, such as the following piece.
205205

206+
[role="pagebreak-before"]
206207
[source,javascript]
207208
----
208209
Promise
@@ -818,6 +819,7 @@ const low = [...range(random, 0, 0.8)]
818819

819820
This sort of abstraction of complexity into another function often helps keep code focused on its intent, while striving to avoid a `for..of` loop when all we wanted was to produce a derivated sequence. It also shows how sequences can be composed and piped into one another. In this case, we first created a multipurpose and infinite `random` sequence, and then piped it through a `range` function that returns a derivated sequence that ends when it meets values that are below or above a desired range. An important aspect of iterators is that despite having been composed, the iterators produced by the `range` function can be lazily iterated as well, effectively meaning you can compose as many iterators you need into mapping, filtering, and exit condition helpers.
820821

822+
[role="pagebreak-before"]
821823
.Identifying Infinite Sequences
822824
****
823825
Iterators ((("infinite sequences", "identifying")))don't have any knowledge that the sequences they produce are infinite. In a similar situation to the famous halting problem (<<fig0405>>), there is no way of knowing whether the sequence is infinite or not in code.

0 commit comments

Comments
 (0)