Bijections.jl icon indicating copy to clipboard operation
Bijections.jl copied to clipboard

`domain` and `range` fields are not necessary

Open eascarrunz opened this issue 4 years ago • 1 comments

A suggestion for simplifying the code: It's not necessary to have dedicated domain and range fields, because the domain and range can be obtained with keys(f) and keys(finv). In fact, the Set{T} type in Julia is just a wrapper of Dict{T,Nothing}!

eascarrunz avatar Apr 04 '22 04:04 eascarrunz

I can't believe it. You are right. in is just haskey! The linear time membership-checking is just the magic of the dict-hash table!

I think the bigger problem is the documentation in the Julia manual for these different data structures.

chelate avatar May 24 '22 07:05 chelate