<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=""><br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On 21 Aug 2019, at 02:06, Richard O'Keefe <<a href="mailto:raoknz@gmail.com" class="">raoknz@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div dir="ltr" class=""><div class="gmail_default" style="font-family:monospace,monospace">Valentin Micic wrote</div><div class="gmail_default" style="font-family:monospace,monospace"> <br class=""><div class="">:> If you cannot write 17 loose bits to a file, or,</div><div class="">:> better yet, if you cannot send 13 loose bits over a socket,</div><div class="">:> one has to
wonder how useful are non-aligned bitstrings</div></div></div><div class=""><br class=""></div><div class=""><div style="font-family:monospace,monospace" class="gmail_default">This is a very odd thing to say. PL/I has had bit strings</div><div style="font-family:monospace,monospace" class="gmail_default">since about 1965. Common Lisp has bit strings. Some Scheme</div><div style="font-family:monospace,monospace" class="gmail_default">implementations have bit strings. APL has bit arrays of any</div><div style="font-family:monospace,monospace" class="gmail_default">size and shape. SQL 92 had BIT(n) and BIT(n) VARYING just</div><div style="font-family:monospace,monospace" class="gmail_default">like PL/I -- surprise surprise -- but SQL 2003 dropped them,</div><div style="font-family:monospace,monospace" class="gmail_default">while Postgres still supports them. Ada has bit strings,</div><div style="font-family:monospace,monospace" class="gmail_default">in the guise of packed arrays of Boolean, replacing Pascal's</div><div style="font-family:monospace,monospace" class="gmail_default">sets (which are fixed size bit strings). Do I need to point</div><div style="font-family:monospace,monospace" class="gmail_default">to bit string support in Java and C#?</div><div style="font-family:monospace,monospace" class="gmail_default"><br class=""></div><div style="font-family:monospace,monospace" class="gmail_default">You may not be able to send 13 loose bits over a socket, but</div><div style="font-family:monospace,monospace" class="gmail_default">you *can* have a 13-bit field in a packet, and why should it</div><div style="font-family:monospace,monospace" class="gmail_default">be hard to construct that 13-bit field or to pack it? </div></div></div></div></blockquote><div><br class=""></div><div><br class=""></div><div><div>Well, as I’ve said, I never had anything against 13-bit field in packet… I was struggling to find a situation where one would benefit from being able to write <font face="Courier New" class=""><<Field:13>></font> instead of <font face="Courier New" class=""><<Field:13, _:3>></font>, that is — until Daniel Szoboszlay mentioned compression. Another example from my direct experience (oh irony), which came back to my mind only after Daniels observation, is 7-bit character encoding used by SMS… this would have been way, way easier to implement using bitstrings.</div><div><br class=""></div><div>I’ve seen the light, thank you.</div><div>Life moves on.</div><div> </div><div>V/</div><br class=""><blockquote type="cite" class=""><div dir="ltr" class=""><div class=""><br class=""></div></div></blockquote></div><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class=""><div style="font-family:monospace,monospace" class="gmail_default">And of</div><div style="font-family:monospace,monospace" class="gmail_default">course if you are running Erlang on a Raspberry Pi, you can</div><div style="font-family:monospace,monospace" class="gmail_default">send or receive a message of *any* number of bits through the</div><div style="font-family:monospace,monospace" class="gmail_default">Pi's GPIO pins (with the aid of a NIF).</div><div style="font-family:monospace,monospace" class="gmail_default"><br class=""></div></div></div></div></blockquote><div><br class=""></div></div></body></html>