[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

*To*: scheme-reports@x*Subject*: Re: [Scheme-reports] Cycle detection problems: #442, #338, "equal?"*From*: Ray Dillinger <bear@x>*Date*: Wed, 29 Aug 2012 21:26:57 -0700*In-reply-to*: <E1T6uze-0002AU-4Q@fenris.runbox.com>*References*: <E1T6h8e-0005zH-JF@fenris.runbox.com> <CAMMPzYMsznOOfPTGN2XXztycVC4cn6hGzFXo1ahgB8zS4C2w=w@mail.gmail.com> <E1T6uze-0002AU-4Q@fenris.runbox.com>

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 In order to qualify as an equivalence relation, mathematically, something must be a predicate which is symmetric, reflexive, and transitive. There are many possible such relations; our language implements three of them so far. Mathematically a predicate's range (possible results) are limited to #t and #f. Results other than #t or #f (which include exception throwing and infinite looping) expand the domain of the function, which means that a function is not in fact a predicate. I'm aware that code isn't really mathematics, but I'd like to argue that on the grounds of mathematical correctness, a loop- detecting equality function that checks and reports the equality of loops is a predicate. A loop-blind equality function which can diverge is not a predicate. An equality function which can throw an error or exception is not a predicate. Both may run faster in some cases and both may be useful for some purposes, but I support the notion that equivalence relations should actually be predicates in the mathematical sense. It makes some things easier to reason about, and reduces the number of cases the programmer has to consider. Also, both divergence and exceptions are side effects. As someone who prefers a functional programming style, I like to avoid them and avoid writing code that has to consider them. Bear -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQEcBAEBAgAGBQJQPuuGAAoJEAOzWkqOibfNW7MIAJJqERJabbW7VsV44SJSa/to t1OWDBR6kuuw2xv0E201JAn2znZPf/i8prgKDFbv5kLupAhR5WIUQgywPyLpRmzE Mz7I/UJNPvb4OFyl8AOle78b+0VBI5hkJTfLSRCHcVdfxDJNlO3qHYQVpewg76LL m2yg7BL7Ce1y1nAEcnX+/W+i6LYtWC9m5xHdK67FJwDc/tUTRNoIEgpEBwG9z4Z7 CkkpE8pb994Ui9rWE64XtkbhEdPhIQwaE1XZzCMIYjrGxJXrCRvx/LmTX+nbv48I gMqMb+kakVMRgX2JWoZi5a11LTU7dzTvnXo4E1Ybqe1+DwXa+JVWVoHibDBWMHY= =v23q -----END PGP SIGNATURE----- _______________________________________________ Scheme-reports mailing list Scheme-reports@x http://lists.scheme-reports.org/cgi-bin/mailman/listinfo/scheme-reports

**Follow-Ups**:**Re: [Scheme-reports] Cycle detection problems: #442, #338, "equal?"***From:*Vassil Nikolov <vnikolov@x>

**References**:**[Scheme-reports] Cycle detection problems: #442, #338, "equal?"***From:*"David A. Wheeler" <dwheeler@x>

**Re: [Scheme-reports] Cycle detection problems: #442, #338, "equal?"***From:*Alex Shinn <alexshinn@x>

**Re: [Scheme-reports] Cycle detection problems: #442, #338, "equal?"***From:*"David A. Wheeler" <dwheeler@x>

- Prev by Date:
**Re: [Scheme-reports] Cycle detection problems: #442, #338, "equal?"** - Next by Date:
**Re: [Scheme-reports] Cycle detection problems: #442, #338, "equal?"** - Previous by thread:
**Re: [Scheme-reports] Cycle detection problems: #442, #338, "equal?"** - Next by thread:
**Re: [Scheme-reports] Cycle detection problems: #442, #338, "equal?"** - Index(es):