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

*To*: scheme@mc.lcs.mit.edu*Subject*: The defintion of TRUE and FALSE in Scheme.*From*: "Mario O. Bourgoin" <mob@media-lab.media.mit.edu>*Date*: Sun ,16 Jul 89 00:18:26 EDT*Organization*: MIT Media Lab, Cambridge MA*References*: <8907141728.aa02609@mintaka.lcs.mit.edu>*Sender*: scheme-request@mc.lcs.mit.edu

I've been wanting to replace the usual LISP definitions of TRUE and FALSE by functions because that seems more in the spirit of Scheme. Furthermore, with functions we can eliminate ``if'' and ``cond'' from the essential syntax of Scheme which simplifies the analysis of extensions to Scheme such as Zabih, McAllester, and Chapman's non-deterministic operator, ``amb''. I would like to get the Scheme community's reaction to the specification of particular objects for TRUE and FALSE, namely the functions: (define true (lambda (iftrue iffalse) iftrue)) (define false (lambda (iftrue iffalse) iffalse)) Naturally, the constants #t and #f would always denote the appropriate one of these two functions. Given the above definitions for TRUE and FALSE, ``if'' statements can be replaced according to the following pattern: (if predicate iftrue iffalse) => ((predicate (lambda () iftrue) (lambda () iffalse))) And ``cond'' may be replaced thus: (cond (predicate1 body1) (predicate2 body2) (predicate3 body3) (else bodyelse)) becomes: ((predicate1 (lambda () body1) (lambda () ((predicate2 (lambda () body2) (lambda () ((predicate3 (lambda () body3) (lambda () bodyelse))))))))) The logical connectives ``not'', ``and'', and ``or'' could be defined as follows. (not predicate) => (predicate false true) (or predicate1 predicate2) => (predicate1 true predicate2) (and predicate1 predicate2) => (predicate1 predicate2 false) Naturally, the definitions for ``or'' and ``and'' can be extended to handle a variable number of parameters. Please tell me of any problems you see with such a definition. --Mario O. Bourgoin

**References**:**Minutes of the 3rd IEEE Scheme Working Group meeting***From:*Chris Haynes <chaynes@iuvax.cs.indiana.edu>

- Prev by Date:
**Xscheme object context diffs & sample (425 lines)** - Next by Date:
**Question: "Records" in scheme?** - Previous by thread:
**Minutes of the 3rd IEEE Scheme Working Group meeting** - Next by thread:
**Xscheme object context diffs & sample (425 lines)** - Index(es):