<div dir="ltr">On Tue, Jun 28, 2016 at 1:25 PM, David Hart <span dir="ltr"><<a href="mailto:david@hartbit.com" target="_blank">david@hartbit.com</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class=""><br>
<br>
> On 28 Jun 2016, at 13:46, Brent Royal-Gordon <<a href="mailto:brent@architechies.com">brent@architechies.com</a>> wrote:<br>
><br>
> Unlike the other methods, adding additional elements changed the length of `suffix(from:)`'s return value. That indicates to me that it is *not* a suffix operation at all.<br>
<br>
</span>I don't agree with your reasoning here. It *is* an operation that returns the suffix (the end of the sequence) but starting from an index. The fact that indices index from the start of the array and that the function will return an array of a different length depending on the argument does not make the result of the operation less of a suffix. It is still returning the end of the array.<br>
</blockquote></div><br></div><div class="gmail_extra">I was in the midst of writing a reply along the same lines, so I figured I'd add to David's reply here. There are two characteristics I would expect from a method named "prefix" or "suffix".</div><div class="gmail_extra"><br></div><div class="gmail_extra">First, it should return a subsequence containing zero to count elements. (By contrast, something named "first" should return nil or one element, but certainly no more.)</div><div class="gmail_extra"><br></div><div class="gmail_extra">Second, in the case of "prefix", the first element of the subsequence (if any) should be the first element of the sequence; in the case of "suffix", the last element of the subsequence (if any) should be the last element of the sequence.</div><div class="gmail_extra"><br></div><div class="gmail_extra">Now, `suffix(from:)` fulfills both of those expectations. Like David, I do not understand how you arrive at the interpretation that a "suffix operation" should be one that returns a fixed number of elements.</div><div class="gmail_extra"><br></div><div class="gmail_extra">Replacing the word "suffix" with square brackets is inferior, IMO, because at the call site the reader cannot immediately tell that the two characteristics I named above would hold. First, depending on what is inside the square brackets, a subscript could return a subsequence or it could return a single element. Second, depending on what is inside the square brackets, a subsequence could start or end anywhere. By contrast, the words "prefix" and "suffix" clearly communicate what sort of subsequence you'll get back without inspection of the argument.</div><div class="gmail_extra"><br></div></div>