Skip to content

Commit b4bda1b

Browse files
committed
Move Statistics to an extension
1 parent cf27073 commit b4bda1b

File tree

4 files changed

+16
-3
lines changed

4 files changed

+16
-3
lines changed

Project.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,14 @@ LowRankMatrices = "e65ccdef-c354-471a-8090-89bec1c20ec3"
2222
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
2323
SpecialFunctions = "276daf66-3868-5448-9aa4-cd146d93841b"
2424
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
25-
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
2625

2726
[weakdeps]
2827
SpecialFunctions = "276daf66-3868-5448-9aa4-cd146d93841b"
28+
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
2929

3030
[extensions]
3131
ApproxFunBaseSpecialFunctionsExt = "SpecialFunctions"
32+
ApproxFunBaseStatisticsExt = "Statistics"
3233

3334
[compat]
3435
AbstractFFTs = "0.5, 1"

ext/ApproxFunBaseStatisticsExt.jl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
module ApproxFunBaseStatisticsExt
2+
3+
import ApproxFunBase
4+
using ApproxFunBase: IntervalOrSegment
5+
import Statistics: mean
6+
7+
mean(d::IntervalOrSegment) = ApproxFunBase.mean(d)
8+
9+
end

src/ApproxFunBase.jl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,7 @@ using IntervalSets
1616
using LinearAlgebra
1717
using LowRankMatrices
1818
using SparseArrays
19-
# using SpecialFunctions
2019
using StaticArrays: SVector, @SArray, SArray
21-
import Statistics: mean
2220

2321
import DomainSets: Domain, indomain, UnionDomain, ProductDomain, Point, ∂,
2422
SetdiffDomain, Interval, ChebyshevInterval, boundary,

test/runtests.jl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -789,3 +789,8 @@ include("show.jl")
789789

790790
@test @inferred(chebyshev_clenshaw(BigInt[1], 1)) == 1
791791
end
792+
793+
@testset "Statistics" begin
794+
@test mean(Segment(1,3)) == 2
795+
@test mean(1..3) == 2
796+
end

0 commit comments

Comments
 (0)