GitHub PullRequestEvent at 2014-01-29 04:08:54
Repository: probability-monad
Actor: jliszka
Payload: {"action":"closed","number":5,"pull_request":{"url":"https://api.github.com/repos/jliszka/probability-monad/pulls/5","id":11962745,"html_url":"https://github.com/jliszka/probability-monad/pull/5","diff_url":"https://github.com/jliszka/probability-monad/pull/5.diff","patch_url":"https://github.com/jliszka/probability-monad/pull/5.patch","issue_url":"https://api.github.com/repos/jliszka/probability-monad/issues/5","number":5,"state":"closed","title":"Make the alias method numerically stable","user":{"login":"jcazevedo","id":143188,"avatar_url":"https://gravatar.com/avatar/7724a3ee1890f271f424878b0524ae15?d=https%3A%2F%2Fidenticons.github.com%2F1849bc2fa7850764fcfe45f75ae17b52.png&r=x","gravatar_id":"7724a3ee1890f271f424878b0524ae15","url":"https://api.github.com/users/jcazevedo","html_url":"https://github.com/jcazevedo","followers_url":"https://api.github.com/users/jcazevedo/followers","following_url":"https://api.github.com/users/jcazevedo/following{/other_user}","gists_url":"https://api.github.com/users/jcazevedo/gists{/gist_id}","starred_url":"https://api.github.com/users/jcazevedo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jcazevedo/subscriptions","organizations_url":"https://api.github.com/users/jcazevedo/orgs","repos_url":"https://api.github.com/users/jcazevedo/repos","events_url":"https://api.github.com/users/jcazevedo/events{/privacy}","received_events_url":"https://api.github.com/users/jcazevedo/received_events","type":"User","site_admin":false},"body":"This PR makes the `alias` method numerically stable, as recommended [here](http://www.keithschwarz.com/darts-dice-coins/). It fixes match errors in cases such as the following:\r\n\r\n```scala\r\nscala> discrete((0 until 300).map(_ -> 10.0 / 3.0):_*)\r\nscala.MatchError: List() (of class scala.collection.immutable.Nil$)\r\n        at probability_monad.Distribution$$anon$19.alias(Distribution.scala:281)\r\n        at probability_monad.Distribution$$anon$19.<init>(Distribution.scala:291)\r\n        at probability_monad.Distribution$.discrete(Distribution.scala:270)\r\n        at .<init>(<console>:17)\r\n        at .<clinit>(<console>)\r\n        at .<init>(<console>:7)\r\n        at .<clinit>(<console>)\r\n        at $print(<console>)\r\n        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\r\n        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)\r\n        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\r\n        at java.lang.reflect.Method.invoke(Method.java:601)\r\n        at scala.tools.nsc.interpreter.IMain$ReadEvalPrint.call(IMain.scala:734)\r\n        at scala.tools.nsc.interpreter.IMain$Request.loadAndRun(IMain.scala:983)\r\n        at scala.tools.nsc.interpreter.IMain.loadAndRunReq$1(IMain.scala:573)\r\n        at scala.tools.nsc.interpreter.IMain.interpret(IMain.scala:604)\r\n        at scala.tools.nsc.interpreter.IMain.interpret(IMain.scala:568)\r\n        at scala.tools.nsc.interpreter.ILoop.reallyInterpret$1(ILoop.scala:745)\r\n        at scala.tools.nsc.interpreter.ILoop.interpretStartingWith(ILoop.scala:790)\r\n        at scala.tools.nsc.interpreter.ILoop.command(ILoop.scala:702)\r\n        at scala.tools.nsc.interpreter.ILoop.processLine$1(ILoop.scala:566)\r\n        at scala.tools.nsc.interpreter.ILoop.innerLoop$1(ILoop.scala:573)\r\n        at scala.tools.nsc.interpreter.ILoop.loop(ILoop.scala:576)\r\n        at scala.tools.nsc.interpreter.ILoop$$anonfun$process$1.apply$mcZ$sp(ILoop.scala:867)\r\n        at scala.tools.nsc.interpreter.ILoop$$anonfun$process$1.apply(ILoop.scala:822)\r\n        at scala.tools.nsc.interpreter.ILoop$$anonfun$process$1.apply(ILoop.scala:822)\r\n        at scala.tools.nsc.util.ScalaClassLoader$.savingContextLoader(ScalaClassLoader.scala:135)\r\n        at scala.tools.nsc.interpreter.ILoop.process(ILoop.scala:822)\r\n        at scala.tools.nsc.interpreter.ILoop.main(ILoop.scala:889)\r\n        at xsbt.ConsoleInterface.run(ConsoleInterface.scala:57)\r\n        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\r\n        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)\r\n        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\r\n        at java.lang.reflect.Method.invoke(Method.java:601)\r\n        at sbt.compiler.AnalyzingCompiler.call(AnalyzingCompiler.scala:73)\r\n        at sbt.compiler.AnalyzingCompiler.console(AnalyzingCompiler.scala:64)\r\n        at sbt.Console.console0$1(Console.scala:23)\r\n        at sbt.Console$$anonfun$apply$2$$anonfun$apply$1.apply$mcV$sp(Console.scala:24)\r\n        at sbt.TrapExit$.executeMain$1(TrapExit.scala:33)\r\n        at sbt.TrapExit$$anon$1.run(TrapExit.scala:42)\r\n```","created_at":"2014-01-28T20:04:06Z","updated_at":"2014-01-29T04:08:54Z","closed_at":"2014-01-29T04:08:53Z","merged_at":"2014-01-29T04:08:53Z","merge_commit_sha":"b22342ff870f77283aeb18a6e0f981ff1cffbe20","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/jliszka/probability-monad/pulls/5/commits","review_comments_url":"https://api.github.com/repos/jliszka/probability-monad/pulls/5/comments","review_comment_url":"/repos/jliszka/probability-monad/pulls/comments/{number}","comments_url":"https://api.github.com/repos/jliszka/probability-monad/issues/5/comments","statuses_url":"https://api.github.com/repos/jliszka/probability-monad/statuses/f425c681823f86cd6408766f61cabbf762eed6ee","head":{"label":"jcazevedo:increase-numerical-stability","ref":"increase-numerical-stability","sha":"f425c681823f86cd6408766f61cabbf762eed6ee","user":{"login":"jcazevedo","id":143188,"avatar_url":"https://gravatar.com/avatar/7724a3ee1890f271f424878b0524ae15?d=https%3A%2F%2Fidenticons.github.com%2F1849bc2fa7850764fcfe45f75ae17b52.png&r=x","gravatar_id":"7724a3ee1890f271f424878b0524ae15","url":"https://api.github.com/users/jcazevedo","html_url":"https://github.com/jcazevedo","followers_url":"https://api.github.com/users/jcazevedo/followers","following_url":"https://api.github.com/users/jcazevedo/following{/other_user}","gists_url":"https://api.github.com/users/jcazevedo/gists{/gist_id}","starred_url":"https://api.github.com/users/jcazevedo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jcazevedo/subscriptions","organizations_url":"https://api.github.com/users/jcazevedo/orgs","repos_url":"https://api.github.com/users/jcazevedo/repos","events_url":"https://api.github.com/users/jcazevedo/events{/privacy}","received_events_url":"https://api.github.com/users/jcazevedo/received_events","type":"User","site_admin":false},"repo":{"id":16285074,"name":"probability-monad","full_name":"jcazevedo/probability-monad","owner":{"login":"jcazevedo","id":143188,"avatar_url":"https://gravatar.com/avatar/7724a3ee1890f271f424878b0524ae15?d=https%3A%2F%2Fidenticons.github.com%2F1849bc2fa7850764fcfe45f75ae17b52.png&r=x","gravatar_id":"7724a3ee1890f271f424878b0524ae15","url":"https://api.github.com/users/jcazevedo","html_url":"https://github.com/jcazevedo","followers_url":"https://api.github.com/users/jcazevedo/followers","following_url":"https://api.github.com/users/jcazevedo/following{/other_user}","gists_url":"https://api.github.com/users/jcazevedo/gists{/gist_id}","starred_url":"https://api.github.com/users/jcazevedo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jcazevedo/subscriptions","organizations_url":"https://api.github.com/users/jcazevedo/orgs","repos_url":"https://api.github.com/users/jcazevedo/repos","events_url":"https://api.github.com/users/jcazevedo/events{/privacy}","received_events_url":"https://api.github.com/users/jcazevedo/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jcazevedo/probability-monad","description":"","fork":true,"url":"https://api.github.com/repos/jcazevedo/probability-monad","forks_url":"https://api.github.com/repos/jcazevedo/probability-monad/forks","keys_url":"https://api.github.com/repos/jcazevedo/probability-monad/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jcazevedo/probability-monad/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jcazevedo/probability-monad/teams","hooks_url":"https://api.github.com/repos/jcazevedo/probability-monad/hooks","issue_events_url":"https://api.github.com/repos/jcazevedo/probability-monad/issues/events{/number}","events_url":"https://api.github.com/repos/jcazevedo/probability-monad/events","assignees_url":"https://api.github.com/repos/jcazevedo/probability-monad/assignees{/user}","branches_url":"https://api.github.com/repos/jcazevedo/probability-monad/branches{/branch}","tags_url":"https://api.github.com/repos/jcazevedo/probability-monad/tags","blobs_url":"https://api.github.com/repos/jcazevedo/probability-monad/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jcazevedo/probability-monad/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jcazevedo/probability-monad/git/refs{/sha}","trees_url":"https://api.github.com/repos/jcazevedo/probability-monad/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jcazevedo/probability-monad/statuses/{sha}","languages_url":"https://api.github.com/repos/jcazevedo/probability-monad/languages","stargazers_url":"https://api.github.com/repos/jcazevedo/probability-monad/stargazers","contributors_url":"https://api.github.com/repos/jcazevedo/probability-monad/contributors","subscribers_url":"https://api.github.com/repos/jcazevedo/probability-monad/subscribers","subscription_url":"https://api.github.com/repos/jcazevedo/probability-monad/subscription","commits_url":"https://api.github.com/repos/jcazevedo/probability-monad/commits{/sha}","git_commits_url":"https://api.github.com/repos/jcazevedo/probability-monad/git/commits{/sha}","comments_url":"https://api.github.com/repos/jcazevedo/probability-monad/comments{/number}","issue_comment_url":"https://api.github.com/repos/jcazevedo/probability-monad/issues/comments/{number}","contents_url":"https://api.github.com/repos/jcazevedo/probability-monad/contents/{+path}","compare_url":"https://api.github.com/repos/jcazevedo/probability-monad/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jcazevedo/probability-monad/merges","archive_url":"https://api.github.com/repos/jcazevedo/probability-monad/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jcazevedo/probability-monad/downloads","issues_url":"https://api.github.com/repos/jcazevedo/probability-monad/issues{/number}","pulls_url":"https://api.github.com/repos/jcazevedo/probability-monad/pulls{/number}","milestones_url":"https://api.github.com/repos/jcazevedo/probability-monad/milestones{/number}","notifications_url":"https://api.github.com/repos/jcazevedo/probability-monad/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jcazevedo/probability-monad/labels{/name}","releases_url":"https://api.github.com/repos/jcazevedo/probability-monad/releases{/id}","created_at":"2014-01-27T16:38:21Z","updated_at":"2014-01-29T04:08:54Z","pushed_at":"2014-01-28T19:55:37Z","git_url":"git://github.com/jcazevedo/probability-monad.git","ssh_url":"git@github.com:jcazevedo/probability-monad.git","clone_url":"https://github.com/jcazevedo/probability-monad.git","svn_url":"https://github.com/jcazevedo/probability-monad","homepage":"","size":167,"stargazers_count":0,"watchers_count":0,"language":"Scala","has_issues":false,"has_downloads":true,"has_wiki":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master","master_branch":"master"}},"base":{"label":"jliszka:master","ref":"master","sha":"850ad5b0a57b44db6254887582d9105b82cdfb36","user":{"login":"jliszka","id":231357,"avatar_url":"https://gravatar.com/avatar/a08e4f3dfe3b8a5c7e81a78d1a4f5465?d=https%3A%2F%2Fidenticons.github.com%2F4e3fbe5ff145862fece72b3f45683d28.png&r=x","gravatar_id":"a08e4f3dfe3b8a5c7e81a78d1a4f5465","url":"https://api.github.com/users/jliszka","html_url":"https://github.com/jliszka","followers_url":"https://api.github.com/users/jliszka/followers","following_url":"https://api.github.com/users/jliszka/following{/other_user}","gists_url":"https://api.github.com/users/jliszka/gists{/gist_id}","starred_url":"https://api.github.com/users/jliszka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jliszka/subscriptions","organizations_url":"https://api.github.com/users/jliszka/orgs","repos_url":"https://api.github.com/users/jliszka/repos","events_url":"https://api.github.com/users/jliszka/events{/privacy}","received_events_url":"https://api.github.com/users/jliszka/received_events","type":"User","site_admin":false},"repo":{"id":3080882,"name":"probability-monad","full_name":"jliszka/probability-monad","owner":{"login":"jliszka","id":231357,"avatar_url":"https://gravatar.com/avatar/a08e4f3dfe3b8a5c7e81a78d1a4f5465?d=https%3A%2F%2Fidenticons.github.com%2F4e3fbe5ff145862fece72b3f45683d28.png&r=x","gravatar_id":"a08e4f3dfe3b8a5c7e81a78d1a4f5465","url":"https://api.github.com/users/jliszka","html_url":"https://github.com/jliszka","followers_url":"https://api.github.com/users/jliszka/followers","following_url":"https://api.github.com/users/jliszka/following{/other_user}","gists_url":"https://api.github.com/users/jliszka/gists{/gist_id}","starred_url":"https://api.github.com/users/jliszka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jliszka/subscriptions","organizations_url":"https://api.github.com/users/jliszka/orgs","repos_url":"https://api.github.com/users/jliszka/repos","events_url":"https://api.github.com/users/jliszka/events{/privacy}","received_events_url":"https://api.github.com/users/jliszka/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jliszka/probability-monad","description":"","fork":false,"url":"https://api.github.com/repos/jliszka/probability-monad","forks_url":"https://api.github.com/repos/jliszka/probability-monad/forks","keys_url":"https://api.github.com/repos/jliszka/probability-monad/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jliszka/probability-monad/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jliszka/probability-monad/teams","hooks_url":"https://api.github.com/repos/jliszka/probability-monad/hooks","issue_events_url":"https://api.github.com/repos/jliszka/probability-monad/issues/events{/number}","events_url":"https://api.github.com/repos/jliszka/probability-monad/events","assignees_url":"https://api.github.com/repos/jliszka/probability-monad/assignees{/user}","branches_url":"https://api.github.com/repos/jliszka/probability-monad/branches{/branch}","tags_url":"https://api.github.com/repos/jliszka/probability-monad/tags","blobs_url":"https://api.github.com/repos/jliszka/probability-monad/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jliszka/probability-monad/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jliszka/probability-monad/git/refs{/sha}","trees_url":"https://api.github.com/repos/jliszka/probability-monad/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jliszka/probability-monad/statuses/{sha}","languages_url":"https://api.github.com/repos/jliszka/probability-monad/languages","stargazers_url":"https://api.github.com/repos/jliszka/probability-monad/stargazers","contributors_url":"https://api.github.com/repos/jliszka/probability-monad/contributors","subscribers_url":"https://api.github.com/repos/jliszka/probability-monad/subscribers","subscription_url":"https://api.github.com/repos/jliszka/probability-monad/subscription","commits_url":"https://api.github.com/repos/jliszka/probability-monad/commits{/sha}","git_commits_url":"https://api.github.com/repos/jliszka/probability-monad/git/commits{/sha}","comments_url":"https://api.github.com/repos/jliszka/probability-monad/comments{/number}","issue_comment_url":"https://api.github.com/repos/jliszka/probability-monad/issues/comments/{number}","contents_url":"https://api.github.com/repos/jliszka/probability-monad/contents/{+path}","compare_url":"https://api.github.com/repos/jliszka/probability-monad/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jliszka/probability-monad/merges","archive_url":"https://api.github.com/repos/jliszka/probability-monad/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jliszka/probability-monad/downloads","issues_url":"https://api.github.com/repos/jliszka/probability-monad/issues{/number}","pulls_url":"https://api.github.com/repos/jliszka/probability-monad/pulls{/number}","milestones_url":"https://api.github.com/repos/jliszka/probability-monad/milestones{/number}","notifications_url":"https://api.github.com/repos/jliszka/probability-monad/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jliszka/probability-monad/labels{/name}","releases_url":"https://api.github.com/repos/jliszka/probability-monad/releases{/id}","created_at":"2011-12-31T21:28:44Z","updated_at":"2014-01-29T04:08:53Z","pushed_at":"2014-01-29T04:08:53Z","git_url":"git://github.com/jliszka/probability-monad.git","ssh_url":"git@github.com:jliszka/probability-monad.git","clone_url":"https://github.com/jliszka/probability-monad.git","svn_url":"https://github.com/jliszka/probability-monad","homepage":"","size":216,"stargazers_count":82,"watchers_count":82,"language":"Scala","has_issues":true,"has_downloads":true,"has_wiki":true,"forks_count":16,"mirror_url":null,"open_issues_count":0,"forks":16,"open_issues":0,"watchers":82,"default_branch":"master","master_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/jliszka/probability-monad/pulls/5"},"html":{"href":"https://github.com/jliszka/probability-monad/pull/5"},"issue":{"href":"https://api.github.com/repos/jliszka/probability-monad/issues/5"},"comments":{"href":"https://api.github.com/repos/jliszka/probability-monad/issues/5/comments"},"review_comments":{"href":"https://api.github.com/repos/jliszka/probability-monad/pulls/5/comments"},"commits":{"href":"https://api.github.com/repos/jliszka/probability-monad/pulls/5/commits"},"statuses":{"href":"https://api.github.com/repos/jliszka/probability-monad/statuses/f425c681823f86cd6408766f61cabbf762eed6ee"}},"merged":true,"mergeable":null,"mergeable_state":"unknown","merged_by":{"login":"jliszka","id":231357,"avatar_url":"https://gravatar.com/avatar/a08e4f3dfe3b8a5c7e81a78d1a4f5465?d=https%3A%2F%2Fidenticons.github.com%2F4e3fbe5ff145862fece72b3f45683d28.png&r=x","gravatar_id":"a08e4f3dfe3b8a5c7e81a78d1a4f5465","url":"https://api.github.com/users/jliszka","html_url":"https://github.com/jliszka","followers_url":"https://api.github.com/users/jliszka/followers","following_url":"https://api.github.com/users/jliszka/following{/other_user}","gists_url":"https://api.github.com/users/jliszka/gists{/gist_id}","starred_url":"https://api.github.com/users/jliszka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jliszka/subscriptions","organizations_url":"https://api.github.com/users/jliszka/orgs","repos_url":"https://api.github.com/users/jliszka/repos","events_url":"https://api.github.com/users/jliszka/events{/privacy}","received_events_url":"https://api.github.com/users/jliszka/received_events","type":"User","site_admin":false},"comments":0,"review_comments":0,"commits":1,"additions":10,"deletions":6,"changed_files":1}}