{"action":"created","issue":{"url":"https://api.github.com/repos/elixir-lang/elixir/issues/3232","labels_url":"https://api.github.com/repos/elixir-lang/elixir/issues/3232/labels{/name}","comments_url":"https://api.github.com/repos/elixir-lang/elixir/issues/3232/comments","events_url":"https://api.github.com/repos/elixir-lang/elixir/issues/3232/events","html_url":"https://github.com/elixir-lang/elixir/pull/3232","id":65977664,"number":3232,"title":"Add last history value helper to IEx","user":{"login":"antipax","id":56482,"avatar_url":"https://avatars.githubusercontent.com/u/56482?v=3","gravatar_id":"","url":"https://api.github.com/users/antipax","html_url":"https://github.com/antipax","followers_url":"https://api.github.com/users/antipax/followers","following_url":"https://api.github.com/users/antipax/following{/other_user}","gists_url":"https://api.github.com/users/antipax/gists{/gist_id}","starred_url":"https://api.github.com/users/antipax/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/antipax/subscriptions","organizations_url":"https://api.github.com/users/antipax/orgs","repos_url":"https://api.github.com/users/antipax/repos","events_url":"https://api.github.com/users/antipax/events{/privacy}","received_events_url":"https://api.github.com/users/antipax/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":13,"created_at":"2015-04-02T17:50:35Z","updated_at":"2015-04-02T20:00:20Z","closed_at":"2015-04-02T19:44:35Z","pull_request":{"url":"https://api.github.com/repos/elixir-lang/elixir/pulls/3232","html_url":"https://github.com/elixir-lang/elixir/pull/3232","diff_url":"https://github.com/elixir-lang/elixir/pull/3232.diff","patch_url":"https://github.com/elixir-lang/elixir/pull/3232.patch"},"body":"A lot of other language's interpreters (e.g. ruby, node, off the top of my head) allow you to use the result of the last evaluated expression via a (very short) shortcut such as `_`. This commit adds a helper `p/0` to `IEx.Helpers` which allows you to do the same in IEx. `_` would have been cool but of course that is not available.\r\n\r\nI think this would be cool because v(-1) is kind of a pain in the butt to type every time you want to use the previous value in a subsequent expression."},"comment":{"url":"https://api.github.com/repos/elixir-lang/elixir/issues/comments/89026164","html_url":"https://github.com/elixir-lang/elixir/pull/3232#issuecomment-89026164","issue_url":"https://api.github.com/repos/elixir-lang/elixir/issues/3232","id":89026164,"user":{"login":"antipax","id":56482,"avatar_url":"https://avatars.githubusercontent.com/u/56482?v=3","gravatar_id":"","url":"https://api.github.com/users/antipax","html_url":"https://github.com/antipax","followers_url":"https://api.github.com/users/antipax/followers","following_url":"https://api.github.com/users/antipax/following{/other_user}","gists_url":"https://api.github.com/users/antipax/gists{/gist_id}","starred_url":"https://api.github.com/users/antipax/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/antipax/subscriptions","organizations_url":"https://api.github.com/users/antipax/orgs","repos_url":"https://api.github.com/users/antipax/repos","events_url":"https://api.github.com/users/antipax/events{/privacy}","received_events_url":"https://api.github.com/users/antipax/received_events","type":"User","site_admin":false},"created_at":"2015-04-02T20:00:20Z","updated_at":"2015-04-02T20:00:20Z","body":"@josevalim Actually, that didn't work\r\n\r\nFiles:\r\n```\r\n╰─$ ls -la ~/.iex.exs ~/my_helpers.exs \r\n-rw-rw-rw- 1 eric eric 61 Apr  2 15:53 /home/eric/.iex.exs\r\n-rw-rw-rw- 1 eric eric 58 Apr  2 15:53 /home/eric/my_helpers.exs\r\n```\r\n\r\n~/my_helpers.exs\r\n```elixir\r\ndefmodule MyHelpers do\r\n  def v, do: IEx.Helpers.v(-1)\r\nend\r\n```\r\n\r\n~/.iex.exs\r\n```elixir\r\nCode.require_file \"my_helpers.exs\", __DIR__\r\nimport MyHelpers\r\n```\r\n\r\nError:\r\n```\r\nError while evaluating: /home/eric/.iex.exs\r\n** (CompileError) /home/eric/.iex.exs:2: module MyHelpers is not loaded and could not be found\r\n    (elixir) src/elixir_exp.erl:123: :elixir_exp.expand/2\r\n    (stdlib) lists.erl:1352: :lists.mapfoldl/3\r\n    (stdlib) lists.erl:1353: :lists.mapfoldl/3\r\n    (elixir) src/elixir_exp.erl:49: :elixir_exp.expand/2\r\n``` \r\n\r\nIf I remove the import and inspect the result of `Code.require_file` it is not nil, so I'm not sure what's goin on:\r\n```elixir\r\n[{MyHelpers,\r\n  <<70, 79, 82, 49, 0, 0, 4, 172, 66, 69, 65, 77, 69, 120, 68, 99, 0, 0, 0, 90, 131, 104, 2, 100, 0, 14, 101, 108, 105, 120, 105, 114, 95, 100, 111, 99, 115, 95, 118, 49, 108, 0, 0, 0, 2, 104, 2, 100, 0, ...>>}]\r\n```\r\n"}}