Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there an ipython equivalent for erlang?

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.

like image 437
wr. Avatar asked May 11 '09 08:05

wr.


3 Answers

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!
like image 157
JLarky Avatar answered Sep 19 '22 18:09

JLarky


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.

like image 38
Jeremy Wall Avatar answered Sep 18 '22 18:09

Jeremy Wall


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

like image 31
Yuval Langer Avatar answered Sep 20 '22 18:09

Yuval Langer