Skip to main content
Module

x/ramda/symmetricDifference.js

:ram: Practical functional Javascript
Go to Latest
File
import _curry2 from './internal/_curry2';import concat from './concat';import difference from './difference';

/** * Finds the set (i.e. no duplicates) of all elements contained in the first or * second list, but not both. * * @func * @memberOf R * @since v0.19.0 * @category Relation * @sig [*] -> [*] -> [*] * @param {Array} list1 The first list. * @param {Array} list2 The second list. * @return {Array} The elements in `list1` or `list2`, but not both. * @see R.symmetricDifferenceWith, R.difference, R.differenceWith * @example * * R.symmetricDifference([1,2,3,4], [7,6,5,4,3]); //=> [1,2,7,6,5] * R.symmetricDifference([7,6,5,4,3], [1,2,3,4]); //=> [7,6,5,1,2] */var symmetricDifference = _curry2(function symmetricDifference(list1, list2) { return concat(difference(list1, list2), difference(list2, list1));});export default symmetricDifference;