Skip to content

Commit ab2efb2

Browse files
authored
show for Fun on Point (#454)
1 parent 5a8ee7e commit ab2efb2

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "ApproxFunBase"
22
uuid = "fbd15aa5-315a-5a7d-a8a4-24992e37be05"
3-
version = "0.8.16"
3+
version = "0.8.17"
44

55
[deps]
66
AbstractFFTs = "621f4979-c628-5d54-868e-fcf4e3e8185c"

src/show.jl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,13 @@ function show(io::IO, f::Fun)
1010
print(io,")")
1111
end
1212

13+
evalconst(f, ::AnyDomain) = f(0.0)
14+
evalconst(f, d) = f(leftendpoint(d))
15+
evalconst(f, d::Point) = f(d)
16+
1317
function show(io::IO,f::Fun{<:Union{ConstantSpace, ArraySpace{<:ConstantSpace}}})
1418
d = domain(f)
15-
print(io, f(d isa AnyDomain ? 0.0 : leftendpoint(d)))
19+
print(io, evalconst(f, domain(f)))
1620
print(io, d isa AnyDomain ? " anywhere" : " on " * string(d))
1721
end
1822

test/show.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@
5252

5353
f = Fun(ApproxFunBase.ArraySpace([ConstantSpace(0..1)]), [3])
5454
@test contains(repr(f), repr(f(0)))
55+
56+
f = Fun(1, ConstantSpace(Point(3)))
57+
@test contains(repr(f), repr(Point(3)))
58+
@test contains(repr(f), repr(1))
5559
end
5660
@testset "Operator" begin
5761
@testset "QuotientSpace" begin

0 commit comments

Comments
 (0)