Packages

This is an effort to try and replicate some of the NumPy modules in elixir-lang.

Current section

Files

Jump to
num_ex lib SetRoutines.ex
Raw

lib/SetRoutines.ex

defmodule SetRoutines do
@moduledoc"""
A module to perform some missing set operations
"""
@doc"""
Takes two enumerables, returns a MapSet by performing set exclusive-or on them, element-wise.
## Examples
iex> SetRoutines.setxor1d([1,2,3,2,4],[2,3,5,7,5])
#MapSet<[1, 4, 5, 7]>
"""
@spec setxor1d([integer], [integer]) :: [integer]
def setxor1d(arr1, arr2) do
x = MapSet.new(arr1)
y = MapSet.new(arr2)
MapSet.difference(MapSet.union(x, y), MapSet.intersection(x, y))
end
end