XLISP subsetp

Nyquist / XLISP 2.0 - Contents | Tutorials | Examples | Reference

# subsetp

Type: | - | Lisp function (closure)
Source: | - | xm.lsp

## Syntax

(subsetp list1 list2)
  listN - a list of symbols or numbers
  returns - T if list1 is a subset of list2, NIL otherwise

In Nyquist, 'subsetp' is implemented as a Lisp function:

    (defun subsetp (a b)
      (let ((result t))
        (dolist (elem a)
          (cond ((not (member elem b))
                 (setf result nil)
                 (return nil))))
        result))

## Description

The 'subsetp' function tests if all elements of 'list1' are contained in 'list2'.

## Examples

Back to Top

Nyquist / XLISP 2.0 - Contents | Tutorials | Examples | Reference