Julia's type inference is best effort – it may or may not be able to determine a "tight" upper bound on the possible types of values an operation produces. It will always have a correct upper bound, but that bound might just be Any – or in this case Union(ASCIIArray,UTF8String), even though this code will only ever produce ASCIIStrings. As you guys figured out, you can always give it some extra help.
On Saturday, March 29, 2014, Andrew Dabrowski <[email protected]> wrote: > Not at all sure this is the right way to do it... > > function randBinStr( len::Int ) > res = repeat( "0", len ) > replace( res, r"(.)", x -> ( rand() < 0.5 ? "0" : "1" ) ) > end > > > > On Saturday, March 29, 2014 9:49:59 AM UTC-4, andrew cooke wrote: >> >> can you post randBinStr? don't have an explanation, just curious. the >> following seems fine: >> >>
