[erlang-questions] Maps branch and disclaimers

Chris King colanderman@REDACTED
Tue Oct 29 20:51:17 CET 2013


On Tue, Oct 29, 2013 at 3:41 PM, Jesper Louis Andersen <
jesper.louis.andersen@REDACTED> wrote:

>
> view(eq) -> 0;
> view(lt) -> -1;
> view(gt) -> 1.
>
> This function is exhaustive in the input type.
>

No it's not.  Unless you define the input type as :- type order() :: eq |
lt | gt.  Well, you can do the same thing with integers in Erlang: :- type
order() :: -1 | 0 | 1.


> Another problem with an integer is that
>
> compare(X, Y) * compare(Y, Z) is a valid expression, but it has no meaning
> whatsoever.
>

And with atoms, list_to_atom(lists:append(atom_to_list(X), atom_to_list(Y))
is equally meaningless.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20131029/965a3d13/attachment.htm>


More information about the erlang-questions mailing list