Hacker News new | past | comments | ask | show | jobs | submit login

That's why erlang has file:consult from the start. It just reads whatever data is in file, that data can be any valid erlang terms. That format is also used for typical system configuration files. Of course, you could make execution based on that configuration file, it happens that erlang already has "standardised" way of storing this as {M,F,A} (module, function, args), which you could send directly to apply:

  {ok,Commands}=file:consult("functions.txt"),
  [ apply(M,F,A) || {M,F,A} <- Commands ].
With contents of functions.txt:

  {io,format,["Hello World!~n"]}.



Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: