similarly:
julia> function a()
bin(rand(Uint8))
end
a (generic function with 1 method)
julia> a()
"11001010"
julia> typeof(a())
ASCIIString (constructor with 1 method)
julia> [a() for x in 1:2]
2-element Array{ASCIIString,1}:
"10011011"
"11011011"
On Saturday, 29 March 2014 10:49:59 UTC-3, andrew cooke wrote:
>
> can you post randBinStr? don't have an explanation, just curious. the
> following seems fine:
>
> julia> typeof([(x -> "a")(x) for x in 1:2])
> Array{ASCIIString,1}
>
> andrew
>
> On Saturday, 29 March 2014 10:37:21 UTC-3, Andrew Dabrowski wrote:
>>
>> My function randBinStr produces a random string of 0s and 1s of given
>> length.
>>
>> julia> typeof( randBinStr(5) )
>> ASCIIString (constructor with 1 method)
>>
>>
>> julia> test = [ randBinStr(5) for i=1:2 ]
>> 2-element Array{Union(ASCIIString,UTF8String),1}:
>> "01110"
>> "00011"
>>
>>
>> julia> map( typeof, test )
>> 2-element Array{DataType,1}:
>> ASCIIString
>> ASCIIString
>>
>>
>> Why does comprehension introduce the UTF*String into the type?
>>
>>