[racket] Boolean expressions

From: Gary Baumgartner (gfb at cs.toronto.edu)
Date: Sun Feb 19 15:22:31 EST 2012

On Sun, Feb 19, 2012 at 02:03:51PM -0500, Hendrik Boom wrote:
> On Sun, Feb 19, 2012 at 07:05:37AM -0600, Robby Findler wrote:
> > On Sun, Feb 19, 2012 at 12:30 AM, Gary Baumgartner <gfb at cs.toronto.edu> wrote:
> > > On a more productive note: in Racket code I define and use 'implies' a lot,
> > >  often conjoined, for predicates. It's mainly of declarative value, which is
> > >  perhaps why it's uncommon in implementation despite how common it is in
> > >  specification. And for boolean expressions in general I also use 'neither'.
> > >  Are these something that others [would] use and so could be added to Racket's
> > >  library?
> > 
> > Seems to me adding implies, nand, and nor to racket/bool is a good idea.
> > 
> > Let me know if you disagree (and if you disagree after I've already
> > committed, it is a simple thing to drop the commit or change it).
> 
> The trouble is, I can never remember which of 'nand' and 'nor' is 
> which.  Either of them could mean 'neither'.  But I do know what 
> 'neither' means.
> 
> -- hendrik

This is why I'd prefer 'neither', although I can remember and teach 'nor' as
 abbreviating 'neither-nor'. There's no common Natural Language equivalent
 to 'nand', and here's some quick searching for discussions of this:

  http://www.wolframscience.com/reference/notes/1173a
  http://www.unige.ch/lettres/linge/syntaxe/journal/Volume5/ggg5_Moeschler.pdf
  http://www.lotpublications.nl/publish/articles/001530/bookpart.pdf

Whether one can train themselves to use and reason about 'nand' well is another story.
 I might start by writing it as 'nall', 'not-allof', '¬∀', '∃¬', 'some-not', etc,
 until internalizing its properties and patterns. Exceptions could be a common use:

   (when ; something fails
     (some-not «needed-expr» ...)
     (raise . _))




Posted on the users mailing list.