<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">In Swift, we cannot compile:<div class=""><br class=""></div><div class=""><div style="margin: 0px; font-size: 13px; line-height: normal;" class=""><div style="margin: 0px; line-height: normal;" class=""><font face="Menlo" class=""><span style="font-variant-ligatures: no-common-ligatures; color: rgb(200, 172, 229);" class="">_</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> = [[], </span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(255, 38, 0);" class="">1</span><span style="font-variant-ligatures: no-common-ligatures;" class="">, [</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(255, 38, 0);" class="">2</span><span style="font-variant-ligatures: no-common-ligatures;" class="">, </span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(255, 38, 0);" class="">3</span><span style="font-variant-ligatures: no-common-ligatures;" class="">], [[</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(255, 38, 0);" class="">4</span><span style="font-variant-ligatures: no-common-ligatures;" class="">, </span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(255, 38, 0);" class="">5</span><span style="font-variant-ligatures: no-common-ligatures;" class="">], [</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(255, 38, 0);" class="">6</span><span style="font-variant-ligatures: no-common-ligatures;" class="">, </span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(255, 38, 0);" class="">7</span><span style="font-variant-ligatures: no-common-ligatures;" class="">], [</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(255, 38, 0);" class="">8</span><span style="font-variant-ligatures: no-common-ligatures;" class="">, </span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(255, 38, 0);" class="">9</span><span style="font-variant-ligatures: no-common-ligatures;" class="">]]]</span></font></div></div></div><div style="margin: 0px; font-size: 13px; line-height: normal; font-family: 'Source Code Pro';" class=""><br class=""></div><div class=""><span style="font-variant-ligatures: no-common-ligatures" class="">The reason for the compile-time error is that we are not in fact creating an array, but a tree – a more general structure of which arrays are only a special case. Given the well-deserved and growing reputation of Swift, one would hope that in this instance the compiler would be able to default to something like a:</span></div><div class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><br class=""></span></div><div class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><div style="margin: 0px; font-size: 13px; line-height: normal;" class=""><div style="margin: 0px; line-height: normal;" class=""><font face="Menlo" class=""><span style="font-variant-ligatures: no-common-ligatures; color: rgb(200, 172, 229);" class="">enum</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> Tree<Value> {</span></font></div><div style="margin: 0px; line-height: normal;" class=""><font face="Menlo" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><span class="Apple-tab-span" style="white-space:pre">        </span></span><span style="font-variant-ligatures: no-common-ligatures; color: #c8ace5" class="">case</span><span style="font-variant-ligatures: no-common-ligatures" class=""> Leaf(</span><span style="font-variant-ligatures: no-common-ligatures; color: #49a2d2" class="">Value</span><span style="font-variant-ligatures: no-common-ligatures" class="">)</span></font></div><div style="margin: 0px; line-height: normal;" class=""><font face="Menlo" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><span class="Apple-tab-span" style="white-space:pre">        </span></span><span style="font-variant-ligatures: no-common-ligatures; color: #c8ace5" class="">case</span><span style="font-variant-ligatures: no-common-ligatures" class=""> Branches([</span><span style="font-variant-ligatures: no-common-ligatures; color: #49a2d2" class="">Tree</span><span style="font-variant-ligatures: no-common-ligatures" class="">])</span></font></div><div style="margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font face="Menlo" class="">}</font></span></div><div style="margin: 0px; line-height: normal; min-height: 17px;" class=""><font face="Menlo" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""></span><br class=""></font></div><div style="margin: 0px; line-height: normal; color: rgb(73, 162, 210);" class=""><font face="Menlo" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #c8ace5" class="">extension</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> </span><span style="font-variant-ligatures: no-common-ligatures" class="">Tree</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> : </span><span style="font-variant-ligatures: no-common-ligatures" class="">ArrayLiteralConvertible</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> {</span></font></div><div style="margin: 0px; line-height: normal;" class=""><font face="Menlo" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><span class="Apple-tab-span" style="white-space:pre">        </span></span><span style="font-variant-ligatures: no-common-ligatures; color: #c8ace5" class="">init</span><span style="font-variant-ligatures: no-common-ligatures" class="">(arrayLiteral elements: </span><span style="font-variant-ligatures: no-common-ligatures; color: #49a2d2" class="">Tree</span><span style="font-variant-ligatures: no-common-ligatures" class="">...) {</span></font></div><div style="margin: 0px; line-height: normal;" class=""><font face="Menlo" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><span class="Apple-tab-span" style="white-space:pre">                </span></span><span style="font-variant-ligatures: no-common-ligatures; color: #c8ace5" class="">self</span><span style="font-variant-ligatures: no-common-ligatures" class=""> = .</span><span style="font-variant-ligatures: no-common-ligatures; color: #49a2d2" class="">Branches</span><span style="font-variant-ligatures: no-common-ligatures" class="">(elements)</span></font></div><div style="margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font face="Menlo" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>}</font></span></div><div style="margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font face="Menlo" class="">}</font></span></div><div style="font-family: 'Source Code Pro';" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><br class=""></span></div></div></span></div><div class=""><span style="font-variant-ligatures: no-common-ligatures" class="">For this to work in the playground, however, we must manually lift the values into the world of trees first. And to make that chore in turn easier on the eye we can introduce a:</span></div><div class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><br class=""></span></div><div class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><div style="margin: 0px; font-size: 13px; line-height: normal; color: rgb(203, 203, 203);" class=""><font face="Menlo" class=""><span style="font-variant-ligatures: no-common-ligatures; color: rgb(200, 172, 229);" class="">prefix</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 0, 0);" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(200, 172, 229);" class="">operator</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 0, 0);" class=""> ◊ {} </span><span style="font-variant-ligatures: no-common-ligatures;" class="">// looks a bit like a leaf (us/uk kbd: </span><span style="line-height: normal; font-variant-ligatures: no-common-ligatures;" class=""><b class="">⎇⇧</b></span><span style="font-variant-ligatures: no-common-ligatures;" class="">V)</span></font></div><div style="margin: 0px; font-size: 13px; line-height: normal;" class=""><font face="Menlo" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #c8ace5" class="">prefix</span><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #c8ace5" class="">func</span><span style="font-variant-ligatures: no-common-ligatures" class=""> ◊ <T> (leaf: </span><span style="font-variant-ligatures: no-common-ligatures; color: #49a2d2" class="">T</span><span style="font-variant-ligatures: no-common-ligatures" class="">) -> </span><span style="font-variant-ligatures: no-common-ligatures; color: #49a2d2" class="">Tree</span><span style="font-variant-ligatures: no-common-ligatures" class=""><</span><span style="font-variant-ligatures: no-common-ligatures; color: #49a2d2" class="">T</span><span style="font-variant-ligatures: no-common-ligatures" class="">> { </span><span style="font-variant-ligatures: no-common-ligatures; color: #c8ace5" class="">return</span><span style="font-variant-ligatures: no-common-ligatures" class=""> .</span><span style="font-variant-ligatures: no-common-ligatures; color: #49a2d2" class="">Leaf</span><span style="font-variant-ligatures: no-common-ligatures" class="">(leaf) }</span></font></div><div style="margin: 0px; font-size: 13px; line-height: normal; min-height: 17px;" class=""><font face="Menlo" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""></span><br class=""></font></div><div style="margin: 0px; font-size: 13px; line-height: normal;" class=""><font face="Menlo" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #c8ace5" class="">let</span><span style="font-variant-ligatures: no-common-ligatures" class=""> tree: </span><span style="font-variant-ligatures: no-common-ligatures; color: #49a2d2" class="">Tree</span><span style="font-variant-ligatures: no-common-ligatures" class=""><</span><span style="font-variant-ligatures: no-common-ligatures; color: #49a2d2" class="">Int</span><span style="font-variant-ligatures: no-common-ligatures" class="">> = [[], </span><span style="font-variant-ligatures: no-common-ligatures; color: #91540f" class="">◊</span><span style="font-variant-ligatures: no-common-ligatures; color: #ff2600" class="">1</span><span style="font-variant-ligatures: no-common-ligatures" class="">, [</span><span style="font-variant-ligatures: no-common-ligatures; color: #91540f" class="">◊</span><span style="font-variant-ligatures: no-common-ligatures; color: #ff2600" class="">2</span><span style="font-variant-ligatures: no-common-ligatures" class="">, </span><span style="font-variant-ligatures: no-common-ligatures; color: #91540f" class="">◊</span><span style="font-variant-ligatures: no-common-ligatures; color: #ff2600" class="">3</span><span style="font-variant-ligatures: no-common-ligatures" class="">], [[</span><span style="font-variant-ligatures: no-common-ligatures; color: #91540f" class="">◊</span><span style="font-variant-ligatures: no-common-ligatures; color: #ff2600" class="">4</span><span style="font-variant-ligatures: no-common-ligatures" class="">, </span><span style="font-variant-ligatures: no-common-ligatures; color: #91540f" class="">◊</span><span style="font-variant-ligatures: no-common-ligatures; color: #ff2600" class="">5</span><span style="font-variant-ligatures: no-common-ligatures" class="">], [</span><span style="font-variant-ligatures: no-common-ligatures; color: #91540f" class="">◊</span><span style="font-variant-ligatures: no-common-ligatures; color: #ff2600" class="">6</span><span style="font-variant-ligatures: no-common-ligatures" class="">, </span><span style="font-variant-ligatures: no-common-ligatures; color: #91540f" class="">◊</span><span style="font-variant-ligatures: no-common-ligatures; color: #ff2600" class="">7</span><span style="font-variant-ligatures: no-common-ligatures" class="">], [</span><span style="font-variant-ligatures: no-common-ligatures; color: #91540f" class="">◊</span><span style="font-variant-ligatures: no-common-ligatures; color: #ff2600" class="">8</span><span style="font-variant-ligatures: no-common-ligatures" class="">, </span><span style="font-variant-ligatures: no-common-ligatures; color: #91540f" class="">◊</span><span style="font-variant-ligatures: no-common-ligatures; color: #ff2600" class="">9</span><span style="font-variant-ligatures: no-common-ligatures" class="">]]]</span></font></div><div class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><br class=""></span></div></span></div><div class="">The point here is that if adding such a fundamental type to the Standard Library would not be a priority at present, it is not the end of the world since we can easily enough write it ourselves… What we cannot do ourselves, however, is to get rid of the need for that operator. For this we need a literal-convertible protocol requiring <b class="">two</b> initialisers:</div><div class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><br class=""></span></div><div class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><div style="margin: 0px; line-height: normal;" class=""><div style="margin: 0px; line-height: normal;" class=""><font face="Menlo" size="2" class=""><span style="font-variant-ligatures: no-common-ligatures; color: rgb(200, 172, 229);" class="">protocol</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> </span></font><span style="color: rgb(73, 162, 210);" class=""><font size="2" face="Menlo" class="">TreeLiteralConvertible</font></span><span style="font-family: Menlo; font-size: small;" class=""> {</span></div><div style="margin: 0px; line-height: normal; color: rgb(200, 172, 229);" class=""><font face="Menlo" size="2" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""><span class="Apple-tab-span" style="white-space:pre">        </span></span><span style="font-variant-ligatures: no-common-ligatures" class="">associatedtype</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> Element</span></font></div><div style="margin: 0px; line-height: normal;" class=""><font face="Menlo" size="2" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><span class="Apple-tab-span" style="white-space:pre">        </span></span><span style="font-variant-ligatures: no-common-ligatures; color: #c8ace5" class="">init</span><span style="font-variant-ligatures: no-common-ligatures" class="">(literal: </span><span style="font-variant-ligatures: no-common-ligatures" class="">Element...)</span></font></div><div style="margin: 0px; line-height: normal;" class=""><font face="Menlo" size="2" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><span class="Apple-tab-span" style="white-space:pre">        </span></span><span style="font-variant-ligatures: no-common-ligatures; color: #c8ace5" class="">init</span><span style="font-variant-ligatures: no-common-ligatures" class="">(literal: </span><span style="font-variant-ligatures: no-common-ligatures; color: #49a2d2" class="">Tree</span><span style="font-variant-ligatures: no-common-ligatures" class=""><</span><span style="font-variant-ligatures: no-common-ligatures" class="">Element>...)</span></font></div><div style="margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font face="Menlo" size="2" class="">}</font></span></div><div style="font-size: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><br class=""></span></div></div></span></div><div class=""><span style="font-variant-ligatures: no-common-ligatures" class="">Then we could simply:</span></div><div class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><br class=""></span></div><div class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><div style="margin: 0px; font-size: 13px; line-height: normal;" class=""><div style="margin: 0px; line-height: normal;" class=""><font face="Menlo" class=""><span style="font-variant-ligatures: no-common-ligatures; color: rgb(200, 172, 229);" class="">let</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> tree: </span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(73, 162, 210);" class="">Tree</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(73, 162, 210);" class="">Int</span><span style="font-variant-ligatures: no-common-ligatures;" class="">> = [[], </span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(255, 38, 0);" class="">1</span><span style="font-variant-ligatures: no-common-ligatures;" class="">, [</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(255, 38, 0);" class="">2</span><span style="font-variant-ligatures: no-common-ligatures;" class="">, </span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(255, 38, 0);" class="">3</span><span style="font-variant-ligatures: no-common-ligatures;" class="">], [[</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(255, 38, 0);" class="">4</span><span style="font-variant-ligatures: no-common-ligatures;" class="">, </span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(255, 38, 0);" class="">5</span><span style="font-variant-ligatures: no-common-ligatures;" class="">], [</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(255, 38, 0);" class="">6</span><span style="font-variant-ligatures: no-common-ligatures;" class="">, </span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(255, 38, 0);" class="">7</span><span style="font-variant-ligatures: no-common-ligatures;" class="">], [</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(255, 38, 0);" class="">8</span><span style="font-variant-ligatures: no-common-ligatures;" class="">, </span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(255, 38, 0);" class="">9</span><span style="font-variant-ligatures: no-common-ligatures;" class="">]]]</span></font></div></div></span></div><div class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><br class=""></span></div><div class=""><span style="font-variant-ligatures: no-common-ligatures" class="">And, whilst we are at it, we could also get rid of the need for that operator in the case of nested associative arrays (again, you can try this in the playground):</span></div><div class=""><br class=""></div><div class=""><div style="margin: 0px; font-size: 13px; line-height: normal;" class=""><font face="Menlo" class=""><span style="font-variant-ligatures: no-common-ligatures; color: rgb(200, 172, 229);" class="">enum</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> DictionaryTree<Key, Value> {</span></font></div><div style="margin: 0px; font-size: 13px; line-height: normal;" class=""><font face="Menlo" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><span class="Apple-tab-span" style="white-space:pre">        </span></span><span style="font-variant-ligatures: no-common-ligatures; color: #c8ace5" class="">case</span><span style="font-variant-ligatures: no-common-ligatures" class=""> Leaf(</span><span style="font-variant-ligatures: no-common-ligatures; color: #49a2d2" class="">Value</span><span style="font-variant-ligatures: no-common-ligatures" class="">)</span></font></div><div style="margin: 0px; font-size: 13px; line-height: normal;" class=""><font face="Menlo" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><span class="Apple-tab-span" style="white-space:pre">        </span></span><span style="font-variant-ligatures: no-common-ligatures; color: #c8ace5" class="">case</span><span style="font-variant-ligatures: no-common-ligatures" class=""> Branches([(</span><span style="font-variant-ligatures: no-common-ligatures; color: #49a2d2" class="">Key</span><span style="font-variant-ligatures: no-common-ligatures" class="">, </span><span style="font-variant-ligatures: no-common-ligatures; color: #49a2d2" class="">DictionaryTree</span><span style="font-variant-ligatures: no-common-ligatures" class="">)])</span></font></div><div style="margin: 0px; font-size: 13px; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font face="Menlo" class="">}</font></span></div><div style="margin: 0px; font-size: 13px; line-height: normal; min-height: 17px;" class=""><font face="Menlo" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""></span><br class=""></font></div><div style="margin: 0px; font-size: 13px; line-height: normal; color: rgb(73, 162, 210);" class=""><font face="Menlo" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #c8ace5" class="">extension</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> </span><span style="font-variant-ligatures: no-common-ligatures" class="">DictionaryTree</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> : </span><span style="font-variant-ligatures: no-common-ligatures" class="">DictionaryLiteralConvertible</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> {</span></font></div><div style="margin: 0px; font-size: 13px; line-height: normal;" class=""><font face="Menlo" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><span class="Apple-tab-span" style="white-space:pre">        </span></span><span style="font-variant-ligatures: no-common-ligatures; color: #c8ace5" class="">init</span><span style="font-variant-ligatures: no-common-ligatures" class="">(dictionaryLiteral pairs: (</span><span style="font-variant-ligatures: no-common-ligatures; color: #49a2d2" class="">Key</span><span style="font-variant-ligatures: no-common-ligatures" class="">, </span><span style="font-variant-ligatures: no-common-ligatures; color: #49a2d2" class="">DictionaryTree</span><span style="font-variant-ligatures: no-common-ligatures" class="">)...) {</span></font></div><div style="margin: 0px; font-size: 13px; line-height: normal;" class=""><font face="Menlo" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><span class="Apple-tab-span" style="white-space:pre">                </span></span><span style="font-variant-ligatures: no-common-ligatures; color: #c8ace5" class="">self</span><span style="font-variant-ligatures: no-common-ligatures" class=""> = .</span><span style="font-variant-ligatures: no-common-ligatures; color: #49a2d2" class="">Branches</span><span style="font-variant-ligatures: no-common-ligatures" class="">(pairs)</span></font></div><div style="margin: 0px; font-size: 13px; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font face="Menlo" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>}</font></span></div><div style="margin: 0px; font-size: 13px; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font face="Menlo" class="">}</font></span></div><div style="margin: 0px; font-size: 13px; line-height: normal; min-height: 17px;" class=""><font face="Menlo" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""></span><br class=""></font></div><div style="margin: 0px; font-size: 13px; line-height: normal;" class=""><font face="Menlo" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #c8ace5" class="">prefix</span><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #c8ace5" class="">func</span><span style="font-variant-ligatures: no-common-ligatures" class=""> ◊ <Key, Value> (leaf: </span><span style="font-variant-ligatures: no-common-ligatures; color: #49a2d2" class="">Value</span><span style="font-variant-ligatures: no-common-ligatures" class="">) -> </span><span style="font-variant-ligatures: no-common-ligatures; color: #49a2d2" class="">DictionaryTree</span><span style="font-variant-ligatures: no-common-ligatures" class=""><</span><span style="font-variant-ligatures: no-common-ligatures; color: #49a2d2" class="">Key</span><span style="font-variant-ligatures: no-common-ligatures" class="">, </span><span style="font-variant-ligatures: no-common-ligatures; color: #49a2d2" class="">Value</span><span style="font-variant-ligatures: no-common-ligatures" class="">> { </span><span style="font-variant-ligatures: no-common-ligatures; color: #c8ace5" class="">return</span><span style="font-variant-ligatures: no-common-ligatures" class=""> .</span><span style="font-variant-ligatures: no-common-ligatures; color: #49a2d2" class="">Leaf</span><span style="font-variant-ligatures: no-common-ligatures" class="">(leaf) }</span></font></div></div><div class=""><div style="margin: 0px; font-size: 13px; line-height: normal; min-height: 17px;" class=""><font face="Menlo" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""></span><br class=""></font></div><div style="margin: 0px; font-size: 13px; line-height: normal; color: rgb(73, 162, 210);" class=""><font face="Menlo" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #c8ace5" class="">let</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> map: </span><span style="font-variant-ligatures: no-common-ligatures" class="">DictionaryTree</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""><</span><span style="font-variant-ligatures: no-common-ligatures" class="">String</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">,</span><span style="font-variant-ligatures: no-common-ligatures" class="">Int</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">> = [</span></font></div><div style="margin: 0px; font-size: 13px; line-height: normal;" class=""><font face="Menlo" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><span class="Apple-tab-span" style="white-space:pre">        </span></span><span style="font-variant-ligatures: no-common-ligatures; color: #64961d" class="">"A"</span><span style="font-variant-ligatures: no-common-ligatures" class=""> : [:],</span></font></div><div style="margin: 0px; font-size: 13px; line-height: normal;" class=""><font face="Menlo" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><span class="Apple-tab-span" style="white-space:pre">        </span></span><span style="font-variant-ligatures: no-common-ligatures; color: #64961d" class="">"B"</span><span style="font-variant-ligatures: no-common-ligatures" class=""> : [</span></font></div><div style="margin: 0px; font-size: 13px; line-height: normal;" class=""><font face="Menlo" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><span class="Apple-tab-span" style="white-space:pre">                </span></span><span style="font-variant-ligatures: no-common-ligatures; color: #64961d" class="">"Ba"</span><span style="font-variant-ligatures: no-common-ligatures" class=""> : </span><span style="font-variant-ligatures: no-common-ligatures; color: #91540f" class="">◊</span><span style="font-variant-ligatures: no-common-ligatures; color: #ff2600" class="">0</span><span style="font-variant-ligatures: no-common-ligatures" class="">,</span></font></div><div style="margin: 0px; font-size: 13px; line-height: normal;" class=""><font face="Menlo" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><span class="Apple-tab-span" style="white-space:pre">                </span></span><span style="font-variant-ligatures: no-common-ligatures; color: #64961d" class="">"Bb"</span><span style="font-variant-ligatures: no-common-ligatures" class=""> : </span><span style="font-variant-ligatures: no-common-ligatures; color: #91540f" class="">◊</span><span style="font-variant-ligatures: no-common-ligatures; color: #ff2600" class="">0</span><span style="font-variant-ligatures: no-common-ligatures" class="">,</span></font></div><div style="margin: 0px; font-size: 13px; line-height: normal;" class=""><font face="Menlo" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><span class="Apple-tab-span" style="white-space:pre">                </span></span><span style="font-variant-ligatures: no-common-ligatures; color: #64961d" class="">"Bc"</span><span style="font-variant-ligatures: no-common-ligatures" class=""> : [</span></font></div><div style="margin: 0px; font-size: 13px; line-height: normal;" class=""><font face="Menlo" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><span class="Apple-tab-span" style="white-space:pre">                        </span></span><span style="font-variant-ligatures: no-common-ligatures; color: #64961d" class="">"Bc1"</span><span style="font-variant-ligatures: no-common-ligatures" class=""> : </span><span style="font-variant-ligatures: no-common-ligatures; color: #91540f" class="">◊</span><span style="font-variant-ligatures: no-common-ligatures; color: #ff2600" class="">0</span><span style="font-variant-ligatures: no-common-ligatures" class="">,</span></font></div><div style="margin: 0px; font-size: 13px; line-height: normal;" class=""><font face="Menlo" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><span class="Apple-tab-span" style="white-space:pre">                        </span></span><span style="font-variant-ligatures: no-common-ligatures; color: #64961d" class="">"Bc2"</span><span style="font-variant-ligatures: no-common-ligatures" class=""> : </span><span style="font-variant-ligatures: no-common-ligatures; color: #91540f" class="">◊</span><span style="font-variant-ligatures: no-common-ligatures; color: #ff2600" class="">0</span><span style="font-variant-ligatures: no-common-ligatures" class="">,</span></font></div><div style="margin: 0px; font-size: 13px; line-height: normal;" class=""><font face="Menlo" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><span class="Apple-tab-span" style="white-space:pre">                        </span></span><span style="font-variant-ligatures: no-common-ligatures; color: #64961d" class="">"Bc3"</span><span style="font-variant-ligatures: no-common-ligatures" class=""> : </span><span style="font-variant-ligatures: no-common-ligatures; color: #91540f" class="">◊</span><span style="font-variant-ligatures: no-common-ligatures; color: #ff2600" class="">0</span></font></div><div style="margin: 0px; font-size: 13px; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font face="Menlo" class=""><span class="Apple-tab-span" style="white-space:pre">                </span>]</font></span></div><div style="margin: 0px; font-size: 13px; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font face="Menlo" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>]</font></span></div><div style="margin: 0px; font-size: 13px; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font face="Menlo" class="">]</font></span></div></div><div class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><br class=""></span></div><div class=""><span style="font-variant-ligatures: no-common-ligatures" class="">… by introducing an analogous protocol:</span></div><div class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><br class=""></span></div><div class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><div style="margin: 0px; font-size: 13px; line-height: normal;" class=""><font face="Menlo" class=""><span style="font-variant-ligatures: no-common-ligatures; color: rgb(200, 172, 229);" class="">protocol</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> <span style="color: rgb(73, 162, 210);" class="">DictionaryTreeLiteralConvertible</span> {</span></font></div><div style="margin: 0px; font-size: 13px; line-height: normal; color: rgb(200, 172, 229);" class=""><font face="Menlo" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""><span class="Apple-tab-span" style="white-space:pre">        </span></span><span style="font-variant-ligatures: no-common-ligatures" class="">associatedtype</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> Key</span></font></div><div style="margin: 0px; font-size: 13px; line-height: normal; color: rgb(200, 172, 229);" class=""><font face="Menlo" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""><span class="Apple-tab-span" style="white-space:pre">        </span></span><span style="font-variant-ligatures: no-common-ligatures" class="">associatedtype</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> Value</span></font></div><div style="margin: 0px; font-size: 13px; line-height: normal;" class=""><font face="Menlo" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><span class="Apple-tab-span" style="white-space:pre">        </span></span><span style="font-variant-ligatures: no-common-ligatures; color: #c8ace5" class="">init</span><span style="font-variant-ligatures: no-common-ligatures" class="">(literal: Value...)</span></font></div><div style="margin: 0px; font-size: 13px; line-height: normal;" class=""><font face="Menlo" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><span class="Apple-tab-span" style="white-space:pre">        </span></span><span style="font-variant-ligatures: no-common-ligatures; color: #c8ace5" class="">init</span><span style="font-variant-ligatures: no-common-ligatures" class="">(literal: (Key, </span><span style="font-variant-ligatures: no-common-ligatures; color: #49a2d2" class="">DictionaryTree</span><span style="font-variant-ligatures: no-common-ligatures" class=""><Key, Value>)...)</span></font></div><div style="margin: 0px; font-size: 13px; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font face="Menlo" class="">}</font></span></div><div class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><br class=""></span></div></span></div><div class="">Please note: I do understand that fleshing out these structures (along with all the juicy methods, operators and lazy alternatives) may not currently be a priority for Swift. The two literal-convertible protocols however, may be a much less daunting task, which would open to us some very useful programming idioms…</div><div class=""><br class=""></div><div class=""><span style="font-variant-ligatures: no-common-ligatures" class="">milos</span></div><div class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><br class=""></span></div><div class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><br class=""></span></div><div class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><br class=""></span></div><div class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><br class=""></span></div><div class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><br class=""></span></div><div class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><br class=""></span></div><div class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><br class=""></span></div><div class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><br class=""></span></div><div class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><br class=""></span></div><div class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><br class=""></span></div><div class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><br class=""></span></div><div class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><br class=""></span></div><div class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><br class=""></span></div><div class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><br class=""></span></div><div class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><br class=""></span></div><div class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><br class=""></span></div><div class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><br class=""></span></div><div class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><br class=""></span></div><div class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><br class=""></span></div><div class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><br class=""></span></div><div class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><br class=""></span></div><div class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><br class=""></span></div></body></html>