{"action":"created","comment":{"url":"https://api.github.com/repos/javaslang/javaslang/pulls/comments/70166298","id":70166298,"diff_hunk":"@@ -0,0 +1,44 @@\n+/*     / \\____  _    _  ____   ______  / \\ ____  __    _______\n+ *    /  /    \\/ \\  / \\/    \\ /  /\\__\\/  //    \\/  \\  //  /\\__\\   JΛVΛSLΛNG\n+ *  _/  /  /\\  \\  \\/  /  /\\  \\\\__\\\\  \\  //  /\\  \\ /\\\\/ \\ /__\\ \\   Copyright 2014-2016 Javaslang, http://javaslang.io\n+ * /___/\\_/  \\_/\\____/\\_/  \\_/\\__\\/__/\\__\\_/  \\_//  \\__/\\_____/   Licensed under the Apache License, Version 2.0\n+ */\n+package javaslang.collection.euler;\n+\n+import javaslang.collection.Stream;\n+import org.junit.Test;\n+\n+import java.math.BigInteger;\n+\n+import static org.assertj.core.api.Assertions.assertThat;\n+\n+/**\n+ * <strong>Problem 20:Factorial digit sum</strong>\n+ *\n+ * <p><i>n</i>! means <i>n</i> × (<i>n</i> − 1) × ... × 3 × 2 × 1</p>\n+ * <p>For example, 10! = 10 × 9 × ... × 3 × 2 × 1 = 3628800,<br />and the sum of the digits in the number 10! is 3 + 6 + 2 + 8 + 8 + 0 + 0 = 27.</p>\n+ * <p>Find the sum of the digits in the number 100!</p>\n+ *\n+ * See also <a href=\"https://projecteuler.net/problem=20\">projecteuler.net problem 20</a>.\n+ */\n+\n+public class Euler20Test {\n+\n+    @Test\n+    public void shouldSolveProblem20() {\n+        assertThat(sumOfDigits100Factorial()).isEqualTo(648);\n+    }\n+\n+    private static BigInteger factorial(int n) {\n+        return Stream.rangeClosed(1, n)\n+                .map(BigInteger::valueOf)\n+                .fold(BigInteger.ONE, BigInteger::multiply);\n+    }\n+\n+    private static int sumOfDigits100Factorial() {\n+        return Stream.ofAll(factorial(100).toString().toCharArray())","path":"javaslang/src/test/java/javaslang/collection/euler/Euler20Test.java","position":39,"original_position":39,"commit_id":"039f460216415603639aed2819438af6ad1a5541","original_commit_id":"039f460216415603639aed2819438af6ad1a5541","user":{"login":"paplorinc","id":1841944,"avatar_url":"https://avatars.githubusercontent.com/u/1841944?v=3","gravatar_id":"","url":"https://api.github.com/users/paplorinc","html_url":"https://github.com/paplorinc","followers_url":"https://api.github.com/users/paplorinc/followers","following_url":"https://api.github.com/users/paplorinc/following{/other_user}","gists_url":"https://api.github.com/users/paplorinc/gists{/gist_id}","starred_url":"https://api.github.com/users/paplorinc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/paplorinc/subscriptions","organizations_url":"https://api.github.com/users/paplorinc/orgs","repos_url":"https://api.github.com/users/paplorinc/repos","events_url":"https://api.github.com/users/paplorinc/events{/privacy}","received_events_url":"https://api.github.com/users/paplorinc/received_events","type":"User","site_admin":false},"body":"`CharSeq` makes String composable (instead of wrapping it into a Stream) and instead of `map/sum/int` we could also use `foldLeft`:\r\n```java\r\nreturn CharSeq.of(factorial(n).toString())\r\n              .foldLeft(0, (sum, c) -> sum + Character.digit(c, 10));\r\n```","created_at":"2016-07-09T11:58:43Z","updated_at":"2016-07-09T11:58:43Z","html_url":"https://github.com/javaslang/javaslang/pull/1421#discussion_r70166298","pull_request_url":"https://api.github.com/repos/javaslang/javaslang/pulls/1421","_links":{"self":{"href":"https://api.github.com/repos/javaslang/javaslang/pulls/comments/70166298"},"html":{"href":"https://github.com/javaslang/javaslang/pull/1421#discussion_r70166298"},"pull_request":{"href":"https://api.github.com/repos/javaslang/javaslang/pulls/1421"}}},"pull_request":{"url":"https://api.github.com/repos/javaslang/javaslang/pulls/1421","id":76558130,"html_url":"https://github.com/javaslang/javaslang/pull/1421","diff_url":"https://github.com/javaslang/javaslang/pull/1421.diff","patch_url":"https://github.com/javaslang/javaslang/pull/1421.patch","issue_url":"https://api.github.com/repos/javaslang/javaslang/issues/1421","number":1421,"state":"open","locked":false,"title":"Added Test - Project Euler problem 19","user":{"login":"ashrko619","id":11240142,"avatar_url":"https://avatars.githubusercontent.com/u/11240142?v=3","gravatar_id":"","url":"https://api.github.com/users/ashrko619","html_url":"https://github.com/ashrko619","followers_url":"https://api.github.com/users/ashrko619/followers","following_url":"https://api.github.com/users/ashrko619/following{/other_user}","gists_url":"https://api.github.com/users/ashrko619/gists{/gist_id}","starred_url":"https://api.github.com/users/ashrko619/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ashrko619/subscriptions","organizations_url":"https://api.github.com/users/ashrko619/orgs","repos_url":"https://api.github.com/users/ashrko619/repos","events_url":"https://api.github.com/users/ashrko619/events{/privacy}","received_events_url":"https://api.github.com/users/ashrko619/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-07-07T08:39:55Z","updated_at":"2016-07-09T11:58:43Z","closed_at":null,"merged_at":null,"merge_commit_sha":"93b2613467bd1f458ac34f7c2519f6a0bdc7beb9","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/javaslang/javaslang/pulls/1421/commits","review_comments_url":"https://api.github.com/repos/javaslang/javaslang/pulls/1421/comments","review_comment_url":"https://api.github.com/repos/javaslang/javaslang/pulls/comments{/number}","comments_url":"https://api.github.com/repos/javaslang/javaslang/issues/1421/comments","statuses_url":"https://api.github.com/repos/javaslang/javaslang/statuses/039f460216415603639aed2819438af6ad1a5541","head":{"label":"ashrko619:master","ref":"master","sha":"039f460216415603639aed2819438af6ad1a5541","user":{"login":"ashrko619","id":11240142,"avatar_url":"https://avatars.githubusercontent.com/u/11240142?v=3","gravatar_id":"","url":"https://api.github.com/users/ashrko619","html_url":"https://github.com/ashrko619","followers_url":"https://api.github.com/users/ashrko619/followers","following_url":"https://api.github.com/users/ashrko619/following{/other_user}","gists_url":"https://api.github.com/users/ashrko619/gists{/gist_id}","starred_url":"https://api.github.com/users/ashrko619/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ashrko619/subscriptions","organizations_url":"https://api.github.com/users/ashrko619/orgs","repos_url":"https://api.github.com/users/ashrko619/repos","events_url":"https://api.github.com/users/ashrko619/events{/privacy}","received_events_url":"https://api.github.com/users/ashrko619/received_events","type":"User","site_admin":false},"repo":{"id":62787782,"name":"javaslang","full_name":"ashrko619/javaslang","owner":{"login":"ashrko619","id":11240142,"avatar_url":"https://avatars.githubusercontent.com/u/11240142?v=3","gravatar_id":"","url":"https://api.github.com/users/ashrko619","html_url":"https://github.com/ashrko619","followers_url":"https://api.github.com/users/ashrko619/followers","following_url":"https://api.github.com/users/ashrko619/following{/other_user}","gists_url":"https://api.github.com/users/ashrko619/gists{/gist_id}","starred_url":"https://api.github.com/users/ashrko619/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ashrko619/subscriptions","organizations_url":"https://api.github.com/users/ashrko619/orgs","repos_url":"https://api.github.com/users/ashrko619/repos","events_url":"https://api.github.com/users/ashrko619/events{/privacy}","received_events_url":"https://api.github.com/users/ashrko619/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ashrko619/javaslang","description":"A functional library for Java 8+ that provides persistent data types and functional control structures.","fork":true,"url":"https://api.github.com/repos/ashrko619/javaslang","forks_url":"https://api.github.com/repos/ashrko619/javaslang/forks","keys_url":"https://api.github.com/repos/ashrko619/javaslang/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ashrko619/javaslang/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ashrko619/javaslang/teams","hooks_url":"https://api.github.com/repos/ashrko619/javaslang/hooks","issue_events_url":"https://api.github.com/repos/ashrko619/javaslang/issues/events{/number}","events_url":"https://api.github.com/repos/ashrko619/javaslang/events","assignees_url":"https://api.github.com/repos/ashrko619/javaslang/assignees{/user}","branches_url":"https://api.github.com/repos/ashrko619/javaslang/branches{/branch}","tags_url":"https://api.github.com/repos/ashrko619/javaslang/tags","blobs_url":"https://api.github.com/repos/ashrko619/javaslang/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ashrko619/javaslang/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ashrko619/javaslang/git/refs{/sha}","trees_url":"https://api.github.com/repos/ashrko619/javaslang/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ashrko619/javaslang/statuses/{sha}","languages_url":"https://api.github.com/repos/ashrko619/javaslang/languages","stargazers_url":"https://api.github.com/repos/ashrko619/javaslang/stargazers","contributors_url":"https://api.github.com/repos/ashrko619/javaslang/contributors","subscribers_url":"https://api.github.com/repos/ashrko619/javaslang/subscribers","subscription_url":"https://api.github.com/repos/ashrko619/javaslang/subscription","commits_url":"https://api.github.com/repos/ashrko619/javaslang/commits{/sha}","git_commits_url":"https://api.github.com/repos/ashrko619/javaslang/git/commits{/sha}","comments_url":"https://api.github.com/repos/ashrko619/javaslang/comments{/number}","issue_comment_url":"https://api.github.com/repos/ashrko619/javaslang/issues/comments{/number}","contents_url":"https://api.github.com/repos/ashrko619/javaslang/contents/{+path}","compare_url":"https://api.github.com/repos/ashrko619/javaslang/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ashrko619/javaslang/merges","archive_url":"https://api.github.com/repos/ashrko619/javaslang/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ashrko619/javaslang/downloads","issues_url":"https://api.github.com/repos/ashrko619/javaslang/issues{/number}","pulls_url":"https://api.github.com/repos/ashrko619/javaslang/pulls{/number}","milestones_url":"https://api.github.com/repos/ashrko619/javaslang/milestones{/number}","notifications_url":"https://api.github.com/repos/ashrko619/javaslang/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ashrko619/javaslang/labels{/name}","releases_url":"https://api.github.com/repos/ashrko619/javaslang/releases{/id}","deployments_url":"https://api.github.com/repos/ashrko619/javaslang/deployments","created_at":"2016-07-07T08:09:48Z","updated_at":"2016-07-07T08:09:50Z","pushed_at":"2016-07-09T08:10:26Z","git_url":"git://github.com/ashrko619/javaslang.git","ssh_url":"git@github.com:ashrko619/javaslang.git","clone_url":"https://github.com/ashrko619/javaslang.git","svn_url":"https://github.com/ashrko619/javaslang","homepage":"http://javaslang.io","size":11905,"stargazers_count":0,"watchers_count":0,"language":"Java","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":"javaslang:master","ref":"master","sha":"06155ed74dc4b2dcbc47b502fd1b95b8631599a7","user":{"login":"javaslang","id":5786132,"avatar_url":"https://avatars.githubusercontent.com/u/5786132?v=3","gravatar_id":"","url":"https://api.github.com/users/javaslang","html_url":"https://github.com/javaslang","followers_url":"https://api.github.com/users/javaslang/followers","following_url":"https://api.github.com/users/javaslang/following{/other_user}","gists_url":"https://api.github.com/users/javaslang/gists{/gist_id}","starred_url":"https://api.github.com/users/javaslang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/javaslang/subscriptions","organizations_url":"https://api.github.com/users/javaslang/orgs","repos_url":"https://api.github.com/users/javaslang/repos","events_url":"https://api.github.com/users/javaslang/events{/privacy}","received_events_url":"https://api.github.com/users/javaslang/received_events","type":"Organization","site_admin":false},"repo":{"id":16378879,"name":"javaslang","full_name":"javaslang/javaslang","owner":{"login":"javaslang","id":5786132,"avatar_url":"https://avatars.githubusercontent.com/u/5786132?v=3","gravatar_id":"","url":"https://api.github.com/users/javaslang","html_url":"https://github.com/javaslang","followers_url":"https://api.github.com/users/javaslang/followers","following_url":"https://api.github.com/users/javaslang/following{/other_user}","gists_url":"https://api.github.com/users/javaslang/gists{/gist_id}","starred_url":"https://api.github.com/users/javaslang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/javaslang/subscriptions","organizations_url":"https://api.github.com/users/javaslang/orgs","repos_url":"https://api.github.com/users/javaslang/repos","events_url":"https://api.github.com/users/javaslang/events{/privacy}","received_events_url":"https://api.github.com/users/javaslang/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/javaslang/javaslang","description":"A functional library for Java 8+ that provides persistent data types and functional control structures.","fork":false,"url":"https://api.github.com/repos/javaslang/javaslang","forks_url":"https://api.github.com/repos/javaslang/javaslang/forks","keys_url":"https://api.github.com/repos/javaslang/javaslang/keys{/key_id}","collaborators_url":"https://api.github.com/repos/javaslang/javaslang/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/javaslang/javaslang/teams","hooks_url":"https://api.github.com/repos/javaslang/javaslang/hooks","issue_events_url":"https://api.github.com/repos/javaslang/javaslang/issues/events{/number}","events_url":"https://api.github.com/repos/javaslang/javaslang/events","assignees_url":"https://api.github.com/repos/javaslang/javaslang/assignees{/user}","branches_url":"https://api.github.com/repos/javaslang/javaslang/branches{/branch}","tags_url":"https://api.github.com/repos/javaslang/javaslang/tags","blobs_url":"https://api.github.com/repos/javaslang/javaslang/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/javaslang/javaslang/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/javaslang/javaslang/git/refs{/sha}","trees_url":"https://api.github.com/repos/javaslang/javaslang/git/trees{/sha}","statuses_url":"https://api.github.com/repos/javaslang/javaslang/statuses/{sha}","languages_url":"https://api.github.com/repos/javaslang/javaslang/languages","stargazers_url":"https://api.github.com/repos/javaslang/javaslang/stargazers","contributors_url":"https://api.github.com/repos/javaslang/javaslang/contributors","subscribers_url":"https://api.github.com/repos/javaslang/javaslang/subscribers","subscription_url":"https://api.github.com/repos/javaslang/javaslang/subscription","commits_url":"https://api.github.com/repos/javaslang/javaslang/commits{/sha}","git_commits_url":"https://api.github.com/repos/javaslang/javaslang/git/commits{/sha}","comments_url":"https://api.github.com/repos/javaslang/javaslang/comments{/number}","issue_comment_url":"https://api.github.com/repos/javaslang/javaslang/issues/comments{/number}","contents_url":"https://api.github.com/repos/javaslang/javaslang/contents/{+path}","compare_url":"https://api.github.com/repos/javaslang/javaslang/compare/{base}...{head}","merges_url":"https://api.github.com/repos/javaslang/javaslang/merges","archive_url":"https://api.github.com/repos/javaslang/javaslang/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/javaslang/javaslang/downloads","issues_url":"https://api.github.com/repos/javaslang/javaslang/issues{/number}","pulls_url":"https://api.github.com/repos/javaslang/javaslang/pulls{/number}","milestones_url":"https://api.github.com/repos/javaslang/javaslang/milestones{/number}","notifications_url":"https://api.github.com/repos/javaslang/javaslang/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/javaslang/javaslang/labels{/name}","releases_url":"https://api.github.com/repos/javaslang/javaslang/releases{/id}","deployments_url":"https://api.github.com/repos/javaslang/javaslang/deployments","created_at":"2014-01-30T14:07:25Z","updated_at":"2016-07-08T20:32:30Z","pushed_at":"2016-07-09T11:03:08Z","git_url":"git://github.com/javaslang/javaslang.git","ssh_url":"git@github.com:javaslang/javaslang.git","clone_url":"https://github.com/javaslang/javaslang.git","svn_url":"https://github.com/javaslang/javaslang","homepage":"http://javaslang.io","size":13362,"stargazers_count":1023,"watchers_count":1023,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":116,"mirror_url":null,"open_issues_count":100,"forks":116,"open_issues":100,"watchers":1023,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/javaslang/javaslang/pulls/1421"},"html":{"href":"https://github.com/javaslang/javaslang/pull/1421"},"issue":{"href":"https://api.github.com/repos/javaslang/javaslang/issues/1421"},"comments":{"href":"https://api.github.com/repos/javaslang/javaslang/issues/1421/comments"},"review_comments":{"href":"https://api.github.com/repos/javaslang/javaslang/pulls/1421/comments"},"review_comment":{"href":"https://api.github.com/repos/javaslang/javaslang/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/javaslang/javaslang/pulls/1421/commits"},"statuses":{"href":"https://api.github.com/repos/javaslang/javaslang/statuses/039f460216415603639aed2819438af6ad1a5541"}}}}
{"actor":{"display_login":"paplorinc"}}