Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- %%%-------------------------------------------------------------------
- %%% @doc Simple pattern matching
- %%% @end
- %%%-------------------------------------------------------------------
- -module(boolean).
- % Public API
- -export([b_not/1, b_and/2, b_or/2]).
- %%--------------------------------------------------------------------
- %% @doc Operator 'not'.
- %% @end
- %%--------------------------------------------------------------------
- -spec b_not(Value :: boolean()) -> boolean().
- b_not(true) ->
- false;
- b_not(false) ->
- true.
- %%--------------------------------------------------------------------
- %% @doc Operator 'and'.
- %% @end
- %%--------------------------------------------------------------------
- -spec b_and(Value1 :: boolean(),
- Value2 :: boolean()) -> boolean().
- b_and(true, true) ->
- true;
- b_and(Other, Another) when is_atom(Other), is_atom(Another) ->
- false.
- %%--------------------------------------------------------------------
- %% @doc Operator 'or'.
- %% @end
- %%--------------------------------------------------------------------
- -spec b_or(Value1 :: boolean(),
- Value2 :: boolean()) -> atom().
- b_or(false, false) ->
- false;
- b_or(Other, Another) when is_boolean(Other), is_boolean(Another)->
- true.
Add Comment
Please, Sign In to add comment