{"action":"created","comment":{"url":"https://api.github.com/repos/ramda/ramda/pulls/comments/45298946","id":45298946,"diff_hunk":"@@ -0,0 +1,24 @@\n+var _curry2 = require('./internal/_curry2');\n+var complement = require('./complement');\n+var difference = require('./difference');\n+var takeWhile = require('./takeWhile');\n+\n+\n+/**\n+ * Splits a given list at the first occurance of a satisfied predicate.\n+ *\n+ * @func\n+ * @memberOf R\n+ * @category List\n+ * @sig Number -> [a] -> [[a], [a]]\n+ * @param {Function} fn The predicate that determines where the array is split.\n+ * @param {Array} array The array to be split.\n+ * @return {Array}\n+ * @example\n+ *\n+ *      R.splitBy(R.equals(2), [1, 2, 3]);   //=> [[1], [2, 3]]\n+ */\n+module.exports = _curry2(function splitBy(predicate, array) {\n+  var xs = takeWhile(complement(predicate), array);\n+  return [xs, difference(array, xs)];","path":"src/splitBy.js","position":23,"original_position":23,"commit_id":"aae317b6073c345e6ef48c52b0258d5ce0eb905d","original_commit_id":"aae317b6073c345e6ef48c52b0258d5ce0eb905d","user":{"login":"davidchambers","id":210406,"avatar_url":"https://avatars.githubusercontent.com/u/210406?v=3","gravatar_id":"","url":"https://api.github.com/users/davidchambers","html_url":"https://github.com/davidchambers","followers_url":"https://api.github.com/users/davidchambers/followers","following_url":"https://api.github.com/users/davidchambers/following{/other_user}","gists_url":"https://api.github.com/users/davidchambers/gists{/gist_id}","starred_url":"https://api.github.com/users/davidchambers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davidchambers/subscriptions","organizations_url":"https://api.github.com/users/davidchambers/orgs","repos_url":"https://api.github.com/users/davidchambers/repos","events_url":"https://api.github.com/users/davidchambers/events{/privacy}","received_events_url":"https://api.github.com/users/davidchambers/received_events","type":"User","site_admin":false},"body":"We can't use `difference` here, as it discards duplicates. Try something like `R.splitBy(R.T, [1, 1, 1])`.\r\n\r\nIt would be great to use [JSVerify][1] to test these properties:\r\n\r\n  - `forall p :: a -> Boolean, xs :: [a]. length(splitBy(p, xs)) = 2`\r\n  - `forall p :: a -> Boolean, xs :: [a]. unnest(splitBy(p, xs)) = xs`\r\n\r\n\r\n[1]: https://github.com/jsverify/jsverify\r\n","created_at":"2015-11-19T04:45:27Z","updated_at":"2015-11-19T04:45:27Z","html_url":"https://github.com/ramda/ramda/pull/1525#discussion_r45298946","pull_request_url":"https://api.github.com/repos/ramda/ramda/pulls/1525","_links":{"self":{"href":"https://api.github.com/repos/ramda/ramda/pulls/comments/45298946"},"html":{"href":"https://github.com/ramda/ramda/pull/1525#discussion_r45298946"},"pull_request":{"href":"https://api.github.com/repos/ramda/ramda/pulls/1525"}}},"pull_request":{"url":"https://api.github.com/repos/ramda/ramda/pulls/1525","id":51176652,"html_url":"https://github.com/ramda/ramda/pull/1525","diff_url":"https://github.com/ramda/ramda/pull/1525.diff","patch_url":"https://github.com/ramda/ramda/pull/1525.patch","issue_url":"https://api.github.com/repos/ramda/ramda/issues/1525","number":1525,"state":"open","locked":false,"title":"Add splitBy function","user":{"login":"miwillhite","id":81757,"avatar_url":"https://avatars.githubusercontent.com/u/81757?v=3","gravatar_id":"","url":"https://api.github.com/users/miwillhite","html_url":"https://github.com/miwillhite","followers_url":"https://api.github.com/users/miwillhite/followers","following_url":"https://api.github.com/users/miwillhite/following{/other_user}","gists_url":"https://api.github.com/users/miwillhite/gists{/gist_id}","starred_url":"https://api.github.com/users/miwillhite/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/miwillhite/subscriptions","organizations_url":"https://api.github.com/users/miwillhite/orgs","repos_url":"https://api.github.com/users/miwillhite/repos","events_url":"https://api.github.com/users/miwillhite/events{/privacy}","received_events_url":"https://api.github.com/users/miwillhite/received_events","type":"User","site_admin":false},"body":"Inspired by Haskell's `break`:\r\nhttp://hackage.haskell.org/package/base-4.8.1.0/docs/Prelude.html#v:break\r\n\r\n`R.splitBy(R.equals(2), [1, 2, 3]);   //=> [[1], [2, 3]]`","created_at":"2015-11-19T03:41:50Z","updated_at":"2015-11-19T04:45:27Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c4281a90ed32249dda8c23f02dcd81a94fca3b15","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/ramda/ramda/pulls/1525/commits","review_comments_url":"https://api.github.com/repos/ramda/ramda/pulls/1525/comments","review_comment_url":"https://api.github.com/repos/ramda/ramda/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ramda/ramda/issues/1525/comments","statuses_url":"https://api.github.com/repos/ramda/ramda/statuses/aae317b6073c345e6ef48c52b0258d5ce0eb905d","head":{"label":"miwillhite:feature/splitBy","ref":"feature/splitBy","sha":"aae317b6073c345e6ef48c52b0258d5ce0eb905d","user":{"login":"miwillhite","id":81757,"avatar_url":"https://avatars.githubusercontent.com/u/81757?v=3","gravatar_id":"","url":"https://api.github.com/users/miwillhite","html_url":"https://github.com/miwillhite","followers_url":"https://api.github.com/users/miwillhite/followers","following_url":"https://api.github.com/users/miwillhite/following{/other_user}","gists_url":"https://api.github.com/users/miwillhite/gists{/gist_id}","starred_url":"https://api.github.com/users/miwillhite/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/miwillhite/subscriptions","organizations_url":"https://api.github.com/users/miwillhite/orgs","repos_url":"https://api.github.com/users/miwillhite/repos","events_url":"https://api.github.com/users/miwillhite/events{/privacy}","received_events_url":"https://api.github.com/users/miwillhite/received_events","type":"User","site_admin":false},"repo":{"id":46464412,"name":"ramda","full_name":"miwillhite/ramda","owner":{"login":"miwillhite","id":81757,"avatar_url":"https://avatars.githubusercontent.com/u/81757?v=3","gravatar_id":"","url":"https://api.github.com/users/miwillhite","html_url":"https://github.com/miwillhite","followers_url":"https://api.github.com/users/miwillhite/followers","following_url":"https://api.github.com/users/miwillhite/following{/other_user}","gists_url":"https://api.github.com/users/miwillhite/gists{/gist_id}","starred_url":"https://api.github.com/users/miwillhite/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/miwillhite/subscriptions","organizations_url":"https://api.github.com/users/miwillhite/orgs","repos_url":"https://api.github.com/users/miwillhite/repos","events_url":"https://api.github.com/users/miwillhite/events{/privacy}","received_events_url":"https://api.github.com/users/miwillhite/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/miwillhite/ramda","description":":ram: Practical functional Javascript","fork":true,"url":"https://api.github.com/repos/miwillhite/ramda","forks_url":"https://api.github.com/repos/miwillhite/ramda/forks","keys_url":"https://api.github.com/repos/miwillhite/ramda/keys{/key_id}","collaborators_url":"https://api.github.com/repos/miwillhite/ramda/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/miwillhite/ramda/teams","hooks_url":"https://api.github.com/repos/miwillhite/ramda/hooks","issue_events_url":"https://api.github.com/repos/miwillhite/ramda/issues/events{/number}","events_url":"https://api.github.com/repos/miwillhite/ramda/events","assignees_url":"https://api.github.com/repos/miwillhite/ramda/assignees{/user}","branches_url":"https://api.github.com/repos/miwillhite/ramda/branches{/branch}","tags_url":"https://api.github.com/repos/miwillhite/ramda/tags","blobs_url":"https://api.github.com/repos/miwillhite/ramda/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/miwillhite/ramda/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/miwillhite/ramda/git/refs{/sha}","trees_url":"https://api.github.com/repos/miwillhite/ramda/git/trees{/sha}","statuses_url":"https://api.github.com/repos/miwillhite/ramda/statuses/{sha}","languages_url":"https://api.github.com/repos/miwillhite/ramda/languages","stargazers_url":"https://api.github.com/repos/miwillhite/ramda/stargazers","contributors_url":"https://api.github.com/repos/miwillhite/ramda/contributors","subscribers_url":"https://api.github.com/repos/miwillhite/ramda/subscribers","subscription_url":"https://api.github.com/repos/miwillhite/ramda/subscription","commits_url":"https://api.github.com/repos/miwillhite/ramda/commits{/sha}","git_commits_url":"https://api.github.com/repos/miwillhite/ramda/git/commits{/sha}","comments_url":"https://api.github.com/repos/miwillhite/ramda/comments{/number}","issue_comment_url":"https://api.github.com/repos/miwillhite/ramda/issues/comments{/number}","contents_url":"https://api.github.com/repos/miwillhite/ramda/contents/{+path}","compare_url":"https://api.github.com/repos/miwillhite/ramda/compare/{base}...{head}","merges_url":"https://api.github.com/repos/miwillhite/ramda/merges","archive_url":"https://api.github.com/repos/miwillhite/ramda/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/miwillhite/ramda/downloads","issues_url":"https://api.github.com/repos/miwillhite/ramda/issues{/number}","pulls_url":"https://api.github.com/repos/miwillhite/ramda/pulls{/number}","milestones_url":"https://api.github.com/repos/miwillhite/ramda/milestones{/number}","notifications_url":"https://api.github.com/repos/miwillhite/ramda/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/miwillhite/ramda/labels{/name}","releases_url":"https://api.github.com/repos/miwillhite/ramda/releases{/id}","created_at":"2015-11-19T03:18:02Z","updated_at":"2015-11-19T03:18:04Z","pushed_at":"2015-11-19T03:41:06Z","git_url":"git://github.com/miwillhite/ramda.git","ssh_url":"git@github.com:miwillhite/ramda.git","clone_url":"https://github.com/miwillhite/ramda.git","svn_url":"https://github.com/miwillhite/ramda","homepage":"http://ramdajs.com","size":5179,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","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":"ramda:master","ref":"master","sha":"864bb2d04aa77ca1166a171a65115e57aed05f46","user":{"login":"ramda","id":5298359,"avatar_url":"https://avatars.githubusercontent.com/u/5298359?v=3","gravatar_id":"","url":"https://api.github.com/users/ramda","html_url":"https://github.com/ramda","followers_url":"https://api.github.com/users/ramda/followers","following_url":"https://api.github.com/users/ramda/following{/other_user}","gists_url":"https://api.github.com/users/ramda/gists{/gist_id}","starred_url":"https://api.github.com/users/ramda/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ramda/subscriptions","organizations_url":"https://api.github.com/users/ramda/orgs","repos_url":"https://api.github.com/users/ramda/repos","events_url":"https://api.github.com/users/ramda/events{/privacy}","received_events_url":"https://api.github.com/users/ramda/received_events","type":"Organization","site_admin":false},"repo":{"id":10851820,"name":"ramda","full_name":"ramda/ramda","owner":{"login":"ramda","id":5298359,"avatar_url":"https://avatars.githubusercontent.com/u/5298359?v=3","gravatar_id":"","url":"https://api.github.com/users/ramda","html_url":"https://github.com/ramda","followers_url":"https://api.github.com/users/ramda/followers","following_url":"https://api.github.com/users/ramda/following{/other_user}","gists_url":"https://api.github.com/users/ramda/gists{/gist_id}","starred_url":"https://api.github.com/users/ramda/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ramda/subscriptions","organizations_url":"https://api.github.com/users/ramda/orgs","repos_url":"https://api.github.com/users/ramda/repos","events_url":"https://api.github.com/users/ramda/events{/privacy}","received_events_url":"https://api.github.com/users/ramda/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ramda/ramda","description":":ram: Practical functional Javascript","fork":false,"url":"https://api.github.com/repos/ramda/ramda","forks_url":"https://api.github.com/repos/ramda/ramda/forks","keys_url":"https://api.github.com/repos/ramda/ramda/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ramda/ramda/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ramda/ramda/teams","hooks_url":"https://api.github.com/repos/ramda/ramda/hooks","issue_events_url":"https://api.github.com/repos/ramda/ramda/issues/events{/number}","events_url":"https://api.github.com/repos/ramda/ramda/events","assignees_url":"https://api.github.com/repos/ramda/ramda/assignees{/user}","branches_url":"https://api.github.com/repos/ramda/ramda/branches{/branch}","tags_url":"https://api.github.com/repos/ramda/ramda/tags","blobs_url":"https://api.github.com/repos/ramda/ramda/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ramda/ramda/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ramda/ramda/git/refs{/sha}","trees_url":"https://api.github.com/repos/ramda/ramda/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ramda/ramda/statuses/{sha}","languages_url":"https://api.github.com/repos/ramda/ramda/languages","stargazers_url":"https://api.github.com/repos/ramda/ramda/stargazers","contributors_url":"https://api.github.com/repos/ramda/ramda/contributors","subscribers_url":"https://api.github.com/repos/ramda/ramda/subscribers","subscription_url":"https://api.github.com/repos/ramda/ramda/subscription","commits_url":"https://api.github.com/repos/ramda/ramda/commits{/sha}","git_commits_url":"https://api.github.com/repos/ramda/ramda/git/commits{/sha}","comments_url":"https://api.github.com/repos/ramda/ramda/comments{/number}","issue_comment_url":"https://api.github.com/repos/ramda/ramda/issues/comments{/number}","contents_url":"https://api.github.com/repos/ramda/ramda/contents/{+path}","compare_url":"https://api.github.com/repos/ramda/ramda/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ramda/ramda/merges","archive_url":"https://api.github.com/repos/ramda/ramda/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ramda/ramda/downloads","issues_url":"https://api.github.com/repos/ramda/ramda/issues{/number}","pulls_url":"https://api.github.com/repos/ramda/ramda/pulls{/number}","milestones_url":"https://api.github.com/repos/ramda/ramda/milestones{/number}","notifications_url":"https://api.github.com/repos/ramda/ramda/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ramda/ramda/labels{/name}","releases_url":"https://api.github.com/repos/ramda/ramda/releases{/id}","created_at":"2013-06-21T20:32:35Z","updated_at":"2015-11-19T03:43:01Z","pushed_at":"2015-11-19T03:41:50Z","git_url":"git://github.com/ramda/ramda.git","ssh_url":"git@github.com:ramda/ramda.git","clone_url":"https://github.com/ramda/ramda.git","svn_url":"https://github.com/ramda/ramda","homepage":"http://ramdajs.com","size":6345,"stargazers_count":3165,"watchers_count":3165,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":235,"mirror_url":null,"open_issues_count":85,"forks":235,"open_issues":85,"watchers":3165,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ramda/ramda/pulls/1525"},"html":{"href":"https://github.com/ramda/ramda/pull/1525"},"issue":{"href":"https://api.github.com/repos/ramda/ramda/issues/1525"},"comments":{"href":"https://api.github.com/repos/ramda/ramda/issues/1525/comments"},"review_comments":{"href":"https://api.github.com/repos/ramda/ramda/pulls/1525/comments"},"review_comment":{"href":"https://api.github.com/repos/ramda/ramda/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ramda/ramda/pulls/1525/commits"},"statuses":{"href":"https://api.github.com/repos/ramda/ramda/statuses/aae317b6073c345e6ef48c52b0258d5ce0eb905d"}}}}