3> erlang:function_exported(odbc,start,0).
false
4> odbc:start().
ok
5> erlang:function_exported(odbc,start,0).
true
|
2> list_to_atom("erlang"). erlang 3> list_to_existing_atom("erlang"). erlang 4> list_to_existing_atom("hello"). ** exception error: bad argument in function list_to_existing_atom/1 called as list_to_existing_atom("hello") |
erlang:process_info(Pid, dictionary)
10> spawn(fun() -> io:format("~w ~w~n",[random:uniform(),random:uniform()]) end)
,ok. 0.4435846174457203 0.7230402056221108 ok 11> spawn(fun() -> io:format("~w ~w~n",[random:uniform(),random:uniform()]) end) ,ok. 0.4435846174457203 0.7230402056221108 ok |
13> random:seed(erlang:now()), random:uniform().
0.4691405130019146 |
uniform() ->
{A1, A2, A3} = case get(random_seed) of undefined -> erlang:now(); Tuple -> Tuple end, B1 = (A1*171) rem 30269, B2 = (A2*172) rem 30307, B3 = (A3*170) rem 30323, put(random_seed, {B1,B2,B3}), R = A1/30269 + A2/30307 + A3/30323, R - trunc(R). |
try1(ErrType) ->
try
case ErrType of
error -> erlang:error(error);
exit -> erlang:exit (exit);
throw -> erlang:throw(throw)
end
catch
Err -> Err
end.
|
try1(ErrType) ->
try
case ErrType of
error -> erlang:error(error);
exit -> erlang:exit (exit);
throw -> erlang:throw(throw)
end
catch
_:Err -> Err
end.
|
check(A) when length(A) > 9 ->
error;
check(_) ->
ok.
|
check1(A) when length(A) > 9 ; true->
error;
check1(_) ->
ok.
check2(A) when length(A) > 9 orelse true->
error;
check2(_) ->
ok.
check3(A) when length(A) > 9 , true->
error;
check3(_) ->
ok.
check4(A) when length(A) > 9 andalso true->
error;
check4(_) ->
ok.
|
这个函数在R15和R16下运行结果可能是相反的。
R15下:
Eshell V5.9.3.1 (abort with ^G)
1> io_lib:char_list([10100,10600,20100]).
false
R16下:
Eshell V5.10.1 (abort with ^G)
1> io_lib:char_list([10100,10600,20100]).
true
|
do_cast(Dest, Request) ->
do_send(Dest, cast_msg(Request)),
ok.
do_send(Dest, Msg) ->
case catch erlang:send(Dest, Msg, [noconnect]) of
noconnect ->
spawn(erlang, send, [Dest,Msg]);
Other ->
Other
end.
|
16> hack >1.
true
17> [] > 1.
true
18> [] > {a,b,c}.
true
|
receive after 4294967296 -> ok end. |