DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH
 

(guile.info.gz) SRFI-1 Set Operations

Info Catalog (guile.info.gz) SRFI-1 Association Lists (guile.info.gz) SRFI-1
 
 39.3.10 Set Operations on Lists
 -------------------------------
 
 Lists can be used for representing sets of objects.  The procedures
 documented in this section can be used for such set representations.
 Man combining several sets or adding elements, they make sure that no
 object is contained more than once in a given list.  Please note that
 lists are not a too efficient implementation method for sets, so if you
 need high performance, you should think about implementing a custom
 data structure for representing sets, such as trees, bitsets, hash
 tables or something similar.
 
    All these procedures accept an equality predicate as the first
 argument.  This predicate is used for testing the objects in the list
 sets for sameness.
 
  -- Scheme Procedure: lset<= = list1 ...
      Return `#t' if every LISTI is a subset of LISTI+1, otherwise
      return `#f'.  Returns `#t' if called with less than two arguments.
      = is used for testing element equality.
 
  -- Scheme Procedure: lset= = list1 list2 ...
      Return `#t' if all argument lists are equal. = is used for testing
      element equality.
 
  -- Scheme Procedure: lset-adjoin = list elt1 ...
  -- Scheme Procedure: lset-adjoin! = list elt1 ...
      Add all ELTS to the list LIST, suppressing duplicates and return
      the resulting list.  `lset-adjoin!' is allowed, but not required
      to modify its first argument. = is used for testing element
      equality.
 
  -- Scheme Procedure: lset-union = list1 ...
  -- Scheme Procedure: lset-union! = list1 ...
      Return the union of all argument list sets.  The union is the set
      of all elements which appear in any of the argument sets.
      `lset-union!' is allowed, but not required to modify its first
      argument. = is used for testing element equality.
 
  -- Scheme Procedure: lset-intersection = list1 list2 ...
  -- Scheme Procedure: lset-intersection! = list1 list2 ...
      Return the intersection of all argument list sets.  The
      intersection is the set containing all elements which appear in
      all argument sets.  `lset-intersection!' is allowed, but not
      required to modify its first argument. = is used for testing
      element equality.
 
  -- Scheme Procedure: lset-difference = list1 list2 ...
  -- Scheme Procedure: lset-difference! = list1 list2 ...
      Return the difference of all argument list sets.  The difference is
      the the set containing all elements of the first list which do not
      appear in the other lists.  `lset-difference!'  is allowed, but
      not required to modify its first argument. = is used for testing
      element equality.
 
  -- Scheme Procedure: lset-xor = list1 ...
  -- Scheme Procedure: lset-xor! = list1 ...
      Return the set containing all elements which appear in the first
      argument list set, but not in the second; or, more generally: which
      appear in an odd number of sets.  `lset-xor!'  is allowed, but not
      required to modify its first argument. = is used for testing
      element equality.
 
  -- Scheme Procedure: lset-diff+intersection = list1 list2 ...
  -- Scheme Procedure: lset-diff+intersection! = list1 list2 ...
      Return two values, the difference and the intersection of the
      argument list sets. This works like a combination of
      `lset-difference' and `lset-intersection', but is more efficient.
      `lset-diff+intersection!'  is allowed, but not required to modify
      its first argument. = is used for testing element equality.  You
      have to use some means to deal with the multiple values these
      procedures return ( Multiple Values).
 
Info Catalog (guile.info.gz) SRFI-1 Association Lists (guile.info.gz) SRFI-1
automatically generated byinfo2html