-
-
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
Request: Vector and Matrix constructors. #10075
Comments
I think what you need is this: Base.call(::Type{Vector}, T::Type, m::Integer) = Array(T, convert(Int, m)) This is consistent with the definition used for Note Could you prepare a PR for this (together with the equivalent code for |
You could also have (I don't think the |
While we're at it, I think it would be nice if things like |
@stevengj You're right about Regarding |
|
I would say that both could be allowed, but |
Yeah, +1 for deprecating This suggests the type is just another parameter, but putting it into curly braces reinforces the notion that types are super-parameters. |
It looks nice and is what I expected to work when I started to play with Julia 👍. |
How about things like |
That would be a separated question. |
duplicate of #3214 |
I added these. We can decide whether to do formal deprecations --- prepare yourself for lots of warnings!! I didn't add |
Is it correct that |
I see the old behavior is still retained. So |
Yes. |
If this is going to be the new default behavior, could we deprecate the |
I would be fine with that, but the trouble is that an NTuple carries type information about the number of dimensions, while varargs do not. So we will need to hack around that with an internal definition that still accepts a tuple. There is also something to be said for minimizing splatting, and writing |
See Jeff's commit: 23a6995 |
For previous discussion, see: https://groups.google.com/forum/#!topic/julia-users/FBmU-mxQ0k4
My request is to have functionality to be able to initialize a vector of size
N
and typeT
using theVector(T, N)
command. This would be equivalent to the currentArray(T, N)
. The reason for this is that it if I have a function taking aVector
argument it feels nice to create the vector I send in to the function using aVector
constructor. Same for matrices.I tried to implement it myself like this (and in some other ways) but it is not working:
The text was updated successfully, but these errors were encountered: