JuliaApproximation / DomainSets.jl

A Julia package for describing domains as continuous sets of elements
MIT License
72 stars 12 forks source link

fix definition of Z, R, N and Q (#94) #95

Closed daanhb closed 2 years ago

daanhb commented 2 years ago

94

codecov[bot] commented 2 years ago

Codecov Report

Merging #95 (26e5a16) into master (6b7983d) will increase coverage by 0.14%. The diff coverage is 96.66%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #95      +/-   ##
==========================================
+ Coverage   84.79%   84.94%   +0.14%     
==========================================
  Files          30       31       +1     
  Lines        2387     2417      +30     
==========================================
+ Hits         2024     2053      +29     
- Misses        363      364       +1     
Impacted Files Coverage Δ
src/DomainSets.jl 100.00% <ø> (ø)
src/generic/canonical.jl 69.76% <ø> (ø)
src/generic/domain.jl 91.80% <ø> (ø)
src/domains/numbers.jl 93.75% <93.75%> (ø)
src/domains/trivial.jl 94.36% <100.00%> (+1.38%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 6b7983d...26e5a16. Read the comment docs.

dlfivefifty commented 2 years ago

Why remove them when implementing is very straightforward?

daanhb commented 2 years ago

Did you have an implementation in mind? I was thinking we could make a strict "StrictFullSpace{T}" (or something with a better name) which contains x if x is of type T, or if convert(T, x) works. That might be useful elsewhere too.

daanhb commented 2 years ago

It's like a TypeDomain, the domain of all instances of a certain type

dlfivefifty commented 2 years ago

Why not:

struct Integers end
in(x, ::Integers) = isinteger(x)
daanhb commented 2 years ago

I've done both, more strict full spaces called TypeDomain and specific number sets like Integers. The isinteger function seems indeed most appropriate to define the set of integers. The isreal function allows real arrays (intentionally), so I had to exclude those for the set of real numbers. It's a pity there are no generic functions isnumber, iscomplex and isrational.

Anyway:

julia> π ∈ ℤ
false