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

predicate function negation with ComposedFunction #44752

Merged
merged 7 commits into from
Apr 12, 2022
Merged

predicate function negation with ComposedFunction #44752

merged 7 commits into from
Apr 12, 2022

Conversation

markmbaum
Copy link
Contributor

@markmbaum markmbaum commented Mar 25, 2022

Closes #44748 , this small PR does the following

  • redefines predicate function negation !(f::Function) = (!) ∘ f
  • updates the show method for ComposedFunction to print operators in parentheses
  • adds a method for !(f::ComposedFunction{typeof(!)}) that allows !!f === f
  • adds a test for !!f === f and a few tests for showing composed functions

thanks for the tutelage @stevengj !

base/operators.jl Outdated Show resolved Hide resolved
base/operators.jl Outdated Show resolved Hide resolved
base/operators.jl Outdated Show resolved Hide resolved
base/show.jl Outdated Show resolved Hide resolved
base/operators.jl Outdated Show resolved Hide resolved
base/operators.jl Outdated Show resolved Hide resolved
base/operators.jl Outdated Show resolved Hide resolved
base/operators.jl Show resolved Hide resolved
base/operators.jl Outdated Show resolved Hide resolved
stevengj
stevengj previously approved these changes Mar 29, 2022
@stevengj stevengj added the needs news A NEWS entry is required for this change label Mar 29, 2022
@stevengj
Copy link
Member

Should have an item in NEWS.md.

@stevengj stevengj dismissed their stale review March 29, 2022 18:19

news and docs

@stevengj stevengj added needs docs Documentation for this change is required needs compat annotation Add !!! compat "Julia x.y" to the docstring and removed needs docs Documentation for this change is required needs news A NEWS entry is required for this change needs compat annotation Add !!! compat "Julia x.y" to the docstring labels Mar 29, 2022
@stevengj stevengj added the status:merge me PR is reviewed. Merge when all tests are passing label Apr 2, 2022
base/operators.jl Outdated Show resolved Hide resolved
Co-authored-by: Mosè Giordano <giordano@users.noreply.github.com>
@DilumAluthge
Copy link
Member

cmdlineargs failures on test_x86_64-apple-darwin are #44947

@DilumAluthge DilumAluthge merged commit d4e26c8 into JuliaLang:master Apr 12, 2022
@DilumAluthge DilumAluthge removed the status:merge me PR is reviewed. Merge when all tests are passing label Apr 12, 2022
@StefanKarpinski
Copy link
Sponsor Member

Nice work and thanks, @markmbaum! Great contribution.

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.

!foo should use (!) ∘ foo
7 participants