Return-Path:
Return-Path: <john.harrison-request@uk.ac.cam.cl>
Received: from ted.cs.uidaho.edu by swan.cl.cam.ac.uk with SMTP (PP-6.0)
          id <13958-0@swan.cl.cam.ac.uk>; Wed, 15 Jan 1992 12:10:09 +0000
Received: by ted.cs.uidaho.edu.cs.uidaho.edu (16.6/1.34) id AA03579;
          Wed, 15 Jan 92 04:00:08 -0800
Sender: info-hol-request@edu.uidaho.cs.ted
Errors-To: info-hol-request@edu.uidaho.cs.ted
Received: from relay2.UU.NET by ted.cs.uidaho.edu.cs.uidaho.edu (16.6/1.34)
          id AA03575; Wed, 15 Jan 92 04:00:02 -0800
Received: from uunet.uu.net (via LOCALHOST.UU.NET) by relay2.UU.NET
          with SMTP (5.61/UUNET-internet-primary) id AA19684;
          Wed, 15 Jan 92 07:02:11 -0500
Received: from inmos-c.UUCP by uunet.uu.net with UUCP/RMAIL (queueing-rmail)
          id 070140.3091; Wed, 15 Jan 1992 07:01:40 EST
Received: from brwbf.inmos.co.uk by inmos-c.inmos.com with DNI-MTP [1.1]
          id brwbf-8439; Wed, 15 Jan 92 04:59:31 MST
Received: from ganymede.inmos.co.uk by brwbf.inmos.co.uk;
          Wed, 15 Jan 92 10:58:43 GMT
Received: from frogland.inmos.co.uk by ganymede.inmos.co.uk;
          Wed, 15 Jan 92 10:58:46 GMT
From: David Shepherd <des@com.inmos>
Message-Id: <7314.9201151058@frogland.inmos.co.uk>
Subject: Re: Why sets?
To: chou@edu.ucla.cs
Date: Wed, 15 Jan 92 10:58:30 GMT
In-Reply-To: <9201151029.AA10795@maui.cs.ucla.edu>; from "chou@cs.ucla.edu" at Jan 15, 92 2:29 am
X-Mailer: ELM [version 2.3 PL11]

chou@cs.ucla.edu has said:
> I was browsing through library "sets" and this occurred to me:
> Why do we need sets at all?  Why can't we just use the predicates?
> What is the advantage of having a new type (*)set?  And when should
> I use (*)set and when should I use (* -> bool)?

to help distinguish between something that is intuitively a function
from * to bool and something that is a set.

e.g. consider a statement that for a sets which meet some validity requirement
then another condition holds for all their members. the two formulations are

! (values:*->bool) . (valid values) ==> (! v. (values v) ==> (condition v))

and

! (values:(*)set) . (valid values) ==> (! v. (v IN values) ==> (condition v))

While they are both effectively the same the second is more intuitive.

Also by making sets a new type it can add to type security -- i.e. it
forces you to apply the charateristic function of a set to a value and
not just the set which makes what your doing explicit.

after all you could always dispense with all the types except for :bool and
:ind ... but things would get pretty unreadable!



--------------------------------------------------------------------------
david shepherd: des@inmos.co.uk or des@inmos.com    tel: 0454-616616 x 625
                inmos ltd, 1000 aztec west, almondsbury, bristol, bs12 4sq
                "five,  four,  three,  two,  one,   thunderbirds are go !"


