{"action":"created","comment":{"url":"https://api.github.com/repos/47deg/second-bridge/pulls/comments/41880632","id":41880632,"diff_hunk":"@@ -0,0 +1,236 @@\n+/*\n+* Copyright (C) 2015 47 Degrees, LLC http://47deg.com hello@47deg.com\n+*\n+* Licensed under the Apache License, Version 2.0 (the \"License\"); you may\n+* not use this file except in compliance with the License. You may obtain\n+* a copy of the License at\n+*\n+*     http://www.apache.org/licenses/LICENSE-2.0\n+*\n+* Unless required by applicable law or agreed to in writing, software\n+* distributed under the License is distributed on an \"AS IS\" BASIS,\n+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+* See the License for the specific language governing permissions and\n+* limitations under the License.\n+*/\n+\n+import Foundation\n+\n+internal enum PartsTree {\n+    case Left\n+    case Right\n+}\n+\n+indirect enum BinarySearchTree<T:Comparable>: CustomStringConvertible {\n+    \n+    case Empty\n+    case Node(T, left: BinarySearchTree, right: BinarySearchTree)\n+    \n+    \n+    /*\n+    * Return the element the head the current BST\n+    */\n+    func getHead() -> T? {\n+        switch self{\n+        case .Empty:\n+            return .None\n+        case let .Node(T, left: _, right: _):\n+            return T\n+        }\n+    }\n+    \n+    /*\n+    * Return a new BST with the part provided in the parameter (left or right)\n+    */\n+    func get(part: PartsTree) -> BinarySearchTree {\n+        \n+        switch self {\n+        case .Empty:\n+            return .Empty\n+        case let .Node(_, left: _, right: rigth) where part == .Right:\n+            return rigth\n+        case let .Node(_, left: left, right: _) where part == .Left:\n+            return left\n+        default:\n+            return self","path":"SecondBridge/SecondBridge/Data/BinarySearchTree.swift","position":55,"original_position":55,"commit_id":"5bf5638d061777741691cc827ce3d342f115acd8","original_commit_id":"5bf5638d061777741691cc827ce3d342f115acd8","user":{"login":"jdesiloniz","id":2835739,"avatar_url":"https://avatars.githubusercontent.com/u/2835739?v=3","gravatar_id":"","url":"https://api.github.com/users/jdesiloniz","html_url":"https://github.com/jdesiloniz","followers_url":"https://api.github.com/users/jdesiloniz/followers","following_url":"https://api.github.com/users/jdesiloniz/following{/other_user}","gists_url":"https://api.github.com/users/jdesiloniz/gists{/gist_id}","starred_url":"https://api.github.com/users/jdesiloniz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jdesiloniz/subscriptions","organizations_url":"https://api.github.com/users/jdesiloniz/orgs","repos_url":"https://api.github.com/users/jdesiloniz/repos","events_url":"https://api.github.com/users/jdesiloniz/events{/privacy}","received_events_url":"https://api.github.com/users/jdesiloniz/received_events","type":"User","site_admin":false},"body":"If I'm not mistaken, this method returns the component (left or right) from a certain node as a new tree. If that's the case, shouldn't it return an optional value, and therefore return \"nil\" in this switch case?","created_at":"2015-10-13T15:21:12Z","updated_at":"2015-10-13T15:21:12Z","html_url":"https://github.com/47deg/second-bridge/pull/50#discussion_r41880632","pull_request_url":"https://api.github.com/repos/47deg/second-bridge/pulls/50","_links":{"self":{"href":"https://api.github.com/repos/47deg/second-bridge/pulls/comments/41880632"},"html":{"href":"https://github.com/47deg/second-bridge/pull/50#discussion_r41880632"},"pull_request":{"href":"https://api.github.com/repos/47deg/second-bridge/pulls/50"}}},"pull_request":{"url":"https://api.github.com/repos/47deg/second-bridge/pulls/50","id":47545634,"html_url":"https://github.com/47deg/second-bridge/pull/50","diff_url":"https://github.com/47deg/second-bridge/pull/50.diff","patch_url":"https://github.com/47deg/second-bridge/pull/50.patch","issue_url":"https://api.github.com/repos/47deg/second-bridge/issues/50","number":50,"state":"open","locked":false,"title":"Am #36 add bst","user":{"login":"anamariamv","id":2183589,"avatar_url":"https://avatars.githubusercontent.com/u/2183589?v=3","gravatar_id":"","url":"https://api.github.com/users/anamariamv","html_url":"https://github.com/anamariamv","followers_url":"https://api.github.com/users/anamariamv/followers","following_url":"https://api.github.com/users/anamariamv/following{/other_user}","gists_url":"https://api.github.com/users/anamariamv/gists{/gist_id}","starred_url":"https://api.github.com/users/anamariamv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/anamariamv/subscriptions","organizations_url":"https://api.github.com/users/anamariamv/orgs","repos_url":"https://api.github.com/users/anamariamv/repos","events_url":"https://api.github.com/users/anamariamv/events{/privacy}","received_events_url":"https://api.github.com/users/anamariamv/received_events","type":"User","site_admin":false},"body":"This PR define a binary search tree as an ADT using enum\r\nThis includes all general functions, that are \"add\", \"remove\" and \"search\". Also implement different functions that I think they're necessary and help in other cases.\r\nModified readme and generate a test.\r\n\r\n@jdesiloniz  could you review, please?\r\nThanks!!","created_at":"2015-10-13T15:06:40Z","updated_at":"2015-10-13T15:21:12Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ee5bd432c30a38e821211c3ecb24122b6fd7bf75","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/47deg/second-bridge/pulls/50/commits","review_comments_url":"https://api.github.com/repos/47deg/second-bridge/pulls/50/comments","review_comment_url":"https://api.github.com/repos/47deg/second-bridge/pulls/comments{/number}","comments_url":"https://api.github.com/repos/47deg/second-bridge/issues/50/comments","statuses_url":"https://api.github.com/repos/47deg/second-bridge/statuses/5bf5638d061777741691cc827ce3d342f115acd8","head":{"label":"47deg:am-#36-AddBST","ref":"am-#36-AddBST","sha":"5bf5638d061777741691cc827ce3d342f115acd8","user":{"login":"47deg","id":479857,"avatar_url":"https://avatars.githubusercontent.com/u/479857?v=3","gravatar_id":"","url":"https://api.github.com/users/47deg","html_url":"https://github.com/47deg","followers_url":"https://api.github.com/users/47deg/followers","following_url":"https://api.github.com/users/47deg/following{/other_user}","gists_url":"https://api.github.com/users/47deg/gists{/gist_id}","starred_url":"https://api.github.com/users/47deg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/47deg/subscriptions","organizations_url":"https://api.github.com/users/47deg/orgs","repos_url":"https://api.github.com/users/47deg/repos","events_url":"https://api.github.com/users/47deg/events{/privacy}","received_events_url":"https://api.github.com/users/47deg/received_events","type":"Organization","site_admin":false},"repo":{"id":31597632,"name":"second-bridge","full_name":"47deg/second-bridge","owner":{"login":"47deg","id":479857,"avatar_url":"https://avatars.githubusercontent.com/u/479857?v=3","gravatar_id":"","url":"https://api.github.com/users/47deg","html_url":"https://github.com/47deg","followers_url":"https://api.github.com/users/47deg/followers","following_url":"https://api.github.com/users/47deg/following{/other_user}","gists_url":"https://api.github.com/users/47deg/gists{/gist_id}","starred_url":"https://api.github.com/users/47deg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/47deg/subscriptions","organizations_url":"https://api.github.com/users/47deg/orgs","repos_url":"https://api.github.com/users/47deg/repos","events_url":"https://api.github.com/users/47deg/events{/privacy}","received_events_url":"https://api.github.com/users/47deg/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/47deg/second-bridge","description":"Second Bridge is a Swift framework for functional programming. Our goal is to make Swift development on par with other functional languages like Scala by adding new data types, functions and operators.","fork":false,"url":"https://api.github.com/repos/47deg/second-bridge","forks_url":"https://api.github.com/repos/47deg/second-bridge/forks","keys_url":"https://api.github.com/repos/47deg/second-bridge/keys{/key_id}","collaborators_url":"https://api.github.com/repos/47deg/second-bridge/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/47deg/second-bridge/teams","hooks_url":"https://api.github.com/repos/47deg/second-bridge/hooks","issue_events_url":"https://api.github.com/repos/47deg/second-bridge/issues/events{/number}","events_url":"https://api.github.com/repos/47deg/second-bridge/events","assignees_url":"https://api.github.com/repos/47deg/second-bridge/assignees{/user}","branches_url":"https://api.github.com/repos/47deg/second-bridge/branches{/branch}","tags_url":"https://api.github.com/repos/47deg/second-bridge/tags","blobs_url":"https://api.github.com/repos/47deg/second-bridge/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/47deg/second-bridge/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/47deg/second-bridge/git/refs{/sha}","trees_url":"https://api.github.com/repos/47deg/second-bridge/git/trees{/sha}","statuses_url":"https://api.github.com/repos/47deg/second-bridge/statuses/{sha}","languages_url":"https://api.github.com/repos/47deg/second-bridge/languages","stargazers_url":"https://api.github.com/repos/47deg/second-bridge/stargazers","contributors_url":"https://api.github.com/repos/47deg/second-bridge/contributors","subscribers_url":"https://api.github.com/repos/47deg/second-bridge/subscribers","subscription_url":"https://api.github.com/repos/47deg/second-bridge/subscription","commits_url":"https://api.github.com/repos/47deg/second-bridge/commits{/sha}","git_commits_url":"https://api.github.com/repos/47deg/second-bridge/git/commits{/sha}","comments_url":"https://api.github.com/repos/47deg/second-bridge/comments{/number}","issue_comment_url":"https://api.github.com/repos/47deg/second-bridge/issues/comments{/number}","contents_url":"https://api.github.com/repos/47deg/second-bridge/contents/{+path}","compare_url":"https://api.github.com/repos/47deg/second-bridge/compare/{base}...{head}","merges_url":"https://api.github.com/repos/47deg/second-bridge/merges","archive_url":"https://api.github.com/repos/47deg/second-bridge/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/47deg/second-bridge/downloads","issues_url":"https://api.github.com/repos/47deg/second-bridge/issues{/number}","pulls_url":"https://api.github.com/repos/47deg/second-bridge/pulls{/number}","milestones_url":"https://api.github.com/repos/47deg/second-bridge/milestones{/number}","notifications_url":"https://api.github.com/repos/47deg/second-bridge/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/47deg/second-bridge/labels{/name}","releases_url":"https://api.github.com/repos/47deg/second-bridge/releases{/id}","created_at":"2015-03-03T12:38:22Z","updated_at":"2015-09-22T11:58:00Z","pushed_at":"2015-10-13T15:06:40Z","git_url":"git://github.com/47deg/second-bridge.git","ssh_url":"git@github.com:47deg/second-bridge.git","clone_url":"https://github.com/47deg/second-bridge.git","svn_url":"https://github.com/47deg/second-bridge","homepage":"http://47deg.github.io/second-bridge/","size":2856,"stargazers_count":56,"watchers_count":56,"language":"Swift","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":3,"mirror_url":null,"open_issues_count":11,"forks":3,"open_issues":11,"watchers":56,"default_branch":"master"}},"base":{"label":"47deg:master","ref":"master","sha":"fbb09039f5ad82678ebe84a36d434282dbc4bc65","user":{"login":"47deg","id":479857,"avatar_url":"https://avatars.githubusercontent.com/u/479857?v=3","gravatar_id":"","url":"https://api.github.com/users/47deg","html_url":"https://github.com/47deg","followers_url":"https://api.github.com/users/47deg/followers","following_url":"https://api.github.com/users/47deg/following{/other_user}","gists_url":"https://api.github.com/users/47deg/gists{/gist_id}","starred_url":"https://api.github.com/users/47deg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/47deg/subscriptions","organizations_url":"https://api.github.com/users/47deg/orgs","repos_url":"https://api.github.com/users/47deg/repos","events_url":"https://api.github.com/users/47deg/events{/privacy}","received_events_url":"https://api.github.com/users/47deg/received_events","type":"Organization","site_admin":false},"repo":{"id":31597632,"name":"second-bridge","full_name":"47deg/second-bridge","owner":{"login":"47deg","id":479857,"avatar_url":"https://avatars.githubusercontent.com/u/479857?v=3","gravatar_id":"","url":"https://api.github.com/users/47deg","html_url":"https://github.com/47deg","followers_url":"https://api.github.com/users/47deg/followers","following_url":"https://api.github.com/users/47deg/following{/other_user}","gists_url":"https://api.github.com/users/47deg/gists{/gist_id}","starred_url":"https://api.github.com/users/47deg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/47deg/subscriptions","organizations_url":"https://api.github.com/users/47deg/orgs","repos_url":"https://api.github.com/users/47deg/repos","events_url":"https://api.github.com/users/47deg/events{/privacy}","received_events_url":"https://api.github.com/users/47deg/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/47deg/second-bridge","description":"Second Bridge is a Swift framework for functional programming. Our goal is to make Swift development on par with other functional languages like Scala by adding new data types, functions and operators.","fork":false,"url":"https://api.github.com/repos/47deg/second-bridge","forks_url":"https://api.github.com/repos/47deg/second-bridge/forks","keys_url":"https://api.github.com/repos/47deg/second-bridge/keys{/key_id}","collaborators_url":"https://api.github.com/repos/47deg/second-bridge/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/47deg/second-bridge/teams","hooks_url":"https://api.github.com/repos/47deg/second-bridge/hooks","issue_events_url":"https://api.github.com/repos/47deg/second-bridge/issues/events{/number}","events_url":"https://api.github.com/repos/47deg/second-bridge/events","assignees_url":"https://api.github.com/repos/47deg/second-bridge/assignees{/user}","branches_url":"https://api.github.com/repos/47deg/second-bridge/branches{/branch}","tags_url":"https://api.github.com/repos/47deg/second-bridge/tags","blobs_url":"https://api.github.com/repos/47deg/second-bridge/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/47deg/second-bridge/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/47deg/second-bridge/git/refs{/sha}","trees_url":"https://api.github.com/repos/47deg/second-bridge/git/trees{/sha}","statuses_url":"https://api.github.com/repos/47deg/second-bridge/statuses/{sha}","languages_url":"https://api.github.com/repos/47deg/second-bridge/languages","stargazers_url":"https://api.github.com/repos/47deg/second-bridge/stargazers","contributors_url":"https://api.github.com/repos/47deg/second-bridge/contributors","subscribers_url":"https://api.github.com/repos/47deg/second-bridge/subscribers","subscription_url":"https://api.github.com/repos/47deg/second-bridge/subscription","commits_url":"https://api.github.com/repos/47deg/second-bridge/commits{/sha}","git_commits_url":"https://api.github.com/repos/47deg/second-bridge/git/commits{/sha}","comments_url":"https://api.github.com/repos/47deg/second-bridge/comments{/number}","issue_comment_url":"https://api.github.com/repos/47deg/second-bridge/issues/comments{/number}","contents_url":"https://api.github.com/repos/47deg/second-bridge/contents/{+path}","compare_url":"https://api.github.com/repos/47deg/second-bridge/compare/{base}...{head}","merges_url":"https://api.github.com/repos/47deg/second-bridge/merges","archive_url":"https://api.github.com/repos/47deg/second-bridge/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/47deg/second-bridge/downloads","issues_url":"https://api.github.com/repos/47deg/second-bridge/issues{/number}","pulls_url":"https://api.github.com/repos/47deg/second-bridge/pulls{/number}","milestones_url":"https://api.github.com/repos/47deg/second-bridge/milestones{/number}","notifications_url":"https://api.github.com/repos/47deg/second-bridge/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/47deg/second-bridge/labels{/name}","releases_url":"https://api.github.com/repos/47deg/second-bridge/releases{/id}","created_at":"2015-03-03T12:38:22Z","updated_at":"2015-09-22T11:58:00Z","pushed_at":"2015-10-13T15:06:40Z","git_url":"git://github.com/47deg/second-bridge.git","ssh_url":"git@github.com:47deg/second-bridge.git","clone_url":"https://github.com/47deg/second-bridge.git","svn_url":"https://github.com/47deg/second-bridge","homepage":"http://47deg.github.io/second-bridge/","size":2856,"stargazers_count":56,"watchers_count":56,"language":"Swift","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":3,"mirror_url":null,"open_issues_count":11,"forks":3,"open_issues":11,"watchers":56,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/47deg/second-bridge/pulls/50"},"html":{"href":"https://github.com/47deg/second-bridge/pull/50"},"issue":{"href":"https://api.github.com/repos/47deg/second-bridge/issues/50"},"comments":{"href":"https://api.github.com/repos/47deg/second-bridge/issues/50/comments"},"review_comments":{"href":"https://api.github.com/repos/47deg/second-bridge/pulls/50/comments"},"review_comment":{"href":"https://api.github.com/repos/47deg/second-bridge/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/47deg/second-bridge/pulls/50/commits"},"statuses":{"href":"https://api.github.com/repos/47deg/second-bridge/statuses/5bf5638d061777741691cc827ce3d342f115acd8"}}}}