Skip to content

Commit 0c4643b

Browse files
committed
stateful
1 parent 22eadd9 commit 0c4643b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

_posts/2015-02-21-interviewing-for-a-front-end-job.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Christine intoned the question, as if by rote. Which it was, by the time they'd
2626
2727
"So," The Carpenter asked, "I am to write an algorithm that takes a possibly infinite stream of..."
2828

29-
Christine interrupted. "To save time, we have written a template of the solution for you. Fill in the blank." Christine quickly scribbled on the whiteboard:
29+
Christine interrupted. "To save time, we have written a template of the solution for you. Fill in the blanks." Christine quickly scribbled on the whiteboard:
3030

3131
{% highlight javascript %}
3232
const Game = (size = Math.floor(Math.random() * 8) + 8) => {
@@ -143,7 +143,7 @@ Array.from(takeIterable(10, Game(8)))
143143
//=> ["↑","←","→","←","→","←","→","←","→","←"]
144144
{% endhighlight %}
145145

146-
But now to the business. We want to take the arrows and convert them to positions. For that, we'll map the Game iterable stateful to positions. a `statefulMap` is a lazy map that preserves state from iteration to iteration:
146+
But now to the business. We want to take the arrows and convert them to positions. For that, we'll map the Game iterable to positions. A `statefulMap` is a lazy map that preserves state from iteration to iteration. That's what we need, because we need to know the current position to map each move to the next position:
147147

148148
{% highlight javascript %}
149149
const statefulMapIterableWith = (fn, seed, iterable) =>

0 commit comments

Comments
 (0)