Skip to content

Commit

Permalink
Improved implementation of Base.show for LSHFunction. Closes #32.
Browse files Browse the repository at this point in the history
Add a new implementation of Base.show(::IO, ::LSHFunction) that prints
and arbitrary LSHFunction.
  • Loading branch information
kernelmethod committed Feb 26, 2021
1 parent dbeea02 commit 016f995
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/LSHBase.jl
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,14 @@ See also: [`SymmetricLSHFunction`](@ref)
"""
abstract type AsymmetricLSHFunction <: LSHFunction end

function Base.show(io::IO, hashfn::LSHFunction)
args = "n_hashes = $(n_hashes(hashfn))"
args = args * ", similarity = $(similarity(hashfn))"
args = args * ", hashtype = $(hashtype(hashfn))"
msg = "$(typeof(hashfn))($args)"
print(io, msg)
end

#========================
Similarity function API
========================#
Expand Down

0 comments on commit 016f995

Please sign in to comment.