<p dir="ltr">Den 29/10/2013 20.42 skrev "Jesper Louis Andersen" <<a href="mailto:jesper.louis.andersen@gmail.com">jesper.louis.andersen@gmail.com</a>>:<br>
><br>
> Ok, then lets use, 12572247014351 which happens to be a prime.<br>
><br>
> No, there are good reasons for not using the integer domain in this way:<br>
><br>
> first of all, the type of comparisons will be<br>
><br>
> type x<br>
> datatype order = EQ | LT | GT<br>
><br>
> val compare : x * x -> order<br>
><br>
> rather than<br>
><br>
> val compare : x * x -> int<br>
><br>
> Do note, that if we had something like view-types, we can easily convert from order to the integer domain:<br>
><br>
> view(eq) -> 0;<br>
> view(lt) -> -1;<br>
> view(gt) -> 1.</p>
<p dir="ltr">The one argument I see against atoms is that eq < gt < lt - and that is easily fixable with a view function.</p>
<p dir="ltr">> This function is exhaustive in the input type. Whereas the opposite definition will fail for view(1337), for instance. I do know Erlang is a unityped language, but whenever there is a possibility of picking an interface from a polytyped language, they are much to be preferred.<br>

><br>
> Do note that this is in order with Standard ML and Haskell, whereas Ocaml chose the int-path. But I still think comparison should be case-analysed.<br>
><br>
> Another problem with an integer is that<br>
><br>
> compare(X, Y) * compare(Y, Z) is a valid expression, but it has no meaning whatsoever.</p>
<p dir="ltr">Bad example, I'm afraid: the result is 1 whenever the numbers are in order, either x <y <z or x> y> z; and -1 whenever y is a strict extreme.<br>
(Not that it changes anything much.)</p>
<p dir="ltr">> On Tue, Oct 29, 2013 at 8:23 PM, Robert Virding <<a href="mailto:robert.virding@erlang-solutions.com">robert.virding@erlang-solutions.com</a>> wrote:<br>
>><br>
>> You couldn't have values like that, they're not primes.<br>
>><br>
>> Robert<br>
>><br>
>> ________________________________<br>
>>><br>
>>> From: "Jesper Louis Andersen" <<a href="mailto:jesper.louis.andersen@gmail.com">jesper.louis.andersen@gmail.com</a>><br>
>>><br>
>>><br>
>>> On Tue, Oct 29, 2013 at 7:15 PM, OvermindDL1 <<a href="mailto:overminddl1@gmail.com">overminddl1@gmail.com</a>> wrote:<br>
>>>><br>
>>>> +1 for -1, 0, and 1, math simplifies then in cases<br>
>>><br>
>>><br>
>>> No -1000 for this bad insane idea. Comparison is an algebraic datatype with three outcomes: lt, eq or gt. You DON'T use an integer domain to represent that. Why not -1337, 0 and +230439204830948320498 instead? They are equally good I guess!<br>

>>><br>
>>> We don't need to diverge from Standard ML. We need to converge!<br>
>>><br>
>>><br>
>>><br>
>>> -- <br>
>>> J.<br>
>>><br>
>>> _______________________________________________<br>
>>> erlang-questions mailing list<br>
>>> <a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
>>> <a href="http://erlang.org/mailman/listinfo/erlang-questions">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
>><br>
>><br>
><br>
><br>
><br>
> -- <br>
> J.<br>
><br>
> _______________________________________________<br>
> erlang-questions mailing list<br>
> <a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
> <a href="http://erlang.org/mailman/listinfo/erlang-questions">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
><br>
</p>