context function 2: not-filter
not-filter:
description:
not-filter(operators, conditions) input-seq
Filters the input sequence to only those elements that don't satisfy the operator/condition pair
It is the brother of filter()
examples:
-- First, learn some knowledge:
father |John> => |Fred>
occupation |Fred> => |politician>
father |Sam> => |Robert>
occupation |Robert> => |doctor>
father |Emma> => |Jack>
occupation |Jack> => |nurse>
-- filter to those that don't have a rule of any type that is doctor or nurse:
-- NB: if rel-kets[*] is large, or supported-ops is large, this may be slow.
not-filter(|*>, |doctor> + |nurse>) rel-kets[*]
|John> + |Fred> + |Sam> + |Emma>
-- find people that don't have the father operator defined:
not-filter(|op: father>, |*>) rel-kets[*]
|Fred> + |Robert> + |Jack>
-- filter to people that don't have a father with occupation of either doctor or nurse:
not-filter(|ops: occupation father>, |doctor> + |nurse>) rel-kets[*]
|John> + |Fred> + |Robert> + |Jack>
see also:
filter
Home