-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Array{Int,0}() doesn't work #15907
Comments
Note that |
What @yuyichao is saying is that array constructors are different from most other collection constructors: They don't take a list of elements to initialize the array; instead, they always produce an uninitialized array. They accept integer arguments to specify the array size, and for a zero-dimensional array, they should accept zero integers. |
Yes, of course. Though what's slightly annoying is that |
This syntax would be let x=Array{Int}(); x[]=scalar; x end If you find a way to avoid the local variable, let me know. |
Yes, that's the shortest solution I could find. Is there a reason why |
setindex!(Array(Int), scalar) |
@GunnarFarneback Interesting one. |
I like this game. Here's another one: |
On Sunday, April 17, 2016, Gunnar Farnebäck [email protected]
This returns the scalar, not the array. -erik
Erik Schnetter [email protected] |
julia> setindex!(Array(Int), 1)
0-dimensional Array{Int64,0}:
1 The return value of |
|
0-dimensional arrays are inconsistent with other cases. The constructor would probably need to be adapted a bit.
UPDATE: fixed according to comments
The text was updated successfully, but these errors were encountered: