Skip to content

Commit

Permalink
Add new function to Nilsimsa module
Browse files Browse the repository at this point in the history
  • Loading branch information
philipbrown committed Jun 19, 2023
1 parent 47218fa commit 0663ddf
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ You can also process a stream:
```elixir
"war_and_peace.txt"
|> File.stream!()
|> Enum.reduce(Nilsimsa.process(""), &Nilsimsa.process/2)
|> Enum.reduce(Nilsimsa.new(), &Nilsimsa.process/2)
```

## Generating a digest
Expand Down
12 changes: 12 additions & 0 deletions lib/nilsimsa.ex
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,18 @@ defmodule Nilsimsa do
threshold: 0.0,
window: for(_ <- 0..3, do: -1)

@doc """
Create a new Nilsimsa.
## Examples
iex> Nilsimsa.new() |> to_string()
"0000000000000000000000000000000000000000000000000000000000000000"
"""
def new,
do: %__MODULE__{}

@doc """
Compare two hashed values
Expand Down

0 comments on commit 0663ddf

Please sign in to comment.