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

intersection


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

Syntax

(intersection list1 list2)
listN - a list of symbols or numbers
returns - the intersection of list1 and list2

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

(defun intersection (a b)
  (let (result)
    (dolist (elem a)
      (if (member elem b) (push elem result)))
    result))

Description

The 'intersection' function computes the intersection of two lists.

Examples


  Back to Top


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