diff --git a/README.md b/README.md index cde3989..d64f216 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,8 @@ Julia functions for computing prime numbers. +## Usage + At the moment, this repository just contains the following functions which have been duplicated from Base Julia: factor(n) -> Dict @@ -50,4 +52,7 @@ true > Returns a prime sieve, as a `BitArray`, of the positive integers (from `lo`, if specified) up to `hi`. Useful when working with either primes or composite numbers. -None of these are currently exported, so need to be explicitly imported before use. +To avoid naming conflicts with Base, these are not exported for Julia version 0.4. In this case you will need to explicitly import the symbols: + + using Primes + import Primes: isprime, primes, primesmask, factor diff --git a/src/Primes.jl b/src/Primes.jl index 659399a..8625b08 100644 --- a/src/Primes.jl +++ b/src/Primes.jl @@ -1,6 +1,14 @@ __precompile__() module Primes +if VERSION >= v"0.5.0-dev+4340" + if isdefined(Base,:isprime) + import Base: isprime, primes, primesmask, factor + else + export isprime, primes, primesmask, factor + end +end + # Primes generating functions # https://en.wikipedia.org/wiki/Sieve_of_Eratosthenes # https://en.wikipedia.org/wiki/Wheel_factorization