listx (util v1.3.5)

View Source

Miscelaneous list functions

Author: Serge Aleynikov saleyn@gmail.com

Summary

Functions

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

Group elements in the List by element at position Pos.

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

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

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

Functions

copy_tuple_except/5

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

group(Pos, List)

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

Group elements in the List by element at position Pos.

sum/1

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

sum(Tuple1, Tuple2)

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

zip_record(Fields, State)

-spec zip_record(list(), tuple()) -> list().

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