Skip to content

Commit

Permalink
Support completebasecase in TeeRF and ProductRF
Browse files Browse the repository at this point in the history
  • Loading branch information
tkf committed Feb 3, 2022
1 parent 9419754 commit 7e63c22
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/combinators.jl
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ next(rf::AbstractMultiCastingRF, accs, x) = error(
return results
end

@inline completebasecase(rf::AbstractMultiCastingRF, accs) =
map((f, a) -> completebasecase(f, a), rf.fs, accs)

@inline combine(rf::AbstractMultiCastingRF, lefts, rights) =
map((f, l, r) -> combine(f, l, r), rf.fs, lefts, rights)

Expand Down
5 changes: 5 additions & 0 deletions test/test_adhocrf.jl
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,12 @@ end
@test foldl_basecase(rf, start(rf, Init)::MVector, 1:10)::SVector == ones(10)
@test foldxl(rf, 1:10)::MVector == ones(10)
@test foldxt(rf, 1:10)::SVector == ones(10)
@test foldxt(rf, 1:10; basesize = 1)::SVector == ones(10)
# @test foldxd(rf, 1:10)::SVector == ones(10) # TODO: test this

@test foldxt(TeeRF(rf, rf), 1:10)::NTuple{2,SVector} == (ones(10), ones(10))
@test foldxt(TeeRF(rf, rf), 1:10; basesize = 1)::NTuple{2,SVector} ==
(ones(10), ones(10))
end

getoninit(rf) = rf.oninit
Expand Down

0 comments on commit 7e63c22

Please sign in to comment.