Re:Erlang.org's new website look
by nivertech on Saturday March 26, 2011 @05:20PM
(#2373235)
[ Parent
| on HN ]
-module(opine).
-export([opine/0]).
opine() -> io:format(gen_opine(random:uniform())).
gen_opine(R) when R > 0.2 -> "I love the new website.~n";
gen_opine(_) -> "I hate the new website.~n". -module(opine).
-export([opine/0]).
opine() ->
io:format("I ~s the new website.~n",[gen_opine(random:uniform())]).
gen_opine(R) when R > 0.2 -> love;
gen_opine(_) -> hate.Heh, won't quite work since you used ~s for atoms, and also, mine is better because it's more flexible if you want to change the format of an opinion for a specific score range ;P
Are you sure?
[~]$ erl
Erlang R14B02 (erts-5.8.3) [source] [smp:2:2] [rq:2] [async-threads:0] [hipe] [kernel-poll:false]
Eshell V5.8.3 (abort with ^G)
1> io:format("~s ~s!~n",[hello, world]).
hello world!
ok
2>I stand corrected!