{"action":"created","comment":{"url":"https://api.github.com/repos/cuducos/elm-format-number/pulls/comments/98030688","pull_request_review_id":18660158,"id":98030688,"diff_hunk":"@@ -36,22 +36,29 @@ digits digits f =\n         fint =\n             (round (f * multiplicator))\n     in\n-        splitIntRec fint []\n+        splitThousands fint\n             |> String.concat\n             |> String.right digits\n             |> String.padLeft digits '0'\n \n \n {-| Recursive helper to format an integer\n \n-    >>> splitIntRec 12345 []\n+    >>> splitThousands 12345\n     [\"12\", \"345\"]\n -}\n-splitIntRec : Int -> List String -> List String\n-splitIntRec num tmp =\n-    if num >= 10 ^ 3 then\n-        splitIntRec\n-            (num // 10 ^ 3)\n-            ((num % 10 ^ 3 |> toString |> String.padLeft 3 '0') :: tmp)\n-    else\n-        (toString num) :: tmp\n+splitThousands : Int -> List String\n+splitThousands number =\n+    let\n+        -- Helper recursive function.\n+        -- Adds the last three digits of remainingNumber at the start of accumulator\n+        splitRemaining : Int -> List String -> List String\n+        splitRemaining remainingNumber accumulator =\n+            if remainingNumber >= 10 ^ 3 then\n+                splitRemaining\n+                    (remainingNumber // 10 ^ 3)\n+                    ((remainingNumber % 10 ^ 3 |> toString |> String.padLeft 3 '0') :: accumulator)\n+            else\n+                (toString remainingNumber) :: accumulator\n+    in\n+        splitRemaining number []","path":"src/Helpers.elm","position":64,"original_position":39,"commit_id":"2a3b27390fae4604d798b0c88dbb2799cfc8b466","original_commit_id":"a01753605eda3874f319a1032f07e5b07eb97972","user":{"login":"lovasoa","id":552629,"avatar_url":"https://avatars.githubusercontent.com/u/552629?v=3","gravatar_id":"","url":"https://api.github.com/users/lovasoa","html_url":"https://github.com/lovasoa","followers_url":"https://api.github.com/users/lovasoa/followers","following_url":"https://api.github.com/users/lovasoa/following{/other_user}","gists_url":"https://api.github.com/users/lovasoa/gists{/gist_id}","starred_url":"https://api.github.com/users/lovasoa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lovasoa/subscriptions","organizations_url":"https://api.github.com/users/lovasoa/orgs","repos_url":"https://api.github.com/users/lovasoa/repos","events_url":"https://api.github.com/users/lovasoa/events{/privacy}","received_events_url":"https://api.github.com/users/lovasoa/received_events","type":"User","site_admin":false},"body":"Is there a reason for converting to and from Float instead of simply using integer division ?\r\nPlus, you need to pad numbers with 0's.","created_at":"2017-01-26T16:23:46Z","updated_at":"2017-01-26T16:23:46Z","html_url":"https://github.com/cuducos/elm-format-number/pull/2#discussion_r98030688","pull_request_url":"https://api.github.com/repos/cuducos/elm-format-number/pulls/2","_links":{"self":{"href":"https://api.github.com/repos/cuducos/elm-format-number/pulls/comments/98030688"},"html":{"href":"https://github.com/cuducos/elm-format-number/pull/2#discussion_r98030688"},"pull_request":{"href":"https://api.github.com/repos/cuducos/elm-format-number/pulls/2"}}},"pull_request":{"url":"https://api.github.com/repos/cuducos/elm-format-number/pulls/2","id":103033411,"html_url":"https://github.com/cuducos/elm-format-number/pull/2","diff_url":"https://github.com/cuducos/elm-format-number/pull/2.diff","patch_url":"https://github.com/cuducos/elm-format-number/pull/2.patch","issue_url":"https://api.github.com/repos/cuducos/elm-format-number/issues/2","number":2,"state":"open","locked":false,"title":"Fix bugs, add tests, add predefined locales, change behavior of formatInt","user":{"login":"lovasoa","id":552629,"avatar_url":"https://avatars.githubusercontent.com/u/552629?v=3","gravatar_id":"","url":"https://api.github.com/users/lovasoa","html_url":"https://github.com/lovasoa","followers_url":"https://api.github.com/users/lovasoa/followers","following_url":"https://api.github.com/users/lovasoa/following{/other_user}","gists_url":"https://api.github.com/users/lovasoa/gists{/gist_id}","starred_url":"https://api.github.com/users/lovasoa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lovasoa/subscriptions","organizations_url":"https://api.github.com/users/lovasoa/orgs","repos_url":"https://api.github.com/users/lovasoa/repos","events_url":"https://api.github.com/users/lovasoa/events{/privacy}","received_events_url":"https://api.github.com/users/lovasoa/received_events","type":"User","site_admin":false},"body":"I needed these changes for a project, so I already published them:\r\n\r\nhttp://package.elm-lang.org/packages/lovasoa/elm-format-number/latest/FormatNumber\r\n\r\nI'm open for discussion on these changes.","created_at":"2017-01-25T00:28:40Z","updated_at":"2017-01-26T16:23:46Z","closed_at":null,"merged_at":null,"merge_commit_sha":"87ac5ffda28f748e6a2b736ecca33f28242ac046","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/cuducos/elm-format-number/pulls/2/commits","review_comments_url":"https://api.github.com/repos/cuducos/elm-format-number/pulls/2/comments","review_comment_url":"https://api.github.com/repos/cuducos/elm-format-number/pulls/comments{/number}","comments_url":"https://api.github.com/repos/cuducos/elm-format-number/issues/2/comments","statuses_url":"https://api.github.com/repos/cuducos/elm-format-number/statuses/2a3b27390fae4604d798b0c88dbb2799cfc8b466","head":{"label":"lovasoa:master","ref":"master","sha":"2a3b27390fae4604d798b0c88dbb2799cfc8b466","user":{"login":"lovasoa","id":552629,"avatar_url":"https://avatars.githubusercontent.com/u/552629?v=3","gravatar_id":"","url":"https://api.github.com/users/lovasoa","html_url":"https://github.com/lovasoa","followers_url":"https://api.github.com/users/lovasoa/followers","following_url":"https://api.github.com/users/lovasoa/following{/other_user}","gists_url":"https://api.github.com/users/lovasoa/gists{/gist_id}","starred_url":"https://api.github.com/users/lovasoa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lovasoa/subscriptions","organizations_url":"https://api.github.com/users/lovasoa/orgs","repos_url":"https://api.github.com/users/lovasoa/repos","events_url":"https://api.github.com/users/lovasoa/events{/privacy}","received_events_url":"https://api.github.com/users/lovasoa/received_events","type":"User","site_admin":false},"repo":{"id":79944367,"name":"elm-format-number","full_name":"lovasoa/elm-format-number","owner":{"login":"lovasoa","id":552629,"avatar_url":"https://avatars.githubusercontent.com/u/552629?v=3","gravatar_id":"","url":"https://api.github.com/users/lovasoa","html_url":"https://github.com/lovasoa","followers_url":"https://api.github.com/users/lovasoa/followers","following_url":"https://api.github.com/users/lovasoa/following{/other_user}","gists_url":"https://api.github.com/users/lovasoa/gists{/gist_id}","starred_url":"https://api.github.com/users/lovasoa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lovasoa/subscriptions","organizations_url":"https://api.github.com/users/lovasoa/orgs","repos_url":"https://api.github.com/users/lovasoa/repos","events_url":"https://api.github.com/users/lovasoa/events{/privacy}","received_events_url":"https://api.github.com/users/lovasoa/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/lovasoa/elm-format-number","description":"✨Format numbers as pretty strings","fork":true,"url":"https://api.github.com/repos/lovasoa/elm-format-number","forks_url":"https://api.github.com/repos/lovasoa/elm-format-number/forks","keys_url":"https://api.github.com/repos/lovasoa/elm-format-number/keys{/key_id}","collaborators_url":"https://api.github.com/repos/lovasoa/elm-format-number/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/lovasoa/elm-format-number/teams","hooks_url":"https://api.github.com/repos/lovasoa/elm-format-number/hooks","issue_events_url":"https://api.github.com/repos/lovasoa/elm-format-number/issues/events{/number}","events_url":"https://api.github.com/repos/lovasoa/elm-format-number/events","assignees_url":"https://api.github.com/repos/lovasoa/elm-format-number/assignees{/user}","branches_url":"https://api.github.com/repos/lovasoa/elm-format-number/branches{/branch}","tags_url":"https://api.github.com/repos/lovasoa/elm-format-number/tags","blobs_url":"https://api.github.com/repos/lovasoa/elm-format-number/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/lovasoa/elm-format-number/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/lovasoa/elm-format-number/git/refs{/sha}","trees_url":"https://api.github.com/repos/lovasoa/elm-format-number/git/trees{/sha}","statuses_url":"https://api.github.com/repos/lovasoa/elm-format-number/statuses/{sha}","languages_url":"https://api.github.com/repos/lovasoa/elm-format-number/languages","stargazers_url":"https://api.github.com/repos/lovasoa/elm-format-number/stargazers","contributors_url":"https://api.github.com/repos/lovasoa/elm-format-number/contributors","subscribers_url":"https://api.github.com/repos/lovasoa/elm-format-number/subscribers","subscription_url":"https://api.github.com/repos/lovasoa/elm-format-number/subscription","commits_url":"https://api.github.com/repos/lovasoa/elm-format-number/commits{/sha}","git_commits_url":"https://api.github.com/repos/lovasoa/elm-format-number/git/commits{/sha}","comments_url":"https://api.github.com/repos/lovasoa/elm-format-number/comments{/number}","issue_comment_url":"https://api.github.com/repos/lovasoa/elm-format-number/issues/comments{/number}","contents_url":"https://api.github.com/repos/lovasoa/elm-format-number/contents/{+path}","compare_url":"https://api.github.com/repos/lovasoa/elm-format-number/compare/{base}...{head}","merges_url":"https://api.github.com/repos/lovasoa/elm-format-number/merges","archive_url":"https://api.github.com/repos/lovasoa/elm-format-number/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/lovasoa/elm-format-number/downloads","issues_url":"https://api.github.com/repos/lovasoa/elm-format-number/issues{/number}","pulls_url":"https://api.github.com/repos/lovasoa/elm-format-number/pulls{/number}","milestones_url":"https://api.github.com/repos/lovasoa/elm-format-number/milestones{/number}","notifications_url":"https://api.github.com/repos/lovasoa/elm-format-number/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/lovasoa/elm-format-number/labels{/name}","releases_url":"https://api.github.com/repos/lovasoa/elm-format-number/releases{/id}","deployments_url":"https://api.github.com/repos/lovasoa/elm-format-number/deployments","created_at":"2017-01-24T19:09:09Z","updated_at":"2017-01-24T19:09:11Z","pushed_at":"2017-01-26T16:11:22Z","git_url":"git://github.com/lovasoa/elm-format-number.git","ssh_url":"git@github.com:lovasoa/elm-format-number.git","clone_url":"https://github.com/lovasoa/elm-format-number.git","svn_url":"https://github.com/lovasoa/elm-format-number","homepage":null,"size":18,"stargazers_count":0,"watchers_count":0,"language":"Elm","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"cuducos:master","ref":"master","sha":"bb423df6fc8c5d7860410eb89fa28cdaeaeca7e5","user":{"login":"cuducos","id":4732915,"avatar_url":"https://avatars.githubusercontent.com/u/4732915?v=3","gravatar_id":"","url":"https://api.github.com/users/cuducos","html_url":"https://github.com/cuducos","followers_url":"https://api.github.com/users/cuducos/followers","following_url":"https://api.github.com/users/cuducos/following{/other_user}","gists_url":"https://api.github.com/users/cuducos/gists{/gist_id}","starred_url":"https://api.github.com/users/cuducos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cuducos/subscriptions","organizations_url":"https://api.github.com/users/cuducos/orgs","repos_url":"https://api.github.com/users/cuducos/repos","events_url":"https://api.github.com/users/cuducos/events{/privacy}","received_events_url":"https://api.github.com/users/cuducos/received_events","type":"User","site_admin":false},"repo":{"id":76704698,"name":"elm-format-number","full_name":"cuducos/elm-format-number","owner":{"login":"cuducos","id":4732915,"avatar_url":"https://avatars.githubusercontent.com/u/4732915?v=3","gravatar_id":"","url":"https://api.github.com/users/cuducos","html_url":"https://github.com/cuducos","followers_url":"https://api.github.com/users/cuducos/followers","following_url":"https://api.github.com/users/cuducos/following{/other_user}","gists_url":"https://api.github.com/users/cuducos/gists{/gist_id}","starred_url":"https://api.github.com/users/cuducos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cuducos/subscriptions","organizations_url":"https://api.github.com/users/cuducos/orgs","repos_url":"https://api.github.com/users/cuducos/repos","events_url":"https://api.github.com/users/cuducos/events{/privacy}","received_events_url":"https://api.github.com/users/cuducos/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/cuducos/elm-format-number","description":"✨Format numbers as pretty strings","fork":false,"url":"https://api.github.com/repos/cuducos/elm-format-number","forks_url":"https://api.github.com/repos/cuducos/elm-format-number/forks","keys_url":"https://api.github.com/repos/cuducos/elm-format-number/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cuducos/elm-format-number/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cuducos/elm-format-number/teams","hooks_url":"https://api.github.com/repos/cuducos/elm-format-number/hooks","issue_events_url":"https://api.github.com/repos/cuducos/elm-format-number/issues/events{/number}","events_url":"https://api.github.com/repos/cuducos/elm-format-number/events","assignees_url":"https://api.github.com/repos/cuducos/elm-format-number/assignees{/user}","branches_url":"https://api.github.com/repos/cuducos/elm-format-number/branches{/branch}","tags_url":"https://api.github.com/repos/cuducos/elm-format-number/tags","blobs_url":"https://api.github.com/repos/cuducos/elm-format-number/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cuducos/elm-format-number/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cuducos/elm-format-number/git/refs{/sha}","trees_url":"https://api.github.com/repos/cuducos/elm-format-number/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cuducos/elm-format-number/statuses/{sha}","languages_url":"https://api.github.com/repos/cuducos/elm-format-number/languages","stargazers_url":"https://api.github.com/repos/cuducos/elm-format-number/stargazers","contributors_url":"https://api.github.com/repos/cuducos/elm-format-number/contributors","subscribers_url":"https://api.github.com/repos/cuducos/elm-format-number/subscribers","subscription_url":"https://api.github.com/repos/cuducos/elm-format-number/subscription","commits_url":"https://api.github.com/repos/cuducos/elm-format-number/commits{/sha}","git_commits_url":"https://api.github.com/repos/cuducos/elm-format-number/git/commits{/sha}","comments_url":"https://api.github.com/repos/cuducos/elm-format-number/comments{/number}","issue_comment_url":"https://api.github.com/repos/cuducos/elm-format-number/issues/comments{/number}","contents_url":"https://api.github.com/repos/cuducos/elm-format-number/contents/{+path}","compare_url":"https://api.github.com/repos/cuducos/elm-format-number/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cuducos/elm-format-number/merges","archive_url":"https://api.github.com/repos/cuducos/elm-format-number/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cuducos/elm-format-number/downloads","issues_url":"https://api.github.com/repos/cuducos/elm-format-number/issues{/number}","pulls_url":"https://api.github.com/repos/cuducos/elm-format-number/pulls{/number}","milestones_url":"https://api.github.com/repos/cuducos/elm-format-number/milestones{/number}","notifications_url":"https://api.github.com/repos/cuducos/elm-format-number/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cuducos/elm-format-number/labels{/name}","releases_url":"https://api.github.com/repos/cuducos/elm-format-number/releases{/id}","deployments_url":"https://api.github.com/repos/cuducos/elm-format-number/deployments","created_at":"2016-12-17T04:55:58Z","updated_at":"2016-12-22T23:08:40Z","pushed_at":"2017-01-26T16:11:24Z","git_url":"git://github.com/cuducos/elm-format-number.git","ssh_url":"git@github.com:cuducos/elm-format-number.git","clone_url":"https://github.com/cuducos/elm-format-number.git","svn_url":"https://github.com/cuducos/elm-format-number","homepage":null,"size":9,"stargazers_count":3,"watchers_count":3,"language":"Elm","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":1,"forks":2,"open_issues":1,"watchers":3,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/cuducos/elm-format-number/pulls/2"},"html":{"href":"https://github.com/cuducos/elm-format-number/pull/2"},"issue":{"href":"https://api.github.com/repos/cuducos/elm-format-number/issues/2"},"comments":{"href":"https://api.github.com/repos/cuducos/elm-format-number/issues/2/comments"},"review_comments":{"href":"https://api.github.com/repos/cuducos/elm-format-number/pulls/2/comments"},"review_comment":{"href":"https://api.github.com/repos/cuducos/elm-format-number/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/cuducos/elm-format-number/pulls/2/commits"},"statuses":{"href":"https://api.github.com/repos/cuducos/elm-format-number/statuses/2a3b27390fae4604d798b0c88dbb2799cfc8b466"}}}}
{"actor":{"display_login":"lovasoa"}}