Skip to content

Commit 016f995

Browse files
committed
Improved implementation of Base.show for LSHFunction. Closes #32.
Add a new implementation of Base.show(::IO, ::LSHFunction) that prints and arbitrary LSHFunction.
1 parent dbeea02 commit 016f995

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/LSHBase.jl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,14 @@ See also: [`SymmetricLSHFunction`](@ref)
4141
"""
4242
abstract type AsymmetricLSHFunction <: LSHFunction end
4343

44+
function Base.show(io::IO, hashfn::LSHFunction)
45+
args = "n_hashes = $(n_hashes(hashfn))"
46+
args = args * ", similarity = $(similarity(hashfn))"
47+
args = args * ", hashtype = $(hashtype(hashfn))"
48+
msg = "$(typeof(hashfn))($args)"
49+
print(io, msg)
50+
end
51+
4452
#========================
4553
Similarity function API
4654
========================#

0 commit comments

Comments
 (0)