Skip to content

Commit 9b971d3

Browse files
committed
import deprecated functions from Base
On 0.5, the 8 functions excised from Base are still defined, as they have methods that print the error to use Combinatorics.jl. Ref: JuliaLang/julia#13897 (comment)
1 parent ebf1319 commit 9b971d3

File tree

4 files changed

+8
-6
lines changed

4 files changed

+8
-6
lines changed

src/Combinatorics.jl

+8
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@ using Compat, Polynomials, Iterators
44

55
import Base: start, next, done, length, eltype
66

7+
#These 8 functions were removed from Julia 0.5 as part of JuliaLang/julia#13897,
8+
#so check if it's necessary to import them to overload the stub methods left in
9+
#Base.
10+
if isdefined(Base, :combinations)
11+
import Base: combinations, partitions, prevprod, levicivita, nthperm,
12+
nthperm!, parity, permutations
13+
end
14+
715
include("numbers.jl")
816
include("factorials.jl")
917
include("combinations.jl")

test/combinations.jl

-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
using Combinatorics
22
using Base.Test
33

4-
import Combinatorics: combinations
5-
6-
74
@test collect(combinations([])) == []
85
@test collect(combinations(['a', 'b', 'c'])) == Any[['a'],['b'],['c'],['a','b'],['a','c'],['b','c'],['a','b','c']]
96

test/partitions.jl

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using Combinatorics
22
using Base.Test
3-
import Combinatorics: partitions, prevprod
43

54
@test collect(partitions(4)) == Any[[4], [3,1], [2,2], [2,1,1], [1,1,1,1]]
65
@test collect(partitions(8,3)) == Any[[6,1,1], [5,2,1], [4,3,1], [4,2,2], [3,3,2]]

test/permutations.jl

-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
using Combinatorics
22
using Base.Test
33

4-
import Combinatorics: levicivita, nthperm, nthperm!, parity, permutations
5-
64
# permutations
75
@test collect(permutations("abc")) == Any[['a','b','c'],['a','c','b'],['b','a','c'],
86
['b','c','a'],['c','a','b'],['c','b','a']]

0 commit comments

Comments
 (0)