diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index a6fcff2..fc1526b 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -22,6 +22,8 @@ jobs: exclude: - os: macOS-latest arch: x86 + - os: windows-latest + arch: x86 steps: - uses: actions/checkout@v2 - uses: julia-actions/setup-julia@v1 @@ -51,7 +53,7 @@ jobs: - uses: actions/checkout@v2 - uses: julia-actions/setup-julia@v1 with: - version: '1' + version: "^1.6.0-0" - run: | julia --project=docs -e ' using Pkg diff --git a/Project.toml b/Project.toml index 33fd991..8384c28 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "PatternFolds" uuid = "c18a7f1d-76ad-4ce4-950d-5419b888513b" authors = ["Jean-Francois Baffier"] -version = "0.1.1" +version = "0.1.2" [deps] Lazy = "50d2b5c4-7a5e-59d5-8109-a42b560f39c0" diff --git a/src/PatternFolds.jl b/src/PatternFolds.jl index 0127435..3609fb0 100644 --- a/src/PatternFolds.jl +++ b/src/PatternFolds.jl @@ -1,12 +1,16 @@ module PatternFolds -import Base: length, rand, iterate, isempty, ndims, +, in, size -import Lazy: @forward +# usings +using Lazy # exports -export PatternFold, IVectorFold, VectorFold, Interval, IntervalsFold +export PatternFold +export IVectorFold, VectorFold +export Interval, IntervalsFold export pattern, gap, folds -export length, unfold +export length +export unfold +export value # includes include("common.jl") diff --git a/src/common.jl b/src/common.jl index c989eb1..68e2d99 100644 --- a/src/common.jl +++ b/src/common.jl @@ -27,7 +27,7 @@ Return the number of *folds*. An infinite folded pattern returns `0`. folds(pf) = pf.folds # Forwards isempty, ndims -@forward PatternFold.pattern isempty, ndims +@forward PatternFold.pattern Base.isempty, Base.ndims # TODO - look if another name is more appropriate """ @@ -59,4 +59,4 @@ end reset_pattern!(<:PatternFold) Reset the *unfolded* pattern to the first fold. """ -reset_pattern!(mvf) = set_fold!(mvf, 1) \ No newline at end of file +reset_pattern!(mvf) = set_fold!(mvf, 1) diff --git a/src/intervals.jl b/src/intervals.jl index 08a41ae..9d371cd 100644 --- a/src/intervals.jl +++ b/src/intervals.jl @@ -11,8 +11,8 @@ Interval(a, b) = Interval{typeof(a[1])}(a,b) a(i) = i.a b(i) = i.b -+(bound::Tuple{T, Bool}, gap::T) where T = bound[1]+gap, bound[2] -+(i::Interval, gap) = Interval(a(i) + gap, b(i) + gap) +Base.:+(bound::Tuple{T, Bool}, gap::T) where T = bound[1]+gap, bound[2] +Base.:+(i::Interval, gap) = Interval(a(i) + gap, b(i) + gap) value(i, ::Val{:a}) = i.a[1] value(i, ::Val{:b}) = i.b[1] @@ -45,7 +45,7 @@ end IntervalsFold(p, g, f, c = 1) = IntervalsFold(p, g, f, c) -@forward IntervalsFold.pattern a, b, isempty +@forward IntervalsFold.pattern a, b, Base.isempty function pattern(isf::IntervalsFold) distortion = gap(isf) * (isf.current - 1) @@ -66,7 +66,7 @@ function set_fold!(isf::IntervalsFold, new_fold = isf.current + 1) isf.pattern += distortion isf.current = new_fold end -end +end function Base.iterate(iter::IntervalsFold) reset_pattern!(iter) @@ -97,4 +97,4 @@ end Base.size(isf::IntervalsFold) = size(isf.pattern) * folds(isf) -Base.eltype(::Type{<:IntervalsFold{T}}) where {T} = Interval{T} \ No newline at end of file +Base.eltype(::Type{<:IntervalsFold{T}}) where {T} = Interval{T} diff --git a/src/vector.jl b/src/vector.jl index 6696b38..10d593f 100644 --- a/src/vector.jl +++ b/src/vector.jl @@ -31,7 +31,7 @@ function set_fold!(mvf, new_fold = mvf.current + 1) mvf.pattern .+= distortion mvf.current = new_fold end -end +end # Base case iterate method function Base.iterate(iter::VectorFold) @@ -92,4 +92,4 @@ function unfold(mvf::VectorFold; from=1, to=folds(mvf)) count += 1 end return v -end \ No newline at end of file +end