Skip to content

Commit

Permalink
import deprecated functions from Base
Browse files Browse the repository at this point in the history
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)
  • Loading branch information
jiahao committed Nov 12, 2015
1 parent ebf1319 commit 9b971d3
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
8 changes: 8 additions & 0 deletions src/Combinatorics.jl
Expand Up @@ -4,6 +4,14 @@ using Compat, Polynomials, Iterators

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

#These 8 functions were removed from Julia 0.5 as part of JuliaLang/julia#13897,
#so check if it's necessary to import them to overload the stub methods left in
#Base.
if isdefined(Base, :combinations)
import Base: combinations, partitions, prevprod, levicivita, nthperm,
nthperm!, parity, permutations
end

include("numbers.jl")
include("factorials.jl")
include("combinations.jl")
Expand Down
3 changes: 0 additions & 3 deletions test/combinations.jl
@@ -1,9 +1,6 @@
using Combinatorics
using Base.Test

import Combinatorics: combinations


@test collect(combinations([])) == []
@test collect(combinations(['a', 'b', 'c'])) == Any[['a'],['b'],['c'],['a','b'],['a','c'],['b','c'],['a','b','c']]

Expand Down
1 change: 0 additions & 1 deletion test/partitions.jl
@@ -1,6 +1,5 @@
using Combinatorics
using Base.Test
import Combinatorics: partitions, prevprod

@test collect(partitions(4)) == Any[[4], [3,1], [2,2], [2,1,1], [1,1,1,1]]
@test collect(partitions(8,3)) == Any[[6,1,1], [5,2,1], [4,3,1], [4,2,2], [3,3,2]]
Expand Down
2 changes: 0 additions & 2 deletions test/permutations.jl
@@ -1,8 +1,6 @@
using Combinatorics
using Base.Test

import Combinatorics: levicivita, nthperm, nthperm!, parity, permutations

# permutations
@test collect(permutations("abc")) == Any[['a','b','c'],['a','c','b'],['b','a','c'],
['b','c','a'],['c','a','b'],['c','b','a']]
Expand Down

0 comments on commit 9b971d3

Please sign in to comment.