{"action":"created","comment":{"url":"https://api.github.com/repos/rainwoodman/vast/pulls/comments/87306970","pull_request_review_id":7924939,"id":87306970,"diff_hunk":"@@ -123,24 +163,99 @@ public class Array<T>: Object\n         return shape;\n     }\n \n-    public Array<T>\n-    slice (ssize_t[] from, ssize_t[] to)\n+    public Array\n+    slice ([CCode (array_length = false)] ssize_t[] from, [CCode (array_length = false)] ssize_t[] to)\n+    {\n+        return new Array (scalar_type,\n+                          scalar_size,\n+                          _shape_for_slice (from, to),\n+                          _strides,\n+                          data.slice ((int) _offset_for_index (from), (int) _offset_for_index (to)));\n+    }\n+\n+    private inline void\n+    _append_from_index (StringBuilder sb, ssize_t[] index)\n     {\n-        return new Array<T> (scalar_size,\n-                                      _shape_from_slice (from, to),\n-                                      _strides,\n-                                      data.slice ((int) _offset_for_index (from), (int) _offset_for_index (to)));\n+        sb.append_c ('\\n');\n+\n+        // vector style\n+        if (index.length == ndim - 1) {\n+            sb.append_c ('[');\n+            for (var i = 0; i < shape[index.length]; i++) {\n+                if (i > 0)\n+                    sb.append_c (' ');\n+                // index and print the scalar\n+                ssize_t[] subindex = index;\n+                subindex += i;\n+                sb.append (get_value (subindex).strdup_contents ());\n+                if (i < shape[index.length] - 1)\n+                    sb.append_c ('\\n');\n+            }\n+            sb.append_c (']');\n+        }\n+\n+        // matrix style\n+        else if (index.length == ndim - 2) {\n+            sb.append_c ('[');\n+            // last dim is printed vertically","path":"src/array.vala","position":172,"original_position":172,"commit_id":"7147620b52b7493f0f92ced8fc541d60a9626aab","original_commit_id":"7147620b52b7493f0f92ced8fc541d60a9626aab","user":{"login":"rainwoodman","id":138060,"avatar_url":"https://avatars.githubusercontent.com/u/138060?v=3","gravatar_id":"","url":"https://api.github.com/users/rainwoodman","html_url":"https://github.com/rainwoodman","followers_url":"https://api.github.com/users/rainwoodman/followers","following_url":"https://api.github.com/users/rainwoodman/following{/other_user}","gists_url":"https://api.github.com/users/rainwoodman/gists{/gist_id}","starred_url":"https://api.github.com/users/rainwoodman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rainwoodman/subscriptions","organizations_url":"https://api.github.com/users/rainwoodman/orgs","repos_url":"https://api.github.com/users/rainwoodman/repos","events_url":"https://api.github.com/users/rainwoodman/events{/privacy}","received_events_url":"https://api.github.com/users/rainwoodman/received_events","type":"User","site_admin":false},"body":"I am not so sure about having a transpose here is a good idea. It will create a lot of confusions if any dimensions are handled differently... There were some lessons from numpy.matrix -- in general nowadays people are encouraged not to it.\r\n\r\nCan we make sure the last dimension, when printed is continuous? This makes sure the printed version agrees with the memory when the array is 'tight'. Also the code is shorter. \r\n\r\nWe just have to make sure the contraction operator ('tensor dot') is always explicit about which two axis-s are being contracted.\r\n\r\n","created_at":"2016-11-10T00:19:41Z","updated_at":"2016-11-10T00:19:41Z","html_url":"https://github.com/rainwoodman/vast/pull/9#discussion_r87306970","pull_request_url":"https://api.github.com/repos/rainwoodman/vast/pulls/9","_links":{"self":{"href":"https://api.github.com/repos/rainwoodman/vast/pulls/comments/87306970"},"html":{"href":"https://github.com/rainwoodman/vast/pull/9#discussion_r87306970"},"pull_request":{"href":"https://api.github.com/repos/rainwoodman/vast/pulls/9"}}},"pull_request":{"url":"https://api.github.com/repos/rainwoodman/vast/pulls/9","id":93043557,"html_url":"https://github.com/rainwoodman/vast/pull/9","diff_url":"https://github.com/rainwoodman/vast/pull/9.diff","patch_url":"https://github.com/rainwoodman/vast/pull/9.patch","issue_url":"https://api.github.com/repos/rainwoodman/vast/issues/9","number":9,"state":"open","locked":false,"title":"Replace generics with pointers","user":{"login":"arteymix","id":1318477,"avatar_url":"https://avatars.githubusercontent.com/u/1318477?v=3","gravatar_id":"","url":"https://api.github.com/users/arteymix","html_url":"https://github.com/arteymix","followers_url":"https://api.github.com/users/arteymix/followers","following_url":"https://api.github.com/users/arteymix/following{/other_user}","gists_url":"https://api.github.com/users/arteymix/gists{/gist_id}","starred_url":"https://api.github.com/users/arteymix/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arteymix/subscriptions","organizations_url":"https://api.github.com/users/arteymix/orgs","repos_url":"https://api.github.com/users/arteymix/repos","events_url":"https://api.github.com/users/arteymix/events{/privacy}","received_events_url":"https://api.github.com/users/arteymix/received_events","type":"User","site_admin":false},"body":"There's some work to do to fully implement pointer to `GValue` and its reciprocate. This endpoint is just a convenience because it's generally more efficient to work directly with pointers.\r\n\r\nI also provide a pretty-print implementation based on `GLib.Value.strdup_contents`. It's nice as it considers matrix and vertices and print them vertically.","created_at":"2016-11-09T21:38:17Z","updated_at":"2016-11-10T00:19:41Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/rainwoodman/vast/pulls/9/commits","review_comments_url":"https://api.github.com/repos/rainwoodman/vast/pulls/9/comments","review_comment_url":"https://api.github.com/repos/rainwoodman/vast/pulls/comments{/number}","comments_url":"https://api.github.com/repos/rainwoodman/vast/issues/9/comments","statuses_url":"https://api.github.com/repos/rainwoodman/vast/statuses/7147620b52b7493f0f92ced8fc541d60a9626aab","head":{"label":"rainwoodman:wip/arteymix/replace-generics-with-pointers","ref":"wip/arteymix/replace-generics-with-pointers","sha":"7147620b52b7493f0f92ced8fc541d60a9626aab","user":{"login":"rainwoodman","id":138060,"avatar_url":"https://avatars.githubusercontent.com/u/138060?v=3","gravatar_id":"","url":"https://api.github.com/users/rainwoodman","html_url":"https://github.com/rainwoodman","followers_url":"https://api.github.com/users/rainwoodman/followers","following_url":"https://api.github.com/users/rainwoodman/following{/other_user}","gists_url":"https://api.github.com/users/rainwoodman/gists{/gist_id}","starred_url":"https://api.github.com/users/rainwoodman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rainwoodman/subscriptions","organizations_url":"https://api.github.com/users/rainwoodman/orgs","repos_url":"https://api.github.com/users/rainwoodman/repos","events_url":"https://api.github.com/users/rainwoodman/events{/privacy}","received_events_url":"https://api.github.com/users/rainwoodman/received_events","type":"User","site_admin":false},"repo":{"id":71622183,"name":"vast","full_name":"rainwoodman/vast","owner":{"login":"rainwoodman","id":138060,"avatar_url":"https://avatars.githubusercontent.com/u/138060?v=3","gravatar_id":"","url":"https://api.github.com/users/rainwoodman","html_url":"https://github.com/rainwoodman","followers_url":"https://api.github.com/users/rainwoodman/followers","following_url":"https://api.github.com/users/rainwoodman/following{/other_user}","gists_url":"https://api.github.com/users/rainwoodman/gists{/gist_id}","starred_url":"https://api.github.com/users/rainwoodman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rainwoodman/subscriptions","organizations_url":"https://api.github.com/users/rainwoodman/orgs","repos_url":"https://api.github.com/users/rainwoodman/repos","events_url":"https://api.github.com/users/rainwoodman/events{/privacy}","received_events_url":"https://api.github.com/users/rainwoodman/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/rainwoodman/vast","description":"vala and deep learning","fork":false,"url":"https://api.github.com/repos/rainwoodman/vast","forks_url":"https://api.github.com/repos/rainwoodman/vast/forks","keys_url":"https://api.github.com/repos/rainwoodman/vast/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rainwoodman/vast/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rainwoodman/vast/teams","hooks_url":"https://api.github.com/repos/rainwoodman/vast/hooks","issue_events_url":"https://api.github.com/repos/rainwoodman/vast/issues/events{/number}","events_url":"https://api.github.com/repos/rainwoodman/vast/events","assignees_url":"https://api.github.com/repos/rainwoodman/vast/assignees{/user}","branches_url":"https://api.github.com/repos/rainwoodman/vast/branches{/branch}","tags_url":"https://api.github.com/repos/rainwoodman/vast/tags","blobs_url":"https://api.github.com/repos/rainwoodman/vast/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rainwoodman/vast/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rainwoodman/vast/git/refs{/sha}","trees_url":"https://api.github.com/repos/rainwoodman/vast/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rainwoodman/vast/statuses/{sha}","languages_url":"https://api.github.com/repos/rainwoodman/vast/languages","stargazers_url":"https://api.github.com/repos/rainwoodman/vast/stargazers","contributors_url":"https://api.github.com/repos/rainwoodman/vast/contributors","subscribers_url":"https://api.github.com/repos/rainwoodman/vast/subscribers","subscription_url":"https://api.github.com/repos/rainwoodman/vast/subscription","commits_url":"https://api.github.com/repos/rainwoodman/vast/commits{/sha}","git_commits_url":"https://api.github.com/repos/rainwoodman/vast/git/commits{/sha}","comments_url":"https://api.github.com/repos/rainwoodman/vast/comments{/number}","issue_comment_url":"https://api.github.com/repos/rainwoodman/vast/issues/comments{/number}","contents_url":"https://api.github.com/repos/rainwoodman/vast/contents/{+path}","compare_url":"https://api.github.com/repos/rainwoodman/vast/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rainwoodman/vast/merges","archive_url":"https://api.github.com/repos/rainwoodman/vast/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rainwoodman/vast/downloads","issues_url":"https://api.github.com/repos/rainwoodman/vast/issues{/number}","pulls_url":"https://api.github.com/repos/rainwoodman/vast/pulls{/number}","milestones_url":"https://api.github.com/repos/rainwoodman/vast/milestones{/number}","notifications_url":"https://api.github.com/repos/rainwoodman/vast/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rainwoodman/vast/labels{/name}","releases_url":"https://api.github.com/repos/rainwoodman/vast/releases{/id}","deployments_url":"https://api.github.com/repos/rainwoodman/vast/deployments","created_at":"2016-10-22T06:50:32Z","updated_at":"2016-11-03T13:36:05Z","pushed_at":"2016-11-09T21:40:27Z","git_url":"git://github.com/rainwoodman/vast.git","ssh_url":"git@github.com:rainwoodman/vast.git","clone_url":"https://github.com/rainwoodman/vast.git","svn_url":"https://github.com/rainwoodman/vast","homepage":null,"size":43,"stargazers_count":4,"watchers_count":4,"language":"Vala","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":9,"forks":0,"open_issues":9,"watchers":4,"default_branch":"master"}},"base":{"label":"rainwoodman:master","ref":"master","sha":"e73a6bd8eb01ec1366812cd38cc7e0ebdf11e0b0","user":{"login":"rainwoodman","id":138060,"avatar_url":"https://avatars.githubusercontent.com/u/138060?v=3","gravatar_id":"","url":"https://api.github.com/users/rainwoodman","html_url":"https://github.com/rainwoodman","followers_url":"https://api.github.com/users/rainwoodman/followers","following_url":"https://api.github.com/users/rainwoodman/following{/other_user}","gists_url":"https://api.github.com/users/rainwoodman/gists{/gist_id}","starred_url":"https://api.github.com/users/rainwoodman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rainwoodman/subscriptions","organizations_url":"https://api.github.com/users/rainwoodman/orgs","repos_url":"https://api.github.com/users/rainwoodman/repos","events_url":"https://api.github.com/users/rainwoodman/events{/privacy}","received_events_url":"https://api.github.com/users/rainwoodman/received_events","type":"User","site_admin":false},"repo":{"id":71622183,"name":"vast","full_name":"rainwoodman/vast","owner":{"login":"rainwoodman","id":138060,"avatar_url":"https://avatars.githubusercontent.com/u/138060?v=3","gravatar_id":"","url":"https://api.github.com/users/rainwoodman","html_url":"https://github.com/rainwoodman","followers_url":"https://api.github.com/users/rainwoodman/followers","following_url":"https://api.github.com/users/rainwoodman/following{/other_user}","gists_url":"https://api.github.com/users/rainwoodman/gists{/gist_id}","starred_url":"https://api.github.com/users/rainwoodman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rainwoodman/subscriptions","organizations_url":"https://api.github.com/users/rainwoodman/orgs","repos_url":"https://api.github.com/users/rainwoodman/repos","events_url":"https://api.github.com/users/rainwoodman/events{/privacy}","received_events_url":"https://api.github.com/users/rainwoodman/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/rainwoodman/vast","description":"vala and deep learning","fork":false,"url":"https://api.github.com/repos/rainwoodman/vast","forks_url":"https://api.github.com/repos/rainwoodman/vast/forks","keys_url":"https://api.github.com/repos/rainwoodman/vast/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rainwoodman/vast/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rainwoodman/vast/teams","hooks_url":"https://api.github.com/repos/rainwoodman/vast/hooks","issue_events_url":"https://api.github.com/repos/rainwoodman/vast/issues/events{/number}","events_url":"https://api.github.com/repos/rainwoodman/vast/events","assignees_url":"https://api.github.com/repos/rainwoodman/vast/assignees{/user}","branches_url":"https://api.github.com/repos/rainwoodman/vast/branches{/branch}","tags_url":"https://api.github.com/repos/rainwoodman/vast/tags","blobs_url":"https://api.github.com/repos/rainwoodman/vast/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rainwoodman/vast/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rainwoodman/vast/git/refs{/sha}","trees_url":"https://api.github.com/repos/rainwoodman/vast/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rainwoodman/vast/statuses/{sha}","languages_url":"https://api.github.com/repos/rainwoodman/vast/languages","stargazers_url":"https://api.github.com/repos/rainwoodman/vast/stargazers","contributors_url":"https://api.github.com/repos/rainwoodman/vast/contributors","subscribers_url":"https://api.github.com/repos/rainwoodman/vast/subscribers","subscription_url":"https://api.github.com/repos/rainwoodman/vast/subscription","commits_url":"https://api.github.com/repos/rainwoodman/vast/commits{/sha}","git_commits_url":"https://api.github.com/repos/rainwoodman/vast/git/commits{/sha}","comments_url":"https://api.github.com/repos/rainwoodman/vast/comments{/number}","issue_comment_url":"https://api.github.com/repos/rainwoodman/vast/issues/comments{/number}","contents_url":"https://api.github.com/repos/rainwoodman/vast/contents/{+path}","compare_url":"https://api.github.com/repos/rainwoodman/vast/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rainwoodman/vast/merges","archive_url":"https://api.github.com/repos/rainwoodman/vast/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rainwoodman/vast/downloads","issues_url":"https://api.github.com/repos/rainwoodman/vast/issues{/number}","pulls_url":"https://api.github.com/repos/rainwoodman/vast/pulls{/number}","milestones_url":"https://api.github.com/repos/rainwoodman/vast/milestones{/number}","notifications_url":"https://api.github.com/repos/rainwoodman/vast/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rainwoodman/vast/labels{/name}","releases_url":"https://api.github.com/repos/rainwoodman/vast/releases{/id}","deployments_url":"https://api.github.com/repos/rainwoodman/vast/deployments","created_at":"2016-10-22T06:50:32Z","updated_at":"2016-11-03T13:36:05Z","pushed_at":"2016-11-09T21:40:27Z","git_url":"git://github.com/rainwoodman/vast.git","ssh_url":"git@github.com:rainwoodman/vast.git","clone_url":"https://github.com/rainwoodman/vast.git","svn_url":"https://github.com/rainwoodman/vast","homepage":null,"size":43,"stargazers_count":4,"watchers_count":4,"language":"Vala","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":9,"forks":0,"open_issues":9,"watchers":4,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/rainwoodman/vast/pulls/9"},"html":{"href":"https://github.com/rainwoodman/vast/pull/9"},"issue":{"href":"https://api.github.com/repos/rainwoodman/vast/issues/9"},"comments":{"href":"https://api.github.com/repos/rainwoodman/vast/issues/9/comments"},"review_comments":{"href":"https://api.github.com/repos/rainwoodman/vast/pulls/9/comments"},"review_comment":{"href":"https://api.github.com/repos/rainwoodman/vast/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/rainwoodman/vast/pulls/9/commits"},"statuses":{"href":"https://api.github.com/repos/rainwoodman/vast/statuses/7147620b52b7493f0f92ced8fc541d60a9626aab"}}}}
{"actor":{"display_login":"rainwoodman"}}