{"action":"created","comment":{"url":"https://api.github.com/repos/rchain/rchain/pulls/comments/173014649","pull_request_review_id":102132677,"id":173014649,"diff_hunk":"@@ -1,33 +1,41 @@\n package coop.rchain.rholang.interpreter\n \n-import scala.collection.immutable.HashMap\n+import scala.collection.mutable\n \n-/* Env reifies the Env[A] = HashMap[Int,A] type alias.\n+/* Env reifies the Env[A] = mutable.LinkedHashMap[Int,A] type alias.\n    It extends HashMap with functions that manipulate\n    the map based on level indices. */\n \n object Env {\n \n-  def empty = HashMap.empty[Int, Par]\n+  type Env[A] = mutable.LinkedHashMap[Int, A]\n \n-  implicit class DeBruijn(env: HashMap[Int,Par]) {\n+  def apply[A](a: A): Env[A] =\n+    DeBruijn(mutable.LinkedHashMap.empty[Int, A]) + a\n \n-    def get(level: Int): Option[Par] = env.get(level)\n+  def apply[A](a: A, b: A, k: A*): Env[A] =\n+    DeBruijn(mutable.LinkedHashMap.empty[Int, A]) + (a, b, k: _*)\n \n-    def put(level: Int)(data: Par): HashMap[Int,Par] = env + (level -> data)\n+  def apply[A](elems: (Int, A)*): Env[A] =\n+    mutable.LinkedHashMap[Int, A](elems: _*)\n \n-    /* Since indexing starts from 0, # of bound variables = level of\n-       environment associated with the term.*/\n-    def level: Int = env.keys.max + 1\n+  implicit class DeBruijn[A](env: mutable.LinkedHashMap[Int, A]) {\n \n-    def rename(j: Int): HashMap[Int,Par] = env map { case (k, data) => (k + j, data) }\n+    def level: Int = if (env.isEmpty) 0 else env.last._1 + 1\n \n-      /* In [env] allocate [k.size] new slots */\n-    def alloc(k: List[Par]): HashMap[Int,Par] = (env /: k) { (_env, data) =>\n-        _env.put(_env.level)(data)\n-      }\n+    def rename(j: Int): mutable.LinkedHashMap[Int, A] = env map {\n+      case (k, data) => (k + j, data)\n+    }\n \n-    def merge(_env: HashMap[Int,Par]): HashMap[Int,Par] = env ++: _env.rename(env.level)\n+    def +(a: A): mutable.LinkedHashMap[Int, A] = env += (env.level -> a)\n+\n+    def +(a: A, b: A, k: A*): mutable.LinkedHashMap[Int, A] = ((env + a + b) /: k) { (_env, data) =>\n+      _env + data\n+    }\n+\n+    def merge(_env: mutable.LinkedHashMap[Int, A]): mutable.LinkedHashMap[Int, A] =","path":"rholang/src/main/scala/coop/rchain/rholang/interpreter/Env.scala","position":null,"original_position":51,"commit_id":"34dd12a43965cc14417c5c8a40223fd09ef5eda4","original_commit_id":"712558984cc4c426502a63a75167a3243d124820","user":{"login":"JosDenmark","id":24320813,"avatar_url":"https://avatars2.githubusercontent.com/u/24320813?v=4","gravatar_id":"","url":"https://api.github.com/users/JosDenmark","html_url":"https://github.com/JosDenmark","followers_url":"https://api.github.com/users/JosDenmark/followers","following_url":"https://api.github.com/users/JosDenmark/following{/other_user}","gists_url":"https://api.github.com/users/JosDenmark/gists{/gist_id}","starred_url":"https://api.github.com/users/JosDenmark/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JosDenmark/subscriptions","organizations_url":"https://api.github.com/users/JosDenmark/orgs","repos_url":"https://api.github.com/users/JosDenmark/repos","events_url":"https://api.github.com/users/JosDenmark/events{/privacy}","received_events_url":"https://api.github.com/users/JosDenmark/received_events","type":"User","site_admin":false},"body":"Similarly, I'll expose this as ++=.","created_at":"2018-03-07T23:06:22Z","updated_at":"2018-03-07T23:06:22Z","html_url":"https://github.com/rchain/rchain/pull/371#discussion_r173014649","pull_request_url":"https://api.github.com/repos/rchain/rchain/pulls/371","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/rchain/rchain/pulls/comments/173014649"},"html":{"href":"https://github.com/rchain/rchain/pull/371#discussion_r173014649"},"pull_request":{"href":"https://api.github.com/repos/rchain/rchain/pulls/371"}},"in_reply_to_id":173012628},"pull_request":{"url":"https://api.github.com/repos/rchain/rchain/pulls/371","id":173556520,"html_url":"https://github.com/rchain/rchain/pull/371","diff_url":"https://github.com/rchain/rchain/pull/371.diff","patch_url":"https://github.com/rchain/rchain/pull/371.patch","issue_url":"https://api.github.com/repos/rchain/rchain/issues/371","number":371,"state":"open","locked":false,"title":"dev-interpreter","user":{"login":"JosDenmark","id":24320813,"avatar_url":"https://avatars2.githubusercontent.com/u/24320813?v=4","gravatar_id":"","url":"https://api.github.com/users/JosDenmark","html_url":"https://github.com/JosDenmark","followers_url":"https://api.github.com/users/JosDenmark/followers","following_url":"https://api.github.com/users/JosDenmark/following{/other_user}","gists_url":"https://api.github.com/users/JosDenmark/gists{/gist_id}","starred_url":"https://api.github.com/users/JosDenmark/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JosDenmark/subscriptions","organizations_url":"https://api.github.com/users/JosDenmark/orgs","repos_url":"https://api.github.com/users/JosDenmark/repos","events_url":"https://api.github.com/users/JosDenmark/events{/privacy}","received_events_url":"https://api.github.com/users/JosDenmark/received_events","type":"User","site_admin":false},"body":"Updated environment to use LinkedHashMap","created_at":"2018-03-07T19:53:29Z","updated_at":"2018-03-07T23:06:22Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d9871e79d1cdedc8ad339f520aef32f099e7a372","assignee":{"login":"guardbotmk3","id":33846152,"avatar_url":"https://avatars1.githubusercontent.com/u/33846152?v=4","gravatar_id":"","url":"https://api.github.com/users/guardbotmk3","html_url":"https://github.com/guardbotmk3","followers_url":"https://api.github.com/users/guardbotmk3/followers","following_url":"https://api.github.com/users/guardbotmk3/following{/other_user}","gists_url":"https://api.github.com/users/guardbotmk3/gists{/gist_id}","starred_url":"https://api.github.com/users/guardbotmk3/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/guardbotmk3/subscriptions","organizations_url":"https://api.github.com/users/guardbotmk3/orgs","repos_url":"https://api.github.com/users/guardbotmk3/repos","events_url":"https://api.github.com/users/guardbotmk3/events{/privacy}","received_events_url":"https://api.github.com/users/guardbotmk3/received_events","type":"User","site_admin":false},"assignees":[{"login":"guardbotmk3","id":33846152,"avatar_url":"https://avatars1.githubusercontent.com/u/33846152?v=4","gravatar_id":"","url":"https://api.github.com/users/guardbotmk3","html_url":"https://github.com/guardbotmk3","followers_url":"https://api.github.com/users/guardbotmk3/followers","following_url":"https://api.github.com/users/guardbotmk3/following{/other_user}","gists_url":"https://api.github.com/users/guardbotmk3/gists{/gist_id}","starred_url":"https://api.github.com/users/guardbotmk3/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/guardbotmk3/subscriptions","organizations_url":"https://api.github.com/users/guardbotmk3/orgs","repos_url":"https://api.github.com/users/guardbotmk3/repos","events_url":"https://api.github.com/users/guardbotmk3/events{/privacy}","received_events_url":"https://api.github.com/users/guardbotmk3/received_events","type":"User","site_admin":false}],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/rchain/rchain/pulls/371/commits","review_comments_url":"https://api.github.com/repos/rchain/rchain/pulls/371/comments","review_comment_url":"https://api.github.com/repos/rchain/rchain/pulls/comments{/number}","comments_url":"https://api.github.com/repos/rchain/rchain/issues/371/comments","statuses_url":"https://api.github.com/repos/rchain/rchain/statuses/34dd12a43965cc14417c5c8a40223fd09ef5eda4","head":{"label":"rchain:dev-interpreter","ref":"dev-interpreter","sha":"34dd12a43965cc14417c5c8a40223fd09ef5eda4","user":{"login":"rchain","id":20671765,"avatar_url":"https://avatars0.githubusercontent.com/u/20671765?v=4","gravatar_id":"","url":"https://api.github.com/users/rchain","html_url":"https://github.com/rchain","followers_url":"https://api.github.com/users/rchain/followers","following_url":"https://api.github.com/users/rchain/following{/other_user}","gists_url":"https://api.github.com/users/rchain/gists{/gist_id}","starred_url":"https://api.github.com/users/rchain/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rchain/subscriptions","organizations_url":"https://api.github.com/users/rchain/orgs","repos_url":"https://api.github.com/users/rchain/repos","events_url":"https://api.github.com/users/rchain/events{/privacy}","received_events_url":"https://api.github.com/users/rchain/received_events","type":"Organization","site_admin":false},"repo":{"id":84493691,"name":"rchain","full_name":"rchain/rchain","owner":{"login":"rchain","id":20671765,"avatar_url":"https://avatars0.githubusercontent.com/u/20671765?v=4","gravatar_id":"","url":"https://api.github.com/users/rchain","html_url":"https://github.com/rchain","followers_url":"https://api.github.com/users/rchain/followers","following_url":"https://api.github.com/users/rchain/following{/other_user}","gists_url":"https://api.github.com/users/rchain/gists{/gist_id}","starred_url":"https://api.github.com/users/rchain/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rchain/subscriptions","organizations_url":"https://api.github.com/users/rchain/orgs","repos_url":"https://api.github.com/users/rchain/repos","events_url":"https://api.github.com/users/rchain/events{/privacy}","received_events_url":"https://api.github.com/users/rchain/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/rchain/rchain","description":null,"fork":false,"url":"https://api.github.com/repos/rchain/rchain","forks_url":"https://api.github.com/repos/rchain/rchain/forks","keys_url":"https://api.github.com/repos/rchain/rchain/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rchain/rchain/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rchain/rchain/teams","hooks_url":"https://api.github.com/repos/rchain/rchain/hooks","issue_events_url":"https://api.github.com/repos/rchain/rchain/issues/events{/number}","events_url":"https://api.github.com/repos/rchain/rchain/events","assignees_url":"https://api.github.com/repos/rchain/rchain/assignees{/user}","branches_url":"https://api.github.com/repos/rchain/rchain/branches{/branch}","tags_url":"https://api.github.com/repos/rchain/rchain/tags","blobs_url":"https://api.github.com/repos/rchain/rchain/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rchain/rchain/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rchain/rchain/git/refs{/sha}","trees_url":"https://api.github.com/repos/rchain/rchain/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rchain/rchain/statuses/{sha}","languages_url":"https://api.github.com/repos/rchain/rchain/languages","stargazers_url":"https://api.github.com/repos/rchain/rchain/stargazers","contributors_url":"https://api.github.com/repos/rchain/rchain/contributors","subscribers_url":"https://api.github.com/repos/rchain/rchain/subscribers","subscription_url":"https://api.github.com/repos/rchain/rchain/subscription","commits_url":"https://api.github.com/repos/rchain/rchain/commits{/sha}","git_commits_url":"https://api.github.com/repos/rchain/rchain/git/commits{/sha}","comments_url":"https://api.github.com/repos/rchain/rchain/comments{/number}","issue_comment_url":"https://api.github.com/repos/rchain/rchain/issues/comments{/number}","contents_url":"https://api.github.com/repos/rchain/rchain/contents/{+path}","compare_url":"https://api.github.com/repos/rchain/rchain/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rchain/rchain/merges","archive_url":"https://api.github.com/repos/rchain/rchain/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rchain/rchain/downloads","issues_url":"https://api.github.com/repos/rchain/rchain/issues{/number}","pulls_url":"https://api.github.com/repos/rchain/rchain/pulls{/number}","milestones_url":"https://api.github.com/repos/rchain/rchain/milestones{/number}","notifications_url":"https://api.github.com/repos/rchain/rchain/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rchain/rchain/labels{/name}","releases_url":"https://api.github.com/repos/rchain/rchain/releases{/id}","deployments_url":"https://api.github.com/repos/rchain/rchain/deployments","created_at":"2017-03-09T22:15:35Z","updated_at":"2018-03-07T12:56:17Z","pushed_at":"2018-03-07T23:02:50Z","git_url":"git://github.com/rchain/rchain.git","ssh_url":"git@github.com:rchain/rchain.git","clone_url":"https://github.com/rchain/rchain.git","svn_url":"https://github.com/rchain/rchain","homepage":null,"size":7140,"stargazers_count":189,"watchers_count":189,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":52,"mirror_url":null,"archived":false,"open_issues_count":8,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":52,"open_issues":8,"watchers":189,"default_branch":"master"}},"base":{"label":"rchain:dev","ref":"dev","sha":"509eb608784a72b32fa291f0e95f37b87b94bd32","user":{"login":"rchain","id":20671765,"avatar_url":"https://avatars0.githubusercontent.com/u/20671765?v=4","gravatar_id":"","url":"https://api.github.com/users/rchain","html_url":"https://github.com/rchain","followers_url":"https://api.github.com/users/rchain/followers","following_url":"https://api.github.com/users/rchain/following{/other_user}","gists_url":"https://api.github.com/users/rchain/gists{/gist_id}","starred_url":"https://api.github.com/users/rchain/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rchain/subscriptions","organizations_url":"https://api.github.com/users/rchain/orgs","repos_url":"https://api.github.com/users/rchain/repos","events_url":"https://api.github.com/users/rchain/events{/privacy}","received_events_url":"https://api.github.com/users/rchain/received_events","type":"Organization","site_admin":false},"repo":{"id":84493691,"name":"rchain","full_name":"rchain/rchain","owner":{"login":"rchain","id":20671765,"avatar_url":"https://avatars0.githubusercontent.com/u/20671765?v=4","gravatar_id":"","url":"https://api.github.com/users/rchain","html_url":"https://github.com/rchain","followers_url":"https://api.github.com/users/rchain/followers","following_url":"https://api.github.com/users/rchain/following{/other_user}","gists_url":"https://api.github.com/users/rchain/gists{/gist_id}","starred_url":"https://api.github.com/users/rchain/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rchain/subscriptions","organizations_url":"https://api.github.com/users/rchain/orgs","repos_url":"https://api.github.com/users/rchain/repos","events_url":"https://api.github.com/users/rchain/events{/privacy}","received_events_url":"https://api.github.com/users/rchain/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/rchain/rchain","description":null,"fork":false,"url":"https://api.github.com/repos/rchain/rchain","forks_url":"https://api.github.com/repos/rchain/rchain/forks","keys_url":"https://api.github.com/repos/rchain/rchain/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rchain/rchain/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rchain/rchain/teams","hooks_url":"https://api.github.com/repos/rchain/rchain/hooks","issue_events_url":"https://api.github.com/repos/rchain/rchain/issues/events{/number}","events_url":"https://api.github.com/repos/rchain/rchain/events","assignees_url":"https://api.github.com/repos/rchain/rchain/assignees{/user}","branches_url":"https://api.github.com/repos/rchain/rchain/branches{/branch}","tags_url":"https://api.github.com/repos/rchain/rchain/tags","blobs_url":"https://api.github.com/repos/rchain/rchain/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rchain/rchain/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rchain/rchain/git/refs{/sha}","trees_url":"https://api.github.com/repos/rchain/rchain/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rchain/rchain/statuses/{sha}","languages_url":"https://api.github.com/repos/rchain/rchain/languages","stargazers_url":"https://api.github.com/repos/rchain/rchain/stargazers","contributors_url":"https://api.github.com/repos/rchain/rchain/contributors","subscribers_url":"https://api.github.com/repos/rchain/rchain/subscribers","subscription_url":"https://api.github.com/repos/rchain/rchain/subscription","commits_url":"https://api.github.com/repos/rchain/rchain/commits{/sha}","git_commits_url":"https://api.github.com/repos/rchain/rchain/git/commits{/sha}","comments_url":"https://api.github.com/repos/rchain/rchain/comments{/number}","issue_comment_url":"https://api.github.com/repos/rchain/rchain/issues/comments{/number}","contents_url":"https://api.github.com/repos/rchain/rchain/contents/{+path}","compare_url":"https://api.github.com/repos/rchain/rchain/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rchain/rchain/merges","archive_url":"https://api.github.com/repos/rchain/rchain/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rchain/rchain/downloads","issues_url":"https://api.github.com/repos/rchain/rchain/issues{/number}","pulls_url":"https://api.github.com/repos/rchain/rchain/pulls{/number}","milestones_url":"https://api.github.com/repos/rchain/rchain/milestones{/number}","notifications_url":"https://api.github.com/repos/rchain/rchain/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rchain/rchain/labels{/name}","releases_url":"https://api.github.com/repos/rchain/rchain/releases{/id}","deployments_url":"https://api.github.com/repos/rchain/rchain/deployments","created_at":"2017-03-09T22:15:35Z","updated_at":"2018-03-07T12:56:17Z","pushed_at":"2018-03-07T23:02:50Z","git_url":"git://github.com/rchain/rchain.git","ssh_url":"git@github.com:rchain/rchain.git","clone_url":"https://github.com/rchain/rchain.git","svn_url":"https://github.com/rchain/rchain","homepage":null,"size":7140,"stargazers_count":189,"watchers_count":189,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":52,"mirror_url":null,"archived":false,"open_issues_count":8,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":52,"open_issues":8,"watchers":189,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/rchain/rchain/pulls/371"},"html":{"href":"https://github.com/rchain/rchain/pull/371"},"issue":{"href":"https://api.github.com/repos/rchain/rchain/issues/371"},"comments":{"href":"https://api.github.com/repos/rchain/rchain/issues/371/comments"},"review_comments":{"href":"https://api.github.com/repos/rchain/rchain/pulls/371/comments"},"review_comment":{"href":"https://api.github.com/repos/rchain/rchain/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/rchain/rchain/pulls/371/commits"},"statuses":{"href":"https://api.github.com/repos/rchain/rchain/statuses/34dd12a43965cc14417c5c8a40223fd09ef5eda4"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"JosDenmark"}}