Skip to content

Commit 201e8c6

Browse files
authored
Fix append -> prepend
1 parent 18167e4 commit 201e8c6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

_posts/2025-01-06-encapsulating-rod-cutting.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ <h3 id="fe67c3b6121e4be780bc3d7f3b166a00">
309309
It still has the type <code>int list -&gt; Cut list</code>, but the <code>Cut</code> type is now more restrictively designed. In other words, we've provided a more conservative definition of what we return, in keeping with <a href="https://en.wikipedia.org/wiki/Robustness_principle">Postel's law</a>.
310310
</p>
311311
<p>
312-
Furthermore, notice that the first line appends <code>0</code> to the <code>p</code> array, so that the client developer doesn't have to do that. Likewise, when returning the result, the <code>for</code> loop goes from <code>1</code> to <code>n</code>, which means that it omits the first zero cut.
312+
Furthermore, notice that the first line prepends <code>0</code> to the <code>p</code> array, so that the client developer doesn't have to do that. Likewise, when returning the result, the <code>for</code> loop goes from <code>1</code> to <code>n</code>, which means that it omits the first zero cut.
313313
</p>
314314
<p>
315315
These changes ripple through and also improves encapsulation of the <code>solve</code> function:
@@ -419,4 +419,4 @@ <h3 id="c009b6e42470466c9556f52a7c5af175">
419419
<p>
420420
Static types gives you a consistent vocabulary you can use to communicate an API's contract to client developers. What must client code do in order to make a valid method or function call? What guarantees can client code rely on? <a href="/encapsulation-and-solid">Encapsulation</a>, in other words.
421421
</p>
422-
</div>
422+
</div>

0 commit comments

Comments
 (0)