{"action":"created","comment":{"url":"https://api.github.com/repos/DynamoDS/Dynamo/pulls/comments/39543952","id":39543952,"diff_hunk":"@@ -509,32 +509,41 @@ public static IList RestOfItems(IList list)\n         }\n \n         /// <summary>\n-        ///     Chop a list into a set of lists each containing the given amount of items.\n+        ///     Chop a list into a set of consecutive sublists with the specified lengths. List division begins at the top of the list.\n         /// </summary>\n-        /// <param name=\"list\">List to chop up.</param>\n-        /// <param name=\"subLength\">Length of each new sub-list.</param>\n-        /// <returns name=\"lists\">List of lists.</returns>\n-        /// <search>sublists,build sublists,slices,partitions,cut,listcontains</search>\n-        public static IList Chop(IList list, int subLength)\n+        /// <param name=\"list\">List to chop into sublists</param>\n+        /// <param name=\"lengths\">Lengths of consecutive sublists to be created from the input list</param>\n+        /// <returns name=\"lists\">Sublists created from the list</returns>\n+        /// <search>chop</search>\n+        public static IList Chop(IList list, IList lengths)\n         {\n-            if (list.Count < subLength)\n-                return list;\n-\n             var finalList = new ArrayList();\n             var currList = new ArrayList();\n             int count = 0;\n+            int lengthIndex = 0;\n \n-            foreach (object v in list)\n+            // If there is no any lengths more than 0,\n+            // we return empty list.\n+            if (lengths.Cast<int>().All(x => x <= 0))\n             {\n-                count++;\n-                currList.Add(v);\n+                return finalList;\n+            }\n \n-                if (count == subLength)\n+            foreach (object obj in list)\n+            {\n+                if (count == ((int)lengths[lengthIndex]) || ((int)lengths[lengthIndex] <= 0))","path":"src/Libraries/CoreNodes/List.cs","position":39,"original_position":39,"commit_id":"97e4a3a64a9a29d94db82fe56983127bff37c608","original_commit_id":"97e4a3a64a9a29d94db82fe56983127bff37c608","user":{"login":"mjkkirschner","id":508936,"avatar_url":"https://avatars.githubusercontent.com/u/508936?v=3","gravatar_id":"","url":"https://api.github.com/users/mjkkirschner","html_url":"https://github.com/mjkkirschner","followers_url":"https://api.github.com/users/mjkkirschner/followers","following_url":"https://api.github.com/users/mjkkirschner/following{/other_user}","gists_url":"https://api.github.com/users/mjkkirschner/gists{/gist_id}","starred_url":"https://api.github.com/users/mjkkirschner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mjkkirschner/subscriptions","organizations_url":"https://api.github.com/users/mjkkirschner/orgs","repos_url":"https://api.github.com/users/mjkkirschner/repos","events_url":"https://api.github.com/users/mjkkirschner/events{/privacy}","received_events_url":"https://api.github.com/users/mjkkirschner/received_events","type":"User","site_admin":false},"body":"can you just add a quick comment for what case this is checking for :)","created_at":"2015-09-15T18:02:08Z","updated_at":"2015-09-15T18:02:08Z","html_url":"https://github.com/DynamoDS/Dynamo/pull/5272#discussion_r39543952","pull_request_url":"https://api.github.com/repos/DynamoDS/Dynamo/pulls/5272","_links":{"self":{"href":"https://api.github.com/repos/DynamoDS/Dynamo/pulls/comments/39543952"},"html":{"href":"https://github.com/DynamoDS/Dynamo/pull/5272#discussion_r39543952"},"pull_request":{"href":"https://api.github.com/repos/DynamoDS/Dynamo/pulls/5272"}}},"pull_request":{"url":"https://api.github.com/repos/DynamoDS/Dynamo/pulls/5272","id":44647884,"html_url":"https://github.com/DynamoDS/Dynamo/pull/5272","diff_url":"https://github.com/DynamoDS/Dynamo/pull/5272.diff","patch_url":"https://github.com/DynamoDS/Dynamo/pull/5272.patch","issue_url":"https://api.github.com/repos/DynamoDS/Dynamo/issues/5272","number":5272,"state":"open","locked":false,"title":"Data Management: List.ChopByLengths","user":{"login":"aosyatnik","id":8158404,"avatar_url":"https://avatars.githubusercontent.com/u/8158404?v=3","gravatar_id":"","url":"https://api.github.com/users/aosyatnik","html_url":"https://github.com/aosyatnik","followers_url":"https://api.github.com/users/aosyatnik/followers","following_url":"https://api.github.com/users/aosyatnik/following{/other_user}","gists_url":"https://api.github.com/users/aosyatnik/gists{/gist_id}","starred_url":"https://api.github.com/users/aosyatnik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aosyatnik/subscriptions","organizations_url":"https://api.github.com/users/aosyatnik/orgs","repos_url":"https://api.github.com/users/aosyatnik/repos","events_url":"https://api.github.com/users/aosyatnik/events{/privacy}","received_events_url":"https://api.github.com/users/aosyatnik/received_events","type":"User","site_admin":false},"body":"### Purpose\r\n\r\nLink to YouTrack:\r\n[MAGN-8185](http://adsk-oss.myjetbrains.com/youtrack/issue/MAGN-8185) Provide a method to chop a list into a given series of lengths\r\n\r\nResults:\r\n![image](https://cloud.githubusercontent.com/assets/8158404/9785324/449373fc-57ba-11e5-9589-f1f77ae9d1f3.png)\r\n\r\n![image](https://cloud.githubusercontent.com/assets/8158404/9785332/63014b52-57ba-11e5-9838-d62ea5dc066b.png)\r\n\r\n![image](https://cloud.githubusercontent.com/assets/8158404/9785338/6c6c1ffa-57ba-11e5-9a49-0a3c79af4ed6.png)\r\n\r\n![image](https://cloud.githubusercontent.com/assets/8158404/9785345/7bc3adc4-57ba-11e5-9ece-15600ee005e4.png)\r\n\r\n![image](https://cloud.githubusercontent.com/assets/8158404/9785356/8e33cdb8-57ba-11e5-8962-6ba358915655.png)\r\n\r\n### Declarations\r\n\r\nCheck these if you believe they are true\r\n\r\n- [ ] The code base is in a better state after this PR\r\n- [x] Is documented according to the [standards](https://github.com/DynamoDS/Dynamo/wiki/Coding-Standards)\r\n- [x] The level of testing this PR includes is appropriate\r\n- [x] User facing strings, if any, are extracted into `*.resx` files\r\n\r\n### Reviewers\r\n\r\n@mjkkirschner \r\n@ke-yu \r\n\r\n### FYIs\r\n\r\n@Racel \r\n@mccrone \r\n","created_at":"2015-09-10T09:54:39Z","updated_at":"2015-09-15T18:02:08Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f964974ff3606556c8cd6c20998313424fede9a3","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/DynamoDS/Dynamo/pulls/5272/commits","review_comments_url":"https://api.github.com/repos/DynamoDS/Dynamo/pulls/5272/comments","review_comment_url":"https://api.github.com/repos/DynamoDS/Dynamo/pulls/comments{/number}","comments_url":"https://api.github.com/repos/DynamoDS/Dynamo/issues/5272/comments","statuses_url":"https://api.github.com/repos/DynamoDS/Dynamo/statuses/97e4a3a64a9a29d94db82fe56983127bff37c608","head":{"label":"aosyatnik:DataManagement-List.ChopByLengths","ref":"DataManagement-List.ChopByLengths","sha":"97e4a3a64a9a29d94db82fe56983127bff37c608","user":{"login":"aosyatnik","id":8158404,"avatar_url":"https://avatars.githubusercontent.com/u/8158404?v=3","gravatar_id":"","url":"https://api.github.com/users/aosyatnik","html_url":"https://github.com/aosyatnik","followers_url":"https://api.github.com/users/aosyatnik/followers","following_url":"https://api.github.com/users/aosyatnik/following{/other_user}","gists_url":"https://api.github.com/users/aosyatnik/gists{/gist_id}","starred_url":"https://api.github.com/users/aosyatnik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aosyatnik/subscriptions","organizations_url":"https://api.github.com/users/aosyatnik/orgs","repos_url":"https://api.github.com/users/aosyatnik/repos","events_url":"https://api.github.com/users/aosyatnik/events{/privacy}","received_events_url":"https://api.github.com/users/aosyatnik/received_events","type":"User","site_admin":false},"repo":{"id":21854907,"name":"Dynamo","full_name":"aosyatnik/Dynamo","owner":{"login":"aosyatnik","id":8158404,"avatar_url":"https://avatars.githubusercontent.com/u/8158404?v=3","gravatar_id":"","url":"https://api.github.com/users/aosyatnik","html_url":"https://github.com/aosyatnik","followers_url":"https://api.github.com/users/aosyatnik/followers","following_url":"https://api.github.com/users/aosyatnik/following{/other_user}","gists_url":"https://api.github.com/users/aosyatnik/gists{/gist_id}","starred_url":"https://api.github.com/users/aosyatnik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aosyatnik/subscriptions","organizations_url":"https://api.github.com/users/aosyatnik/orgs","repos_url":"https://api.github.com/users/aosyatnik/repos","events_url":"https://api.github.com/users/aosyatnik/events{/privacy}","received_events_url":"https://api.github.com/users/aosyatnik/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/aosyatnik/Dynamo","description":"Visual Programming For Revit","fork":true,"url":"https://api.github.com/repos/aosyatnik/Dynamo","forks_url":"https://api.github.com/repos/aosyatnik/Dynamo/forks","keys_url":"https://api.github.com/repos/aosyatnik/Dynamo/keys{/key_id}","collaborators_url":"https://api.github.com/repos/aosyatnik/Dynamo/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/aosyatnik/Dynamo/teams","hooks_url":"https://api.github.com/repos/aosyatnik/Dynamo/hooks","issue_events_url":"https://api.github.com/repos/aosyatnik/Dynamo/issues/events{/number}","events_url":"https://api.github.com/repos/aosyatnik/Dynamo/events","assignees_url":"https://api.github.com/repos/aosyatnik/Dynamo/assignees{/user}","branches_url":"https://api.github.com/repos/aosyatnik/Dynamo/branches{/branch}","tags_url":"https://api.github.com/repos/aosyatnik/Dynamo/tags","blobs_url":"https://api.github.com/repos/aosyatnik/Dynamo/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/aosyatnik/Dynamo/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/aosyatnik/Dynamo/git/refs{/sha}","trees_url":"https://api.github.com/repos/aosyatnik/Dynamo/git/trees{/sha}","statuses_url":"https://api.github.com/repos/aosyatnik/Dynamo/statuses/{sha}","languages_url":"https://api.github.com/repos/aosyatnik/Dynamo/languages","stargazers_url":"https://api.github.com/repos/aosyatnik/Dynamo/stargazers","contributors_url":"https://api.github.com/repos/aosyatnik/Dynamo/contributors","subscribers_url":"https://api.github.com/repos/aosyatnik/Dynamo/subscribers","subscription_url":"https://api.github.com/repos/aosyatnik/Dynamo/subscription","commits_url":"https://api.github.com/repos/aosyatnik/Dynamo/commits{/sha}","git_commits_url":"https://api.github.com/repos/aosyatnik/Dynamo/git/commits{/sha}","comments_url":"https://api.github.com/repos/aosyatnik/Dynamo/comments{/number}","issue_comment_url":"https://api.github.com/repos/aosyatnik/Dynamo/issues/comments{/number}","contents_url":"https://api.github.com/repos/aosyatnik/Dynamo/contents/{+path}","compare_url":"https://api.github.com/repos/aosyatnik/Dynamo/compare/{base}...{head}","merges_url":"https://api.github.com/repos/aosyatnik/Dynamo/merges","archive_url":"https://api.github.com/repos/aosyatnik/Dynamo/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/aosyatnik/Dynamo/downloads","issues_url":"https://api.github.com/repos/aosyatnik/Dynamo/issues{/number}","pulls_url":"https://api.github.com/repos/aosyatnik/Dynamo/pulls{/number}","milestones_url":"https://api.github.com/repos/aosyatnik/Dynamo/milestones{/number}","notifications_url":"https://api.github.com/repos/aosyatnik/Dynamo/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/aosyatnik/Dynamo/labels{/name}","releases_url":"https://api.github.com/repos/aosyatnik/Dynamo/releases{/id}","created_at":"2014-07-15T10:00:34Z","updated_at":"2015-05-06T07:46:29Z","pushed_at":"2015-09-15T10:23:05Z","git_url":"git://github.com/aosyatnik/Dynamo.git","ssh_url":"git@github.com:aosyatnik/Dynamo.git","clone_url":"https://github.com/aosyatnik/Dynamo.git","svn_url":"https://github.com/aosyatnik/Dynamo","homepage":"http://dynamobim.org","size":775067,"stargazers_count":0,"watchers_count":0,"language":"C#","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"DynamoDS:master","ref":"master","sha":"d8d89b55c3cd3155bf6a96f4a7d9f5d93ba4876f","user":{"login":"DynamoDS","id":6528209,"avatar_url":"https://avatars.githubusercontent.com/u/6528209?v=3","gravatar_id":"","url":"https://api.github.com/users/DynamoDS","html_url":"https://github.com/DynamoDS","followers_url":"https://api.github.com/users/DynamoDS/followers","following_url":"https://api.github.com/users/DynamoDS/following{/other_user}","gists_url":"https://api.github.com/users/DynamoDS/gists{/gist_id}","starred_url":"https://api.github.com/users/DynamoDS/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DynamoDS/subscriptions","organizations_url":"https://api.github.com/users/DynamoDS/orgs","repos_url":"https://api.github.com/users/DynamoDS/repos","events_url":"https://api.github.com/users/DynamoDS/events{/privacy}","received_events_url":"https://api.github.com/users/DynamoDS/received_events","type":"Organization","site_admin":false},"repo":{"id":3395179,"name":"Dynamo","full_name":"DynamoDS/Dynamo","owner":{"login":"DynamoDS","id":6528209,"avatar_url":"https://avatars.githubusercontent.com/u/6528209?v=3","gravatar_id":"","url":"https://api.github.com/users/DynamoDS","html_url":"https://github.com/DynamoDS","followers_url":"https://api.github.com/users/DynamoDS/followers","following_url":"https://api.github.com/users/DynamoDS/following{/other_user}","gists_url":"https://api.github.com/users/DynamoDS/gists{/gist_id}","starred_url":"https://api.github.com/users/DynamoDS/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DynamoDS/subscriptions","organizations_url":"https://api.github.com/users/DynamoDS/orgs","repos_url":"https://api.github.com/users/DynamoDS/repos","events_url":"https://api.github.com/users/DynamoDS/events{/privacy}","received_events_url":"https://api.github.com/users/DynamoDS/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/DynamoDS/Dynamo","description":"Visual Programming","fork":false,"url":"https://api.github.com/repos/DynamoDS/Dynamo","forks_url":"https://api.github.com/repos/DynamoDS/Dynamo/forks","keys_url":"https://api.github.com/repos/DynamoDS/Dynamo/keys{/key_id}","collaborators_url":"https://api.github.com/repos/DynamoDS/Dynamo/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/DynamoDS/Dynamo/teams","hooks_url":"https://api.github.com/repos/DynamoDS/Dynamo/hooks","issue_events_url":"https://api.github.com/repos/DynamoDS/Dynamo/issues/events{/number}","events_url":"https://api.github.com/repos/DynamoDS/Dynamo/events","assignees_url":"https://api.github.com/repos/DynamoDS/Dynamo/assignees{/user}","branches_url":"https://api.github.com/repos/DynamoDS/Dynamo/branches{/branch}","tags_url":"https://api.github.com/repos/DynamoDS/Dynamo/tags","blobs_url":"https://api.github.com/repos/DynamoDS/Dynamo/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/DynamoDS/Dynamo/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/DynamoDS/Dynamo/git/refs{/sha}","trees_url":"https://api.github.com/repos/DynamoDS/Dynamo/git/trees{/sha}","statuses_url":"https://api.github.com/repos/DynamoDS/Dynamo/statuses/{sha}","languages_url":"https://api.github.com/repos/DynamoDS/Dynamo/languages","stargazers_url":"https://api.github.com/repos/DynamoDS/Dynamo/stargazers","contributors_url":"https://api.github.com/repos/DynamoDS/Dynamo/contributors","subscribers_url":"https://api.github.com/repos/DynamoDS/Dynamo/subscribers","subscription_url":"https://api.github.com/repos/DynamoDS/Dynamo/subscription","commits_url":"https://api.github.com/repos/DynamoDS/Dynamo/commits{/sha}","git_commits_url":"https://api.github.com/repos/DynamoDS/Dynamo/git/commits{/sha}","comments_url":"https://api.github.com/repos/DynamoDS/Dynamo/comments{/number}","issue_comment_url":"https://api.github.com/repos/DynamoDS/Dynamo/issues/comments{/number}","contents_url":"https://api.github.com/repos/DynamoDS/Dynamo/contents/{+path}","compare_url":"https://api.github.com/repos/DynamoDS/Dynamo/compare/{base}...{head}","merges_url":"https://api.github.com/repos/DynamoDS/Dynamo/merges","archive_url":"https://api.github.com/repos/DynamoDS/Dynamo/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/DynamoDS/Dynamo/downloads","issues_url":"https://api.github.com/repos/DynamoDS/Dynamo/issues{/number}","pulls_url":"https://api.github.com/repos/DynamoDS/Dynamo/pulls{/number}","milestones_url":"https://api.github.com/repos/DynamoDS/Dynamo/milestones{/number}","notifications_url":"https://api.github.com/repos/DynamoDS/Dynamo/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/DynamoDS/Dynamo/labels{/name}","releases_url":"https://api.github.com/repos/DynamoDS/Dynamo/releases{/id}","created_at":"2012-02-09T07:35:33Z","updated_at":"2015-09-14T16:55:40Z","pushed_at":"2015-09-15T17:14:06Z","git_url":"git://github.com/DynamoDS/Dynamo.git","ssh_url":"git@github.com:DynamoDS/Dynamo.git","clone_url":"https://github.com/DynamoDS/Dynamo.git","svn_url":"https://github.com/DynamoDS/Dynamo","homepage":"http://dynamobim.org","size":1034358,"stargazers_count":259,"watchers_count":259,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":199,"mirror_url":null,"open_issues_count":740,"forks":199,"open_issues":740,"watchers":259,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/DynamoDS/Dynamo/pulls/5272"},"html":{"href":"https://github.com/DynamoDS/Dynamo/pull/5272"},"issue":{"href":"https://api.github.com/repos/DynamoDS/Dynamo/issues/5272"},"comments":{"href":"https://api.github.com/repos/DynamoDS/Dynamo/issues/5272/comments"},"review_comments":{"href":"https://api.github.com/repos/DynamoDS/Dynamo/pulls/5272/comments"},"review_comment":{"href":"https://api.github.com/repos/DynamoDS/Dynamo/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/DynamoDS/Dynamo/pulls/5272/commits"},"statuses":{"href":"https://api.github.com/repos/DynamoDS/Dynamo/statuses/97e4a3a64a9a29d94db82fe56983127bff37c608"}}}}