In iex, I can not get help for built-in Erlang functions, for example:
iex(1)> h :lists.reverse
:lists was not compiled with docs
Is there a way around this?
Adding Elixir to existing Erlang programs Elixir compiles into BEAM byte code (via Erlang Abstract Format). This means that Elixir code can be called from Erlang and vice versa, without the need to write any bindings. All Elixir modules start with the Elixir.
You can launch IEx shell from the command line simply typing iex or if you want to launch a phoenix project by typing iex -S mix phx. server or typing iex -S mix while in a mix based Elixir project.
The command to start IEx is… iex . If you press c , you will remain in IEx. If you press a , it will abort the shell and exit.
The Elixir syntax shares many similarities with the Ruby syntax and is widely used to build fault-tolerant, scalable, and maintainable applications. The language provides scalability, concurrency, fault tolerance, and low latency.
No. There is not.
Erlang documentation is different than Elixir documentation. As @whatyouhide said, it would mean writing an Erlang documentation parser and wiring it into h/1
in the console. While not impossible it would take some work. As far as I know no one is working on doing this.
As @Onorio Catenacci said, they do accept PR's so you (or someone else) could change this :).
As others have pointed out, there is no easy way to do this from within Elixir. However, here are some short-cuts, which might be useful for inspecting the functions available in Erlang modules from iex (even though none of this actually gives access to any documentation).
To list all functions exported by an Erlang module, use the module_info
function, e.g:
Enum.each :lists.module_info(:exports), &IO.inspect/1
This prints a list of function names and their arity.
To get a rough idea, you can print spec information for Erlang functions from iex using the s
command:
iex(1)> s :lists.reverse
@spec reverse(list1, tail) :: list2 when List1: [t], Tail: term(), List2: [t], T: term(), list1: var, tail: var, list2: var
@spec reverse(list1) :: list2 when List1: [t], List2: [t], T: term(), list1: var, list2: var
Of course, looking up the on-line documentation is probably the best way to go about it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With