Skip to content

Commit 26b6575

Browse files
committed
Move Statistics to an extension
1 parent 66cfb9c commit 26b6575

File tree

4 files changed

+16
-2
lines changed

4 files changed

+16
-2
lines changed

Project.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,16 @@ LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
2020
LowRankMatrices = "e65ccdef-c354-471a-8090-89bec1c20ec3"
2121
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
2222
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
23-
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
2423

2524
[weakdeps]
2625
DualNumbers = "fa6b7ba4-c1ee-5f82-b5fc-ecf0adba8f74"
2726
SpecialFunctions = "276daf66-3868-5448-9aa4-cd146d93841b"
27+
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
2828

2929
[extensions]
3030
ApproxFunBaseDualNumbersExt = "DualNumbers"
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 & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ using LinearAlgebra
1616
using LowRankMatrices
1717
using SparseArrays
1818
using StaticArrays: SVector, @SArray, SArray
19-
import Statistics: mean
2019

2120
import DomainSets: Domain, indomain, UnionDomain, ProductDomain, Point, ∂,
2221
SetdiffDomain, Interval, ChebyshevInterval, boundary,

test/runtests.jl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -792,3 +792,8 @@ end
792792

793793
@test @inferred(chebyshev_clenshaw(BigInt[1], 1)) == 1
794794
end
795+
796+
@testset "Statistics" begin
797+
@test mean(Segment(1,3)) == 2
798+
@test mean(1..3) == 2
799+
end

0 commit comments

Comments
 (0)