Module listx

Authors: Serge Aleynikov (saleyn@gmail.com).

Description

Miscelaneous list functions

Function Index

copy_tuple_except/5Copy every element of tuple TS to tuple TT ignoring the item at Ignore position.
group/2Group elements in the List by element at position Pos.
sum/1Add every positional element of each tuple in the list.
sum/2Add every positional element of two tuples.
zip_record/2Convert a record/tuple to a list of {Name,Value} pairs, where Name is a field name taken from the Fields list.

Function Details

copy_tuple_except/5

copy_tuple_except(Ignore, I, N, TS, TT) -> any()

Copy every element of tuple TS to tuple TT ignoring the item at Ignore position

group/2

group(Pos :: integer(), List :: [tuple()]) -> [{any(), tuple()}]

Group elements in the List by element at position Pos.

sum/1

sum(ListOfTuples) -> any()

Add every positional element of each tuple in the list. E.g. sum([{1,2}, {3,4}, {5,6}]) -> {9,12}.

sum/2

sum(Tuple1, Tuple2) -> any()

Add every positional element of two tuples. E.g. sum({1,2}, {3,4}) -> {3,6}.

zip_record/2

zip_record(Fields :: list(), State :: tuple()) -> list()

Convert a record/tuple to a list of {Name,Value} pairs, where Name is a field name taken from the Fields list.