From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from netcomsv.netcom.com ([192.100.81.101]) by hawkwind.utcs.toronto.edu with SMTP id <2776>; Tue, 3 Nov 1992 19:06:27 -0500 Received: from netapp.UUCP by netcomsv.netcom.com with UUCP (4.1/SMI-4.1) id AA11756; Tue, 3 Nov 92 17:03:16 PPE Received: from ghoti.netapp by netapp.netapp.com (4.1/SMI-4.1) id AA00168; Tue, 3 Nov 92 15:44:01 PST Date: Tue, 3 Nov 1992 18:44:01 -0500 From: byron@netapp.com (Byron Rakitzis) Message-Id: <9211032344.AA00168@netapp.netapp.com> To: rc@hawkwind.utcs.toronto.edu Subject: set subtract Given two lists a and b, it is possible to do set subtract in rc with the ~ operator: for (i in $a) if (!~ $i $b) echo $i So all that you need to do is write a function to build these two lists based on the [a] - [b] syntax suggested. Something like this: fn set-subtract { a=() while () { switch ($1) { case () echo usage: $0 'foo - bar' >[1=2] return 1 case - shift break case * a=($a $1) shift } } for (i in $a) if (!~ $i $*) echo $i } (Btw, I would choose a shorter name than set-subtract. Sort of reminds me of the regexp syntax that Nicklaus Wirth uses in his Oberon system. I think it's straight BNF. To say .* you have to write it as {~c}. Or even worse, foo*bar becomes "fo"{"o"}"bar". Does he really use this tool, or expect anyone else to? But I digress..)