Hi John,
`help(Array)` is telling you to use Array(SomeType, some_num_of_dims). If
it was telling you about the type it would look more like this:
> help(Int)
DataType :
Int64
supertype: Signed
The `Base.Array(type, dims)` line at the top of the help is giving you the
calling signature. Since Array is both the type name and a method to
construct arrays, it can be used with both {} and (). Try this:
> typeof(Array{Int, 3})
DataType
> typeof(Array(Int, 3))
Array{Int64,1}
> typeof([1, 2, 3])
Array{Int64,1}
Steve
On Friday, December 19, 2014 8:40:30 AM UTC+13, [email protected] wrote:
>
> On Thursday, December 18, 2014 2:26:02 PM UTC-5, Stefan Karpinski wrote:
>>
>> Array{Int64,1} is a type – it's the type of an array with 1 dimension (a
>> vector) whose elements are 64-bit signed integers. You can't push anything
>> onto a type because types aren't containers. If you want to construct an
>> uninitialized three value Int array, you can do this:
>>
>> v = Array(Int, 3)
>>
>>
>>
> Thank you.
>
> Is the output of `help(Array)` telling me to do
>
> Array{SomeType, some_num_of_dims}
>
> or
>
> Array(SomeType, some_num_of_dims)
>
> ?
>
>
>> This will just have junk values gotten via malloc. If you want to
>> initialize an Int array with the values 10, 11 and 12 you can do this:
>>
>> v = [10, 11, 12]
>>
>>
>> It will have element type Int because all the values you gave it are Ints.
>>
>
> Right. Got that. I think I'm just still confused between Foo{}, Foo(),
> Foo{}(), and Foo[].
>
> -- John
>
>