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

Create Base.Fix as general Fix1/Fix2 for partially-applied functions #54653

Merged
merged 83 commits into from
Aug 3, 2024
Merged
Changes from 1 commit
Commits
Show all changes
83 commits
Select commit Hold shift + click to select a range
a2b0d84
Create Base.FixN for complex functional workflows
MilesCranmer Jun 2, 2024
402ed6c
add test for chaining FixN together
MilesCranmer Jun 2, 2024
2c0d91c
allow varargs inside FixN
MilesCranmer Jun 2, 2024
b25bb9e
remove +0 in FixN
MilesCranmer Jun 2, 2024
c4c9b33
rename to `Fix` function
MilesCranmer Jun 2, 2024
3cb4133
ensure Val constructors always inlined
MilesCranmer Jun 2, 2024
9867242
test for number of arguments edgecase
MilesCranmer Jun 2, 2024
c52779b
fix bound
MilesCranmer Jun 2, 2024
7cf7203
allow fixing kwargs in `Base.Fix` as well
MilesCranmer Jun 3, 2024
325621a
Merge branch 'master' into fixN
DilumAluthge Jun 3, 2024
e377640
switch to `Fix{n}` syntax
MilesCranmer Jun 3, 2024
a2d8605
back to minimal `Fix` implementation
MilesCranmer Jun 4, 2024
2491c62
clean up docstring with keyword-less version
MilesCranmer Jun 4, 2024
439c5b6
allow keywords in Fix and rewrite Fix1/Fix2
MilesCranmer Jun 6, 2024
4a0e778
prevent keywords from being passed to Fix1/Fix2
MilesCranmer Jun 6, 2024
a473b5e
use nothing instead of Tuple{}
MilesCranmer Jun 6, 2024
758bbcc
update Fix1/Fix2 docstrings
MilesCranmer Jun 7, 2024
e2fc740
fix undefined `@NamedTuple`
MilesCranmer Jun 7, 2024
9aa7c52
constrain `K` to `NamedTuple`
MilesCranmer Jun 7, 2024
b886dd0
extend docstring for Base.Fix
MilesCranmer Jun 7, 2024
c32c65a
update tests for Base.Fix
MilesCranmer Jun 7, 2024
866c7c7
add Base.Fix to docs
MilesCranmer Jun 7, 2024
a9674c0
add dummy-proofing to `Base.Fix{n}`
MilesCranmer Jun 8, 2024
1825f76
simplify validation check
MilesCranmer Jun 8, 2024
5604ffe
unify `Fix` constructors with `Union{F,Type{F}}`
MilesCranmer Jun 8, 2024
74dcfb1
improve readability of validation code
MilesCranmer Jun 8, 2024
10b8320
update tests with allowed behavior
MilesCranmer Jun 8, 2024
73dd2cf
make constructors more readable
MilesCranmer Jun 8, 2024
fb8ad78
tweak docstring
MilesCranmer Jun 9, 2024
de330be
tweak docstring
MilesCranmer Jun 9, 2024
a24f389
`Fix` syntax takes symbol as parameter
MilesCranmer Jun 20, 2024
1b5ffc1
remove redundant `Fix1/Fix2` methods
MilesCranmer Jun 20, 2024
6d92c1a
add note about nested `Fix`
MilesCranmer Jul 4, 2024
bc053cf
amend `Fix` validation to not convert to `Int64`
MilesCranmer Jul 4, 2024
3c19ecf
improve `Fix` readability
MilesCranmer Jul 4, 2024
3374b8f
rearrange branches in `Fix` for robust errors
MilesCranmer Jul 4, 2024
8d9c690
rewrite `Fix1`/`Fix2` docstrings to be aliases
MilesCranmer Jul 4, 2024
9a4926e
Apply suggestions from code review
MilesCranmer Jul 4, 2024
aa08daf
single branch for `Fix{n::Int}`
MilesCranmer Jul 4, 2024
e541a51
Apply suggestions from code review
MilesCranmer Jul 4, 2024
751e964
one-line validations
MilesCranmer Jul 4, 2024
669f753
remove `@inline` as not needed
MilesCranmer Jul 4, 2024
5694840
add `Fix` to public
MilesCranmer Jul 4, 2024
87f5575
update comments
MilesCranmer Jul 4, 2024
79dcd6d
avoid redundant `Val`
MilesCranmer Jul 4, 2024
f3d5c5c
reduce lines of `_validate_fix_param`
MilesCranmer Jul 4, 2024
c8bc1ab
remove old empty `Fix` test
MilesCranmer Jul 4, 2024
e9c566b
update `Fix` tests with latest changes
MilesCranmer Jul 4, 2024
9b1d749
update `Fix` test with new error message
MilesCranmer Jul 4, 2024
47a49bf
reduce branches
MilesCranmer Jul 4, 2024
06aab6f
inline `_validate_fix_param`
MilesCranmer Jul 4, 2024
54150eb
Merge branch 'master' into fixN
MilesCranmer Jul 4, 2024
6028074
Apply suggestions from code review
MilesCranmer Jul 4, 2024
f2980d4
Update base/operators.jl
MilesCranmer Jul 4, 2024
5146e1e
clean up more redundancies in tests
MilesCranmer Jul 4, 2024
cec1675
clean up more redundancies in tests
MilesCranmer Jul 4, 2024
09ee6ec
modify REPL test with new Fix docstring
MilesCranmer Jul 4, 2024
42a1e3e
add special cases for constant propagation
MilesCranmer Jul 5, 2024
bd51d2e
soften wording of nested `Fix` note
MilesCranmer Jul 5, 2024
9d8e9ab
Apply suggestions from code review
MilesCranmer Jul 5, 2024
717f39b
Apply suggestions from code review
MilesCranmer Jul 6, 2024
3f2b116
test for Fix: update tests to new error message; add zero-arg test
MilesCranmer Jul 6, 2024
316db38
grammar in error message
MilesCranmer Jul 6, 2024
04c247c
more grammar tweaks in error message
MilesCranmer Jul 6, 2024
1908c1f
test multiple kw error message
MilesCranmer Jul 6, 2024
3fbdb91
Merge branch 'master' into fixN
MilesCranmer Jul 6, 2024
d514e46
Update base/operators.jl
MilesCranmer Jul 25, 2024
ded1bfb
docs: space out compat statement
MilesCranmer Jul 25, 2024
2e9a91c
docs: describe `Fix` in NEWS
MilesCranmer Jul 26, 2024
08d774b
docs: tweak docstring for Fix
MilesCranmer Jul 26, 2024
1a107b0
docs: formatting docstring for Fix
MilesCranmer Jul 26, 2024
6bc91a2
nitpick docstring grammar
MilesCranmer Jul 26, 2024
3e19e97
normalize `compat` statement to other docstrings
MilesCranmer Jul 26, 2024
ff197b8
feat: remove single keyword version of `Fix`
MilesCranmer Aug 1, 2024
9e813fa
docs: back to old compat statement
MilesCranmer Aug 1, 2024
04dfe09
refactor: `LazyString` versions of `Fix`
MilesCranmer Aug 1, 2024
6cac583
docs: tweak compat statement
MilesCranmer Aug 1, 2024
0271f75
Merge branch 'master' into fixN
MilesCranmer Aug 1, 2024
ed64473
docs: update NEWS.md with removed keyword arg functionality
MilesCranmer Aug 1, 2024
4999c2f
fix: change in specialization from `_stable_typeof`
MilesCranmer Aug 1, 2024
c7aebb3
Revert "fix: change in specialization from `_stable_typeof`"
MilesCranmer Aug 1, 2024
8c9f62f
test: add back in test
MilesCranmer Aug 1, 2024
f065c33
Merge branch 'master' into fixN
LilithHafner Aug 2, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add test for chaining FixN together
MilesCranmer committed Jun 2, 2024
commit 402ed6c7945304e29da80526df52ce9a07de8612
11 changes: 11 additions & 0 deletions test/functional.jl
Original file line number Diff line number Diff line change
@@ -333,5 +333,16 @@ end
fixed_error_f = FixN(error_f, Inf, Val(2))
@test_throws DomainError fixed_error_f(10)
end
@testset "Chaining FixN together" begin
f1 = FixN(*, "1", Val(1))
f2 = FixN(f1, "2", Val(1))
f3 = FixN(f2, "3", Val(1))
@test f3() == "123"

g1 = FixN(*, "1", Val(2))
g2 = FixN(g1, "2", Val(2))
g3 = FixN(g2, "3", Val(2))
@test g3("") == "123"
end
end
end