Bunch v0.1.2 Bunch.TupleList View Source

A bunch of helper functions for manipulating lists of tuples (including keyword lists).

Link to this section Summary

Functions

Maps keys of list using function f

Maps values of list using function f

Link to this section Functions

Link to this function map_keys(list, f) View Source
map_keys([{k1, v}], (k1 -> k2)) :: [{k2, v}]
when k1: any(), k2: any(), v: any()

Maps keys of list using function f.

Example

iex> Bunch.TupleList.map_keys([{1, :a}, {2, :b}], & &1+1)
[{2, :a}, {3, :b}]
Link to this function map_values(list, f) View Source
map_values([{k, v1}], (v1 -> v2)) :: [{k, v2}]
when k: any(), v1: any(), v2: any()

Maps values of list using function f.

Example

iex> Bunch.TupleList.map_values([a: 1, b: 2], & &1+1)
[a: 2, b: 3]