[erlang-questions] How do you define a function using the shell?

Mike Berrow <>
Sun May 20 21:55:55 CEST 2007


I can load function in from files using 
c(modname).

But when I try the same thing in the shell I get an error.
eg.

10> Prs = [{2,7},{6,2},{4,3},{2,5}].
[{2,7},{6,2},{4,3},{2,5}]
11> totally(L) -> lists:sum([A * B || {A, B} <- L]).
** 1: syntax error before: '->' **

Coming from ruby, I a used experimenting with code fragments in the shell (very useful).
Is there a different way to do it?   or is it just not possible?

Thanks,
-- Mike Berrow





More information about the erlang-questions mailing list