tensor v0.7.0 Tensor.Helper
Summary
Functions
Returns the keywise difference of two maps.
So: Only the part of map_a
is returned that has keys not in map_b
Returns the keywise difference of two maps.
So: Only the part of map_a
is returned that has keys also in map_b
Puts val
under map
inside a nested map indicated with keys
.
This is required, as the normal put_in
will fail if one of the levels
indicated by keys
is not initialized to a map yet
Swaps the element at position pos_a
with the element at position pos_b
inside a list
Functions
Returns the keywise difference of two maps.
So: Only the part of map_a
is returned that has keys not in map_b
.
Examples:
iex> Tensor.Helper.map_difference(%{a: 1, b: 2, c: 3, d: 4}, %{b: 3, d: 5})
%{a: 1, c: 3}
Returns the keywise difference of two maps.
So: Only the part of map_a
is returned that has keys also in map_b
.
Examples:
iex> Tensor.Helper.map_intersection(%{a: 1, b: 2, c: 3, d: 4}, %{b: 3, d: 5})
%{b: 2, d: 4}
Puts val
under map
inside a nested map indicated with keys
.
This is required, as the normal put_in
will fail if one of the levels
indicated by keys
is not initialized to a map yet.
Examples:
iex>put_in_path(%{}, [1,2,3], 4) %{1 => %{2 => %{3 => 4}}}