<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div class=""><div><br class=""><blockquote type="cite" class=""><div class="">On 28 Oct 2019, at 10:02, Raimo Niskanen <<a href="mailto:raimo.niskanen@ericsson.com" class="">raimo.niskanen@ericsson.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="">I'd like to defend the current term order of lists, tuples and<br class="">binaries.<br class=""><br class="">Lists are compared a'la string comparison, which avoids having to<br class="">traverse the whole list when comparing. Binaries are compared as lists<br class="">since both are used for handling strings, and also to be compared like<br class="">memcmp does it.<br class=""><br class="">Tuples are used for general complex terms. They can be compared size<br class="">first whithout having to be fully traversed, as opposed to lists, which<br class="">is useful in other contexts. You can thereby choose your data<br class="">structure to select comparision.<br class="">-- <br class="">Raimo Niskanen<br class=""><br class=""></div></div></blockquote></div><br class=""></div><div class="">Thanks Raimo,<div class=""><br class=""></div><div class="">Your argument seems to have one…well, misconception. I don’t think it would be correct to imply that Binaries are used exclusively for handling strings, but rather, one of their uses may be that.</div><div class=""><br class=""></div><div class="">For example, here's a syntax that is not anything “string-like”:</div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(43, 102, 201);" class=""><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">(tsdb_1_1@macbookv-3)3593> <<1:16>> < <<2:16>>. </span></div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">true</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">(tsdb_1_1@macbookv-3)3594> <<50:16>> < <<36:16>>.</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">false</span></div><div class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><br class=""></span></div></div></div><div class=""><br class=""></div></div><div class="">As you could see, this pretty much behaves the way we would expect when we compare two integer values, e.g.</div><div class=""><br class=""></div><div class="">1 is less than 2, and so is <<1:16>> < <<2:16>> Technically, we are not talking about strings here, but, rather two 16-bit integers.</div><div class=""><br class=""></div><div class="">I can also say that:</div><div class=""><br class=""></div><div class=""><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(43, 102, 201);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">(tsdb_1_1@macbookv-3)3597> 1 < 000002. </span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(43, 102, 201);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">true</span></div></div><div class=""><br class=""></div><div class="">When we write: </div><div class=""><br class=""></div><div class=""><div style="caret-color: rgb(255, 255, 255); color: rgb(255, 255, 255); font-family: Menlo; background-color: rgb(43, 102, 201); margin: 0px; font-stretch: normal; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">(tsdb_1_1@macbookv-3)3593> <<1:16>>. </span></div></div><div class=""><br class=""></div><div class="">It would be wrong to pretend that we’re actually talking about a strings (e.g. in alphanumeric sense). This clearly means that the integer value of 1 stored using Big-Endian encoding (e.g. network byte order).</div><div class=""><br class=""></div><div class="">Thus, when we write: <<2:16>> we get <<0,2>>. When we write: <<2:24>> we get <<0,0,2>>... these values are *not* intended to be strings, but integers.</div><div class="">So, when we add leading zeroes, we do not change the integer value.</div><div class=""><br class=""></div><div class="">So why is then:</div><div class=""><br class=""></div><div class=""><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(43, 102, 201);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">(tsdb_1_1@macbookv-3)3600> <<1:16>> < <<2:24>>.</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(43, 102, 201);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">false</span></div></div><div class=""><br class=""></div><div class="">First, we’re clearly use integer syntax to encode integer values, then we have the first integer value encoded using 16-bits, and the second integer value encoded using 24-bits.</div><div class="">It just happens so, that 16-bits is used to encode the value of 1, and 24-bits to encode the value of two.</div><div class=""><br class=""></div><div class="">Thus, since 16-bits are less then 24-bits (in length), but also 1 is less than 2, one may expect this to yield TRUE. Yet somehow, two octets are NOT LESS than there, nor 1 is NOT LESS than 2!</div><div class=""><br class=""></div><div class="">I think this cannot pass the "red-face test”, and thus does not deserve defending.</div><div class=""><br class=""></div><div class="">Contrast this with the way tuples are handled:</div><div class=""><br class=""></div><div class=""><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(43, 102, 201);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">(tsdb_1_1@macbookv-3)3666> {1,1} < {1,2}.</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(43, 102, 201);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">true</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(43, 102, 201);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">(tsdb_1_1@macbookv-3)3667> {1,3} < {1,2}.</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(43, 102, 201);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">false</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(43, 102, 201);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">(tsdb_1_1@macbookv-3)3668> {1,3} < {1,2,3}.</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(43, 102, 201);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">true</span></div></div><div class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><br class=""></span></div><div class="">Considering that Binaries may be used to encode ANYTHING, shouldn’t they be handled the same way as tuples instead of:</div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(43, 102, 201);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">(tsdb_1_1@macbookv-3)3624> <<1,1>> < <<1,2>>.</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(43, 102, 201);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">true</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(43, 102, 201);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">(tsdb_1_1@macbookv-3)3625> <<1,3>> < <<1,2>>.</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(43, 102, 201);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">false</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(43, 102, 201);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">(tsdb_1_1@macbookv-3)3626> <<1,3>> < <<1,2,3>>.</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(43, 102, 201);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">false</span></div></div><div class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><br class=""></span></div><div class=""><br class=""></div><div class="">As I said in my previous email, I do not expect Erlang to change, and for my "own intents and purposes” I am still considering if:</div><div class=""><br class=""></div><div class=""><div class=""><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(43, 102, 201);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">(tsdb_1_1@macbookv-3)3626> <<1,3>> < <<1,2,3>>.</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(43, 102, 201);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">false</span></div></div></div><div class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""><br class=""></span></div><div class="">should be given more credence than, say TRUE... if nothing else, because two octets are less than three octets.</div><div class=""><br class=""></div><div class="">In other words, if a three-element-tuple, regardless of its content, could never be less than any given two-elements-tuple, why shouldn't the same hold for Binaries?</div><div class=""><br class=""></div><div class=""><div class="">Kind regards</div><div class=""><br class=""></div><div class="">V/</div><div class=""><div class=""></div></div></div><div class=""><br class=""></div><div class=""><br class=""></div></body></html>