erlang で (外部モジュールから) 関数を呼び出そうとしています。両方のビーム ファイルが同じディレクトリにあります。
-module(drop2).
-export([fall_velocity/1]).
fall_velocity(Distance) -> math:sqrt(2 * 9.8 * Distance).
それから私は電話しています
-module(ask).
-export([term/0]).
term() ->
Input = io:read("Enter {x,distance} ? >>"),
Term = element(2,Input),
drop2:fall_velocity(Term).
次のエラーが発生します。個々のモジュールのエラーをテストしました。エラーや警告なしでコンパイルされています。
Eshell V5.10.2 (abort with ^G)
1> ask:term().
Enter {x,distance} ? >>{test,10}.
** exception error: an error occurred when evaluating an arithmetic expression
in function drop2:fall_velocity/1 (drop2.erl, line 3)
なぜそれが算術式エラーを投げているのか分かりません。