interactive shell and command line eval!
today I added two features that will make learning efene a lot easier.
this features are the interactive shell and command line eval.
interactive shell is what you get in erlang when you type erl, it let you write expressions that are evaluated right away and let you experiment with stuff.
the command line eval is what you get in python when you do
python -c “something”
the “something” is executed in a interpreter for you
let’s see some examples of the command line eval
$ fnc -c 'io.format("hello world!~n")'
hello world!
eval: {value,ok,[]}
the seccond line is the result of the evaluation, let’s try another one
$ fnc -c '4 * 3 + 2'
eval: {value,14,[]}
now let’s see the interactive shell
$ fnc -s
efene 0.3 exit with Ctrl+D
>>> A = 2
2
>>> B = A * 3
6
>>> io.format("~p ~p~n", [A B])
2 6
ok
>>> F = fn (Name) { io.format("hello ~s!~n" [Name] }
{badmatch,{error,{1,parser,["syntax error before: ","'}'"]}}}
>>> F = fn (Name) { io.format("hello ~s!~n" [Name]) }
#Fun
>>> F("mariano")
hello mariano!
ok
>>>
as you can see it behaves like one would expect for an interactive interpreter :D
POSTED Thursday March 11th