<div dir="ltr">Ok, then lets use, 12572247014351 which happens to be a prime.<div><br></div><div>No, there are good reasons for not using the integer domain in this way:</div><div><br></div><div>first of all, the type of comparisons will be</div>

<div><br></div><div>type x</div><div>datatype order = EQ | LT | GT</div><div><br></div><div>val compare : x * x -> order</div><div><br></div><div>rather than</div><div><br></div><div>val compare : x * x -> int</div>

<div><br></div><div>Do note, that if we had something like view-types, we can easily convert from order to the integer domain:</div><div><br></div><div>view(eq) -> 0;</div><div>view(lt) -> -1;</div><div>view(gt) -> 1.</div>

<div><br></div><div>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.</div>

<div><br></div><div>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.</div><div><br></div><div>Another problem with an integer is that</div>

<div><br></div><div>compare(X, Y) * compare(Y, Z) is a valid expression, but it has no meaning whatsoever.</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Oct 29, 2013 at 8:23 PM, Robert Virding <span dir="ltr"><<a href="mailto:robert.virding@erlang-solutions.com" target="_blank">robert.virding@erlang-solutions.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div style="font-size:12pt;font-family:times new roman,new york,times,serif"><div>You couldn't have values like that, they're not primes.<br>

</div><div><br></div><div>Robert</div><div><br></div><hr><blockquote style="padding-left:5px;font-size:12pt;font-style:normal;margin-left:5px;font-family:Helvetica,Arial,sans-serif;text-decoration:none;font-weight:normal;border-left:2px solid #1010ff">

<b>From: </b>"Jesper Louis Andersen" <<a href="mailto:jesper.louis.andersen@gmail.com" target="_blank">jesper.louis.andersen@gmail.com</a>><div><div class="h5"><br><div dir="ltr"><div class="gmail_extra">
<br>
<div class="gmail_quote">On Tue, Oct 29, 2013 at 7:15 PM, OvermindDL1 <span dir="ltr"><<a href="mailto:overminddl1@gmail.com" target="_blank">overminddl1@gmail.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">+1 for -1, 0, and 1, math simplifies then in cases</blockquote></div><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!</div>



<div class="gmail_extra"><br></div><div class="gmail_extra">We don't need to diverge from Standard ML. We need to converge!</div><div class="gmail_extra"><br><br clear="all"><div><br></div>-- <br>J.
</div></div>
<br></div></div><div class="im">_______________________________________________<br>erlang-questions mailing list<br><a href="mailto:erlang-questions@erlang.org" target="_blank">erlang-questions@erlang.org</a><br><a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>

</div></blockquote><div><br></div></div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br>J.
</div>