smallex v0.1.7 MapList
Map list library.
Link to this section Summary
Functions
Outer join keys to map-list on same key-value pair from another
Inner join keys to map-list on same key-value pair from another
Zip two lists to map( key => value style)
Zip two lists to map( key: value style)
Link to this section Functions
Link to this function
find(map_list, match_map, match_key)
Link to this function
make_empty_map_without_key(map_list, match_key, no_match_value)
Link to this function
merge(base_map_list, add_map_list, match_key, no_match_value)
Outer join keys to map-list on same key-value pair from another
Examples
iex> MapList.merge( [ %{ "a" => "key1", "b" => 12 }, %{ "a" => "key2", "b" => 22 } ], [ %{ "a" => "key1", "c" => 13 }, %{ "a" => "key3", "c" => 23 } ], "a", "no_match" )
[ %{ "a" => "key1", "b" => 12, "c" => 13 }, %{ "a" => "key2", "b" => 22, "c" => "no_match" } ]
Link to this function
no_match(base_map_list, match_map_list, match_key)
Link to this function
replace(base_map_list, add_map_list, match_key)
Inner join keys to map-list on same key-value pair from another
Examples
iex> MapList.replace( [ %{ "a" => "key1", "b" => 12 }, %{ "a" => "key2", "b" => 22 } ], [ %{ "a" => "key1", "c" => 13 }, %{ "a" => "key3", "c" => 23 } ], "a" )
[ %{ "a" => "key1", "b" => 12, "c" => 13 }, %{ "a" => "key2", "b" => 22 } ]
Link to this function
zip(list1, list2)
Zip two lists to map( key => value style)
Examples
iex> MapList.zip( [ "a", "b", "c" ], [ 1, 2, 3 ] )
%{ "a" => 1, "b" => 2, "c" => 3 }
Link to this function
zip_atom(list1, list2)
Zip two lists to map( key: value style)
Examples
iex> MapList.zip_atom( [ "a", "b", "c" ], [ 1, 2, 3 ] )
%{ a: 1, b: 2, c: 3 }