Question

Coming from Python I am looking for some "easy to try out" shell like Python has with ipython (preferably with Emacs support). In the Erlang shell you always have to first compile (c(...)) which slows down the experimental phase very much.

Was it helpful?

Solution

Yes it is :) http://erlang.org/doc/man/escript.html

$ cat /tmp/test
#!/usr/bin/env escript
main(_) ->
io:format("Hello World!\n").
$ chmod +x /tmp/test
$ /tmp/test
Hello World!

OTHER TIPS

It should be fairly easy to build a module the starts a process to autoload code changes into your shell. Erlang actually has built in support for this kind of thing. So anytime you have recompiled the code it gets loaded into your shell automatically thus eliminating the need to type c('module.erl'). yourself. You could probably even have it monitor file changes and automatically compile it for you. see:

http://github.com/toddlipcon/mochiweb/blob/29d6ffd58aa2cd175f84cadfc1ce1697f366ef62/src/reloader.erl

for an example in action.

Currently that module just looks for recompiled modules but it should be trivial to have it look for changed source files and recompile them for you.

IErlang is an Erlang language kernel for IPython. It allows users to use IPython's Notebook frontend, except where IPython executes python code, IErlang can execute erlang code and compile and execute erlang modules.

https://github.com/robbielynch/ierlang

There is also an IPython kernel for Elixir:

https://github.com/pminten/ielixir

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top