Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

elm 0.19 update #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions elm-package.json → elm.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
{
"type": "package",
"version": "1.1.1",
"summary": "A package for calculating between-list edit distances.",
"name": "erwald/elm-edit-distance",
"repository": "https://github.com/erwald/elm-edit-distance.git",
"license": "MIT",
"source-directories": [
".",
"src"
],
"exposed-modules": [
"EditDistance"
],
"dependencies": {
"elm-lang/core": "5.0.0 <= v < 6.0.0",
"elm-lang/html": "2.0.0 <= v < 3.0.0"
"elm/core": "1.0.0 <= v < 2.0.0"
},
"test-dependencies": {
"elm-explorations/test": "1.0.0 <= v < 2.0.0"
},
"elm-version": "0.18.0 <= v < 0.19.0"
"elm-version": "0.19.0 <= v < 0.20.0"
}
18 changes: 9 additions & 9 deletions src/EditDistance.elm
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ doEdits costFunc source target =
, doEdits costFunc src_tail tgt_tail
]

edits =
editsList =
[ Delete src_hd (List.length src_tail)
, Insert tgt_hd (List.length tgt_tail)
, Substitute tgt_hd (List.length tgt_tail)
Expand All @@ -142,7 +142,7 @@ doEdits costFunc source target =
getCost ( _, cost ) =
cost
in
List.map2 combineResultsWithEdits results edits
List.map2 combineResultsWithEdits results editsList
|> List.sortBy getCost
|> List.head
|> Maybe.withDefault ( [], 0 )
Expand Down Expand Up @@ -194,8 +194,8 @@ moveFromSteps editSteps step =
Insert value index ->
let
-- Find the corresponding deletion, if there is one.
isCorrespondingDelete step =
case step of
isCorrespondingDelete s =
case s of
Delete otherValue _ ->
value == otherValue

Expand All @@ -217,8 +217,8 @@ moveFromSteps editSteps step =
Delete value index ->
let
-- Find the corresponding insertion, if there is one.
isCorrespondingInsert step =
case step of
isCorrespondingInsert s =
case s of
Insert otherValue _ ->
value == otherValue

Expand Down Expand Up @@ -298,11 +298,11 @@ into another.
levenshtein : List comparable -> List comparable -> Int
levenshtein source target =
case ( source, target ) of
( source, [] ) ->
( s, [] ) ->
List.length source

( [], target ) ->
List.length target
( [], t ) ->
List.length t

( src_hd :: src_tail, tgt_hd :: tgt_tail ) ->
if src_hd == tgt_hd then
Expand Down
13 changes: 0 additions & 13 deletions tests/Main.elm

This file was deleted.

2 changes: 1 addition & 1 deletion tests/Tests.elm
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ all =
Expect.equal (edits abc adc)
[ Substitute 'd' 1
]
, test "abc -> adc (without cost function) edit steps" <|
, test "abc -> adc (with cost function) edit steps" <|
\() ->
let
costFunc editStep =
Expand Down
20 changes: 0 additions & 20 deletions tests/elm-package.json

This file was deleted.