-
-
Save puzza007/7326351 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-module(or_or_or). | |
-compile(export_all). | |
f1(X) -> | |
if | |
length(X) =:= 1; size(X) =:= 1 -> | |
okay; | |
true -> | |
nope | |
end. | |
f2(X) -> | |
if | |
length(X) =:= 1 orelse size(X) =:= 1 -> | |
okay; | |
true -> | |
nope | |
end. | |
test() -> | |
io:format("f1([x]) = ~p~n", [f1([x])]), | |
io:format("f1({x}) = ~p~n", [f1({x})]), | |
io:format("~n", []), | |
io:format("f2([x]) = ~p~n", [f2([x])]), | |
io:format("f2({x}) = ~p~n", [f2({x})]). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
puzza@Pauls-MacBookPro /tmp $ erl | |
Erlang R16B02 (erts-5.10.3) [source] [64-bit] [smp:8:8] [async-threads:10] [hipe] [kernel-poll:false] | |
Eshell V5.10.3 (abort with ^G) | |
1> or_or_or:test(). | |
f1([x]) = okay | |
f1({x}) = okay | |
f2([x]) = okay | |
f2({x}) = nope | |
ok | |
2> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment