Skip to content

#90 This makes the function tail recursive. #120

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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 src/Debugger/Expando.elm
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ mergeHelp old new =
new

(Sequence _ isClosed oldValues, Sequence seqType _ newValues) ->
Sequence seqType isClosed (mergeListHelp oldValues newValues)
Sequence seqType isClosed (mergeListHelp [] oldValues newValues)

(Dictionary isClosed _, Dictionary _ keyValuePairs) ->
Dictionary isClosed keyValuePairs
Expand All @@ -135,23 +135,23 @@ mergeHelp old new =
Record isClosed <| Dict.map (mergeDictHelp oldDict) newDict

(Constructor _ isClosed oldValues, Constructor maybeName _ newValues) ->
Constructor maybeName isClosed (mergeListHelp oldValues newValues)
Constructor maybeName isClosed (mergeListHelp [] oldValues newValues)

_ ->
new


mergeListHelp : List Expando -> List Expando -> List Expando
mergeListHelp olds news =
mergeListHelp : List Expando -> List Expando -> List Expando -> List Expando
mergeListHelp acc olds news =
case (olds, news) of
([], _) ->
news
List.reverse acc ++ news

(_, []) ->
news
List.reverse acc

(x :: xs, y :: ys) ->
mergeHelp x y :: mergeListHelp xs ys
mergeListHelp (mergeHelp x y :: acc) xs ys


mergeDictHelp : Dict String Expando -> String -> Expando -> Expando
Expand Down