<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=""><div><blockquote type="cite" class=""><div class="">On 10 Apr 2016, at 22:16, Erica Sadun <<a href="mailto:erica@ericasadun.com" class="">erica@ericasadun.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><span class="" style="font-size: inherit; float: none; display: inline !important;">I don't think general random sources are a good fit for core functionality</span></div></blockquote></div><br class=""><div class="">I’m sorry, Erica, I still do not understand how your comments about “core functionality” reflect on my original question – have you seen it?</div><div class=""><br class=""></div><div class="">Certainly, there is plenty of precedent where Foundation extends Standard Library types and protocols:</div><div class=""><br class=""></div><div class=""><font face="Menlo" size="2" class="">// Foundation</font></div><div class=""><font face="Menlo" size="2" class=""><br class=""></font></div><div class=""><font face="Menlo" size="2" class="">extension <b class="">String</b> {<br class=""> public func <b class="">enumerateLinguisticTagsInRange</b>…</font></div><div class=""><font face="Menlo" size="2" class="">}</font></div><div class=""><br class=""></div><div class=""><font size="2" class=""><span style="font-family: Menlo;" class="">// </span><span style="font-family: Menlo;" class="">CoreGraphics</span></font></div><div class=""><font size="2" class=""><span style="font-family: Menlo;" class=""><br class=""></span></font></div><div class=""><font face="Menlo" size="2" class="">extension <b class="">Double</b> {<br class=""> public <b class="">init</b>(_ value: CGFloat)</font></div><div class=""><font face="Menlo" size="2" class="">}</font></div><div class=""><br class=""></div><div class=""><font size="2" class=""><span style="font-family: Menlo;" class="">// </span><span style="font-family: Menlo;" class="">Darwin</span></font></div><div class=""><font size="2" class=""><span style="font-family: Menlo;" class=""><br class=""></span></font></div><div class=""><font face="Menlo" size="2" class="">func <b class="">yn</b>(n: Int, _ x: Double) -> Double //...which are the bessel functions of first and second kind!</font></div><div class=""><br class=""></div><div class="">What I’m talking about would not look out of place with linguistic tags and bassel functions:</div><div class=""><br class=""></div><div class=""><font face="Menlo" size="2" class="">// Foundation</font></div><div class=""><font face="Menlo" size="2" class=""><br class=""></font></div><div class=""><font face="Menlo" size="2" class="">extension <b class="">UnsignedIntegerType</b> {</font><div class=""><font face="Menlo" size="2" class=""> static var <b class="">random</b>: Self</font></div><div class=""><font face="Menlo" size="2" class="">}</font></div><font face="Menlo" size="2" class=""><br class=""></font></div><div class=""><font face="Menlo" size="2" class="">extension <b class="">ClosedInterval</b> where Bound : <b class="">UnsignedIntegerType</b> {</font><div class=""><font face="Menlo" size="2" class=""> var <b class="">random</b>: Bound</font></div><font face="Menlo" size="2" class="">}</font></div><div class=""><font face="Menlo" size="2" class=""><br class=""></font></div><div class=""><font face="Menlo" size="2" class="">extension <b class="">ClosedInterval</b> where Bound : <b class="">SignedIntegerType</b> {</font><div class=""><font face="Menlo" size="2" class=""> var <b class="">random</b>: Bound</font></div><div class=""><font face="Menlo" size="2" class="">}</font></div><font face="Menlo" size="2" class=""><br class=""></font></div><div class=""><font face="Menlo" size="2" class="">extension <b class="">CollectionType</b> where Index.<b class="">Distance</b> == <b class="">Int</b> {</font><div class=""><font face="Menlo" size="2" class=""> var <b class="">sample</b>: Generator.Element?</font></div><font face="Menlo" size="2" class="">}</font></div><div class=""><br class=""></div><div class="">… which we could use by:</div><div class=""><br class=""></div><div class=""><span class="" style="font-family: Menlo; font-size: 12px;"> </span><b class="" style="font-family: Menlo; font-size: 12px;">import</b><span class="" style="font-family: Menlo; font-size: 12px;"> Foundation</span><br class="" style="font-family: Menlo;"><span class="" style="font-family: Menlo; font-size: 12px;"> </span><br class="" style="font-family: Menlo;"><div class=""><font face="Menlo" class=""><span class="" style="font-size: 12px;"> </span><span class="" style="font-size: 12px;"> </span><span class="" style="font-size: 12px;">(<b class="">1</b>..<<b class="">4</b>).<b class="">sample</b><br class=""></span><span class="" style="font-size: 12px;"> </span><span class="" style="font-size: 12px;">[<b class="">1</b>,<b class="">2</b>,<b class="">3</b>].<b class="">sample</b><br class=""></span><span class="" style="font-size: 12px;"> </span><span class="" style="font-size: 12px;">"abc".characters.<b class="">sample</b><br class=""></span><span class="" style="font-size: 12px;"> </span><span class="" style="font-size: 12px;">["a": <b class="">1</b>, "b": <b class="">2</b>, "c": <b class="">3</b>].<b class="">sample</b></span></font></div></div><div class=""><font face="Menlo" class=""><span class="" style="font-size: 12px;"><b class=""><br class=""></b></span></font></div><div class="">milos</div><div class=""><br class=""></div><div><blockquote type="cite" class=""><div class="">On 10 Apr 2016, at 22:16, Erica Sadun <<a href="mailto:erica@ericasadun.com" class="">erica@ericasadun.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Apr 10, 2016, at 2:39 PM, Milos Rankovic <<a href="mailto:milos@milos-and-slavica.net" class="">milos@milos-and-slavica.net</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><blockquote type="cite" class="">On 10 Apr 2016, at 21:23, Erica Sadun <<a href="mailto:erica@ericasadun.com" class="">erica@ericasadun.com</a>> wrote:</blockquote><blockquote type="cite" class=""><br class=""></blockquote><blockquote type="cite" class=""><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div class=""><div class="">I do not think it's the role of a core language to worry about things like distributions, bias, and sampling.</div></div></div></blockquote><br class="">Why do you mention “the role of a core language” here? That was explicitly not the ambition of my question. I’m talking about extending the Standard Library types and protocols in the Foundation framework (as this is already done on a large scale). Or, if this is what you mean by “core language”, how does capitalising strings according to the rules of grammar of every language on the planet qualify as any more fitting the domain of the core language?<div class=""><br class=""></div><div class="">milos</div><div class=""><br class=""></div></div></div></blockquote></div><br class=""><div class="">While I don't think general random sources are a good fit for core functionality, apparently, NSRandomSpecifier exists: <a href="https://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/NSRandomSpecifier_Class/index.html#//apple_ref/occ/cl/NSRandomSpecifier" class="">https://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/NSRandomSpecifier_Class/index.html#//apple_ref/occ/cl/NSRandomSpecifier</a></div><div class=""><br class=""></div><div class="">Other material I consulted:</div><div class="">Standard Library: <a href="https://en.wikipedia.org/wiki/Standard_library" class="">https://en.wikipedia.org/wiki/Standard_library</a></div><div class="">Foundation: <a href="https://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/ObjC_classic/" class="">https://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/ObjC_classic/</a> </div><div class="">GameplayKit Randomization: <a href="https://developer.apple.com/library/ios/documentation/General/Conceptual/GameplayKit_Guide/RandomSources.html#//apple_ref/doc/uid/TP40015172-CH9-SW1" class="">https://developer.apple.com/library/ios/documentation/General/Conceptual/GameplayKit_Guide/RandomSources.html#//apple_ref/doc/uid/TP40015172-CH9-SW1</a></div><div class=""><br class=""></div><div class="">-- E</div><div class=""><br class=""></div></div></div></blockquote></div><br class=""></body></html>