Skip to content
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

Implement BitArray construction from iterables #19018

Merged
merged 2 commits into from
Oct 19, 2016
Merged

Conversation

carlobaldassi
Copy link
Member

In particular, can now use generators, e.g. BitArray(isodd(x) for x = 1:20) and similar.
Fixes #3166.

@@ -271,7 +265,7 @@ end
Broadcasts the arrays, tuples and/or scalars `As` to a container of the
appropriate type and dimensions. In this context, anything that is not a
subtype of `AbstractArray` or `Tuple` is considered a scalar. The resulting
container is stablished by the following rules:
container is established by the following rules:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this need a make docs run? commit the rst change too if there is one

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't notice that. I have updated the rst and put this change in a separate commit now.

@carlobaldassi carlobaldassi force-pushed the cb/bitgenerators branch 2 times, most recently from 0390644 to 50d1d0d Compare October 19, 2016 07:42
@carlobaldassi carlobaldassi merged commit ad8cc19 into master Oct 19, 2016
@carlobaldassi carlobaldassi deleted the cb/bitgenerators branch October 19, 2016 08:04
@carlobaldassi
Copy link
Member Author

While not strictly a bugfix, I suppose this could be backported easily (if no issues arise).

@tkelman
Copy link
Contributor

tkelman commented Oct 19, 2016

It seems like more of a feature, and would be easy to write code that worked in (say) 0.5.2 but not 0.5.0 if it were backported, I'd usually rather not. Could maybe be supported with @compat BitArray though?

@carlobaldassi
Copy link
Member Author

@tkelman yes you're right, this is definitely a feature, it's probably best not to backport it after all. As for Compat support, it could be done for 0.5 (just copying the code from this PR in Compat would do the trick), but I think not for 0.4, because 1) generator syntax cannot be parsed, and 2) the constructor dispatches on the shape traits of the iterator argument, which I don't think are available in 0.4.

carlobaldassi added a commit that referenced this pull request Oct 20, 2016
The new constructors were introduced in #19018.
The docs are actually also for the old constructors.

[ci skip]
carlobaldassi added a commit that referenced this pull request Oct 21, 2016
The new constructors were introduced in #19018.
The docs are actually also for the old constructors.

[ci skip]
fcard pushed a commit to fcard/julia that referenced this pull request Feb 28, 2017
The new constructors were introduced in JuliaLang#19018.
The docs are actually also for the old constructors.

[ci skip]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants