Skip to content

Commit

Permalink
Fix isexpansive for ScanEmit
Browse files Browse the repository at this point in the history
  • Loading branch information
tkf committed Oct 30, 2019
1 parent a84fed6 commit 2db4dc1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/library.jl
Expand Up @@ -1116,7 +1116,7 @@ when the sequence `x₁, x₂, x₃, ..., xₙ, ...` is fed to `ScanEmit(f)`.
$_use_initializer
See also: [`ScanEmit`](@ref), [`Iterated`](@ref).
See also: [`Scan`](@ref), [`Iterated`](@ref).
# Examples
```jldoctest
Expand All @@ -1137,7 +1137,7 @@ end

ScanEmit(f, init) = ScanEmit(f, init, nothing)

isexpansive(xf::ScanEmit) = xf.onlast === nothing
isexpansive(xf::ScanEmit) = xf.onlast !== nothing

start(rf::R_{ScanEmit}, result) =
wrap(rf, _initvalue(rf), start(inner(rf), result))
Expand Down
2 changes: 2 additions & 0 deletions test/test_processes.jl
Expand Up @@ -162,10 +162,12 @@ end
@testset for src in [xs0, collect(xs0)]
dest = zero(src)
@test map!(Filter(isodd) |> Scan(+), dest, src) == [1, 0, 4, 0, 9]
@test map!(ScanEmit(tuple, 0), dest, src) == 0:4
end

@testset "Expansive transducers are not allowed" begin
@test_throws Exception map!(Cat(), [0], 1:1)
@test_throws Exception map!(ScanEmit(tuple, 0, identity), [0], 1:1)
end
end

Expand Down

0 comments on commit 2db4dc1

Please sign in to comment.