-
-
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
make collection constructors more uniform #5897
Conversation
change Set, IntSet, and PriorityQueue constructors to accept a single iterable add an ObjectIdDict constructor accepting an iterable now you can do this: ``` julia> pairs = [(1,2), (3,4)]; julia> ObjectIdDict(pairs) {1=>2,3=>4} julia> Dict(pairs) [3=>4,1=>2] julia> Collections.PriorityQueue(pairs) [3=>4,1=>2] julia> Set(pairs) Set{(Int64,Int64)}([(1,2),(3,4)]) ```
Come to think of it, it wouldn't be so bad to add a |
+1 for this PR. I've pointed it out before, but I think the Scala collections hierarchy (or the immutable hierarchy) are well thought out and could provide a basis for collections in Julia. In particular: The lack of multiple inheritance in Julia does limit this somewhat (in Scala, these are (This paper describes the meaning of |
It will be especially nice in conjunction with #4470, as this will give us comprehension-like syntax for all these collections. |
Yes, very true. That will be a very nice interface. |
make collection constructors more uniform
fixes #4996 and #4871
change Set, IntSet, and PriorityQueue constructors to accept a single iterable
add an ObjectIdDict constructor accepting an iterable
now you can do this: