# Module util

- Description
- Data Types
- Function Index
- Function Details

Utility Functions.

Copyright © 2007-2015 Zuse Institute Berlin

Version: $Id$

Authors: Thorsten Schuett (`schuett@zib.de`).

## Description

Utility Functions.

## Data Types

### accumulatorFun()

    accumulatorFun(T, U) = fun((T, U) -> U)

### args()

    args() = [term()]

### erlang_timestamp()

    erlang_timestamp() =
        {MegaSecs :: non_neg_integer(),
         Secs :: 0..999999,
         MicroSecs :: 0..999999}

### repeat_params()

    repeat_params() =
        parallel | collect | {accumulate, accumulatorFun(any(), R), R}

{accumulate, fun, accumulator init value}

### time_utc()

    time_utc() =
        {{1970..10000, 1..12, 1..31}, {0..23, 0..59, 0..59}}

### us_timestamp()

    us_timestamp() = non_neg_integer()

micro seconds since Epoch

## Function Index

'=:<'/2 | Sorts like erlang:'=<'/2 but also defines the order of integers/floats representing the same value.
app_check_running/1 | check if App is allready running.
app_get_env/2 | Get an application environment variable for the 'scalaris' application.
bin_xor/2 |
ceil/1 | Returns the smallest integer not smaller than X.
collect_while/1 |
debug_info/0 |
debug_info/1 |
do_throw/1 |
empty/1 |
escape_quotes/1 | Escapes quotes in the given string.
ets_tables_of/1 |
extint2atom/1 |
extract_from_list_may_not_exist/2 | Extracts a given ItemInfo from an ItemList or returns 'undefined' if there is no such item.
floor/1 | Returns the largest integer not larger than X.
for_to/3 |
for_to_ex/3 |
for_to_ex/4 |
for_to_fold/5 |
gb_trees_foldl/3 | Foldl over gb_trees.
gb_trees_largest_smaller_than/2 | Find the largest key in GBTree that is smaller than Key.
get_linetrace/0 |
get_linetrace/1 |
get_proc_in_vms/1 |
get_stacktrace/0 | Gets the current stack trace.
if_verbose/1 |
if_verbose/2 |
is_unittest/0 | Try to check whether common-test is running.
list_set_nth/3 |
lists_check_min_length/2 | Checks whether the given list is at least the given length long without going through the whole list like erlang:length/1.
lists_index_of/2 | If Element is in List, its index is returned (1..length(List) as in lists:nth/2), otherwise 'not_found'.
lists_keystore2/5 |
lists_partition3/2 |
lists_partition3_feeder/2 |
lists_remove_at_indices/2 |
lists_split/2 | Splits the given list into several partitions, returning a list of parts of the original list.
lists_take/2 | Delete an element from a list (once).
lists_takewith/2 | Delete an element from a list (once) based on a predicate.
lists_takewith_feeder/2 |
log/2 | Logarithm of X to the base of Base.
log1p/1 | More precise version of ln(1+x) for small x.
log1p_feeder/1 |
log2/1 | Logarithm of X to the base of 2.
log2_feeder/1 |
log_feeder/2 |
logged_exec/1 |
make_filename/1 |
map_with_nr/3 | Similar to lists:map/2 but also passes the current number to the fun: `[a, b, c,...]` maps to `[fun(a, StartNr), fun(b, StartNr+1), fun(c, StartNr+2),...]`
map_with_nr_feeder/3 |
max/2 | Variant of erlang:max/2 also taking ?PLUS_INFINITY_TYPE and ?MINUS_INFINITY_TYPE into account, e.g.
min/2 | Variant of erlang:min/2 also taking ?PLUS_INFINITY_TYPE and ?MINUS_INFINITY_TYPE into account, e.g.
minus_all/2 | minus_all(M,N) : { x | x in M and x notin N}.
minus_first/2 | Deletes the first occurrence of each element in Excluded from List.
par_map/2 | Parallel version of lists:map/2.
par_map/3 | Parallel version of lists:map/2 with the possibility to limit the maximum number of processes being spawned.
par_map_feeder/2 |
par_map_feeder/3 |
parallel_run/5 |
pop_randomelem/1 | Removes a random element from the (non-empty!) list and returns the resulting list and the removed element.
pop_randomelem/2 | Removes a random element from the first Size elements of a (non-empty!) list and returns the resulting list and the removed element.
pop_randomsubset/2 | Removes a random subset of Size elements from the given list and returns the resulting list and the removed subset.
pow/2 |
pow1p/2 | Calculates (1 - X^Y) more exactly, especially for X^Y near 1 (only really usefull for 0 < X < 1 - for the rest, use math:pow/2).
pow1p_feeder/2 |
print_bits/2 |
random_subset/2 | Returns a random subset of Size elements from the given list.
randomelem/1 | Returns a random element from the given (non-empty!) list according to a uniform distribution.
randomelem_and_length/1 | Returns a random element from the given (non-empty!) list according to a uniform distribution (also returns the list's length).
readable_utc_time/1 |
readable_utc_time_feeder/1 |
repeat/3 | Sequencial (default) or parallel run of function FUN with arguments ARGS TIMES-fold.
repeat/4 |
round/2 | Rounds a float according to some precision.
rrd_combine_gauge_slots/3 | This function does the same as rrd_combine_timing_slots, but for RRDs of type gauge.
rrd_combine_gauge_slots/4 |
rrd_combine_slots/6 | Accumulates data over RRD slots.
rrd_combine_timing_slots/3 | Combine the last N slots from a dump into one tuple.
rrd_combine_timing_slots/4 |
safe_split/2 | Splits off N elements from List.
sets_equal/2 | Compare two sets for equality.
sets_map/2 |
shuffle/1 | Fisher-Yates shuffling for lists.
sleep_for_ever/0 |
smerge2/2 | Merges two unique sorted lists into a single list.
smerge2/3 | Merges two unique Lte-sorted lists into a single list.
smerge2/4 | Merges two unique Lte-sorted lists into a single list.
smerge2/6 | Merges two unique Lte-sorted lists into a single list.
split_unique/2 | Splits L1 into a list of elements that are not contained in L2, a list of elements that both lists share and a list of elements unique to L2.
split_unique/3 | Splits L1 into a list of elements that are not contained in L2, a list of elements that are equal in both lists (according to the ordering function Lte) and a list of elements unique to L2.
split_unique/4 | Splits L1 into a list of elements that are not contained in L2, a list of elements that are equal in both lists (according to the ordering function Lte) and a list of elements unique to L2.
ssplit_unique/2 | Splits L1 into a list of elements that are not contained in L2, a list of elements that both lists share and a list of elements unique to L2.
ssplit_unique/3 | Splits L1 into a list of elements that are not contained in L2, a list of elements that are equal in both lists (according to the ordering function Lte) and a list of elements unique to L2.
ssplit_unique/4 | Splits L1 into a list of elements that are not contained in L2, a list of elements that are equal in both lists (according to the ordering function Lte) and a list of elements unique to L2.
sublist/3 | A more flexible sublist function than lists:sublist/3.
tc/1 | Measures the execution time (in microseconds) for Fun() (does not catch exceptions as timer:tc/3 in older Erlang versions).
tc/2 | Measures the execution time (in microseconds) for Fun(Args) (does not catch exceptions as timer:tc/3 in older Erlang versions).
tc/3 | Measures the execution time (in microseconds) for an MFA (does not catch exceptions as timer:tc/3 in older Erlang versions).
time_plus_ms/2 |
time_plus_s/2 |
time_plus_us/2 |
timestamp2us/1 | convert os:timestamp() to microsecs See http://erlang.org/pipermail/erlang-questions/2008-December/040368.html.
us2timestamp/1 | convert microsecs to os:timestamp().
wait_for/1 | Executes wait_for/2 with a WaitTime of 10ms.
wait_for/2 | Waits for F/0 to become true and checks every WaitTime Milliseconds.
wait_for_ets_table_to_disappear/2 | Waits for the given ets table to disappear.
wait_for_process_to_die/1 | Waits for the given process (name or pid) to die.
zipfoldl/5 |

## Function Details

### wait_for/1

    wait_for(F :: fun(() -> boolean())) -> ok

Executes wait_for/2 with a WaitTime of 10ms.

### wait_for/2

    wait_for(F :: fun(() -> boolean()), WaitTimeInMs :: pos_integer()) ->
                ok

Waits for F/0 to become true and checks every WaitTime Milliseconds. Uses (send_local_after/2 and receive) or timer:sleep/1 to wait to return control flow to e.g. proto_sched depending on whether the caller is a gen_component or not.

### wait_for_process_to_die/1

    wait_for_process_to_die(Name :: pid() | atom()) -> ok

Waits for the given process (name or pid) to die.

### wait_for_ets_table_to_disappear/2

    wait_for_ets_table_to_disappear(Pid :: pid(),
                                    Table :: ets:tid() | atom()) ->
                                       ok

Waits for the given ets table to disappear.

### ets_tables_of/1

    ets_tables_of(Pid :: pid()) -> [ets:tid() | atom()]

### escape_quotes/1

    escape_quotes(String :: string()) -> string()

Escapes quotes in the given string.

### max/2

    max(X :: any(), B :: any()) -> any()

Variant of erlang:max/2 also taking ?PLUS_INFINITY_TYPE and ?MINUS_INFINITY_TYPE into account, e.g. for comparing keys.

### min/2

    min(X :: any(), B :: any()) -> any()

Variant of erlang:min/2 also taking ?PLUS_INFINITY_TYPE and ?MINUS_INFINITY_TYPE into account, e.g. for comparing keys.

### pow/2

    pow(X :: integer(), Y :: non_neg_integer()) -> integer()

### log_feeder/2

    log_feeder(X :: number(), Base :: number()) ->
                  {number(), number()}

### log/2

    log(X :: number(), Base :: number()) -> float()

Logarithm of X to the base of Base.

### log2_feeder/1

    log2_feeder(X :: number()) -> {number()}

### log2/1

    log2(X :: number()) -> float()

Logarithm of X to the base of 2.

### log1p_feeder/1

    log1p_feeder(X :: number()) -> {number()}

### log1p/1

    log1p(X :: number()) -> float()

More precise version of ln(1+x) for small x.

from: David Goldberg. 1991. What every computer scientist should know about floating-point arithmetic. ACM Comput. Surv. 23, 1 (March 1991), 5-48. DOI=10.1145/103162.103163

### pow1p_feeder/2

    pow1p_feeder(X0 :: float(), Y0 :: float()) ->
                    {X :: float(), Y :: float()}

### pow1p/2

    pow1p(X :: float(), Y :: float()) -> float()

Calculates (1 - X^Y) more exactly, especially for X^Y near 1 (only really usefull for 0 < X < 1 - for the rest, use math:pow/2). Uses the series representation of 1 - X^Y 1-X^Y = sum_(i=1)^infinity (- Y^i * log^i(X) / (i!)) from: Wolfram Alpha for x^y

### floor/1

    floor(X :: number()) -> integer()

Returns the largest integer not larger than X.

### ceil/1

    ceil(X :: number()) -> integer()

Returns the smallest integer not smaller than X.

### logged_exec/1

    logged_exec(Cmd :: string() | atom()) -> ok

### get_stacktrace/0

    get_stacktrace() ->
                      [{Module :: atom(),
                        Function :: atom(),
                        ArityOrArgs :: byte() | [term()]} |
                       {Module :: atom(),
                        Function :: atom(),
                        ArityOrArgs :: byte() | [term()],
                        Sources :: [term()]}]

Gets the current stack trace. Use this method in order to get a stack trace if no exception was thrown.

### get_linetrace/0

    get_linetrace() -> term() | undefined

### get_linetrace/1

    get_linetrace(Pid :: pid()) -> term() | undefined

### do_throw/1

    do_throw(Exception :: term()) -> no_return()

### extract_from_list_may_not_exist/2

    extract_from_list_may_not_exist(List ::
                                        [{Item :: term(),
                                          Info :: any()}],
                                    ItemInfo :: term()) ->
                                       Info :: any() | undefined

Extracts a given ItemInfo from an ItemList or returns 'undefined' if there is no such item.

### minus_all/2

    minus_all(List :: [T], Excluded :: [T]) -> [T]

-     T = any()

minus_all(M,N) : { x | x in M and x notin N}

### minus_first/2

    minus_first(List :: [T], Excluded :: [T]) -> [T]

-     T = any()

Deletes the first occurrence of each element in Excluded from List. Similar to lists:foldl(fun lists:delete/2, NewValue1, ToDel) but more performant for out case.

### get_proc_in_vms/1

    get_proc_in_vms(Proc :: atom()) -> [comm:mypid()]

### sleep_for_ever/0

    sleep_for_ever() -> no_return()

### randomelem/1

    randomelem(List :: [X, ...]) -> X

-     X = any()

Returns a random element from the given (non-empty!) list according to a uniform distribution.

### randomelem_and_length/1

    randomelem_and_length(List :: [X, ...]) ->
                             {X, Length :: pos_integer()}

-     X = any()

Returns a random element from the given (non-empty!) list according to a uniform distribution (also returns the list's length).

### pop_randomelem/1

    pop_randomelem(List :: [X, ...]) ->
                      {NewList :: [X], PoppedElement :: X}

-     X = any()

Removes a random element from the (non-empty!) list and returns the resulting list and the removed element.

### pop_randomelem/2

    pop_randomelem(List :: [X, ...], Size :: non_neg_integer()) ->
                      {NewList :: [X], PoppedElement :: X}

-     X = any()

Removes a random element from the first Size elements of a (non-empty!) list and returns the resulting list and the removed element. If Size is 0, the first element will be popped. Size must not exceed the length of the list!

### pop_randomsubset/2

    pop_randomsubset(Size :: pos_integer(), X :: [X]) ->
                        {NewList :: [X], PoppedSet :: [X]}

-     X = any()

Removes a random subset of Size elements from the given list and returns the resulting list and the removed subset. If Size is larger than the list length, all elements will be returned (in random order).

### random_subset/2

    random_subset(Size :: pos_integer(), T :: [T]) -> [T]

-     T = any()

Returns a random subset of Size elements from the given list.

### shuffle/1

    shuffle(T :: [T]) -> [T]

-     T = any()

Fisher-Yates shuffling for lists.

### gb_trees_largest_smaller_than/2

    gb_trees_largest_smaller_than(Key,
                                  X2 :: gb_trees:tree(Key, Value)) ->
                                     {value, Key, Value} | nil

-     Key = any()

-     Value = any()

Find the largest key in GBTree that is smaller than Key. Note: gb_trees offers only linear traversal or lookup of exact keys - we implement a more flexible binary search here despite gb_tree being defined as opaque.

### gb_trees_foldl/3

    gb_trees_foldl(F :: fun((Key, Value, Acc) -> Acc),
                   Acc,
                   GBTree :: gb_trees:tree(Key, Value)) ->
                      Acc

-     Acc = any()

-     Key = any()

-     Value = any()

Foldl over gb_trees.

### tc/3

    tc(M :: module(), F :: atom(), A :: list()) -> {integer(), term()}

Measures the execution time (in microseconds) for an MFA (does not catch exceptions as timer:tc/3 in older Erlang versions).

### tc/2

    tc(Fun :: function(), Args :: list()) -> {integer(), term()}

Measures the execution time (in microseconds) for Fun(Args) (does not catch exceptions as timer:tc/3 in older Erlang versions).

### tc/1

    tc(Fun :: function()) -> {integer(), term()}

Measures the execution time (in microseconds) for Fun() (does not catch exceptions as timer:tc/3 in older Erlang versions).

### zipfoldl/5

    zipfoldl(ZipFun :: fun((X, Y) -> Z),
             FoldFun :: fun((Z, Acc) -> Acc),
             L1 :: [X],
             L2 :: [Y],
             Acc) ->
                Acc

### '=:<'/2

    '=:<'(T, T) -> boolean()

-     T = any()

Sorts like erlang:'=<'/2 but also defines the order of integers/floats representing the same value.

### safe_split/2

    safe_split(N :: non_neg_integer(), T :: [T]) ->
                  {FirstN :: [T], Rest :: [T]}

-     T = any()

Splits off N elements from List. If List is not large enough, the whole list is returned.

### split_unique/2

    split_unique(L1 :: [X], L2 :: [X]) ->
                    {UniqueL1 :: [X], Shared :: [X], UniqueL2 :: [X]}

-     X = any()

Splits L1 into a list of elements that are not contained in L2, a list of elements that both lists share and a list of elements unique to L2. Returned lists are sorted and contain no duplicates.

### split_unique/3

    split_unique(L1 :: [X],
                 L2 :: [X],
                 Lte :: fun((X, X) -> boolean())) ->
                    {UniqueL1 :: [X], Shared :: [X], UniqueL2 :: [X]}

-     X = any()

Splits L1 into a list of elements that are not contained in L2, a list of elements that are equal in both lists (according to the ordering function Lte) and a list of elements unique to L2. When two elements compare equal, the element from List1 is picked. Lte(A, B) should return true if A compares less than or equal to B in the ordering, false otherwise. Returned lists are sorted according to Lte and contain no duplicates.

### split_unique/4

    split_unique(L1 :: [X],
                 L2 :: [X],
                 Lte :: fun((X, X) -> boolean()),
                 EqSelect :: fun((X, X) -> X)) ->
                    {UniqueL1 :: [X], Shared :: [X], UniqueL2 :: [X]}

-     X = any()

Splits L1 into a list of elements that are not contained in L2, a list of elements that are equal in both lists (according to the ordering function Lte) and a list of elements unique to L2. When two elements compare equal, EqSelect(element(L1), element(L2)) chooses which of them to take. Lte(A, B) should return true if A compares less than or equal to B in the ordering, false otherwise. Returned lists are sorted according to Lte and contain no duplicates.

### ssplit_unique/2

    ssplit_unique(L1 :: [X], L2 :: [X]) ->
                     {UniqueL1 :: [X], Shared :: [X], UniqueL2 :: [X]}

-     X = any()

Splits L1 into a list of elements that are not contained in L2, a list of elements that both lists share and a list of elements unique to L2. Both lists must be sorted. Returned lists are sorted as well.

### ssplit_unique/3

    ssplit_unique(L1 :: [X],
                  L2 :: [X],
                  Lte :: fun((X, X) -> boolean())) ->
                     {UniqueL1 :: [X], Shared :: [X], UniqueL2 :: [X]}

-     X = any()

Splits L1 into a list of elements that are not contained in L2, a list of elements that are equal in both lists (according to the ordering function Lte) and a list of elements unique to L2. When two elements compare equal, the element from List1 is picked. Both lists must be sorted according to Lte. Lte(A, B) should return true if A compares less than or equal to B in the ordering, false otherwise. Returned lists are sorted according to Lte.

### ssplit_unique/4

    ssplit_unique(L1 :: [X],
                  L2 :: [X],
                  Lte :: fun((X, X) -> boolean()),
                  EqSelect :: fun((X, X) -> X)) ->
                     {UniqueL1 :: [X], Shared :: [X], UniqueL2 :: [X]}

-     X = any()

Splits L1 into a list of elements that are not contained in L2, a list of elements that are equal in both lists (according to the ordering function Lte) and a list of elements unique to L2. When two elements compare equal, EqSelect(element(L1), element(L2)) chooses which of them to take. Both lists must be sorted according to Lte. Lte(A, B) should return true if A compares less than or equal to B in the ordering, false otherwise. Returned lists are sorted according to Lte.

### smerge2/2

    smerge2(L1 :: [X], L2 :: [X]) -> MergedList :: [X]

-     X = any()

Merges two unique sorted lists into a single list.

### smerge2/3

    smerge2(L1 :: [X], L2 :: [X], Lte :: fun((X, X) -> boolean())) ->
               MergedList :: [X]

-     X = any()

Merges two unique Lte-sorted lists into a single list.

### smerge2/4

    smerge2(L1 :: [X],
            L2 :: [X],
            Lte :: fun((X, X) -> boolean()),
            EqSelect :: fun((X, X) -> [X])) ->
               MergedList :: [X]

-     X = any()

Merges two unique Lte-sorted lists into a single list.

### smerge2/6

    smerge2(L1 :: [X],
            L2 :: [X],
            Lte :: fun((X, X) -> boolean()),
            EqSelect :: fun((X, X) -> [X]),
            FirstExist :: fun((X) -> [X]),
            SecondExist :: fun((X) -> [X])) ->
               MergedList :: [X]

-     X = any()

Merges two unique Lte-sorted lists into a single list.

### is_unittest/0

    is_unittest() -> boolean()

Try to check whether common-test is running.

### make_filename/1

    make_filename(Name :: [byte()]) -> string()

### app_get_env/2

    app_get_env(Var :: atom(), Default :: T) -> T

-     T = any()

Get an application environment variable for the 'scalaris' application. If the variable is undefined, Default is returned.

### app_check_running/1

    app_check_running(App :: atom()) -> boolean()

check if App is allready running.

### timestamp2us/1

    timestamp2us(X1 :: erlang_timestamp()) -> us_timestamp()

convert os:timestamp() to microsecs See http://erlang.org/pipermail/erlang-questions/2008-December/040368.html

### us2timestamp/1

    us2timestamp(Time :: us_timestamp()) -> erlang_timestamp()

convert microsecs to os:timestamp()

### time_plus_us/2

    time_plus_us(Time :: erlang_timestamp(),
                 Delta_MicroSeconds :: non_neg_integer()) ->
                    erlang_timestamp()

### time_plus_ms/2

    time_plus_ms(Time :: erlang_timestamp(),
                 Delta_MilliSeconds :: non_neg_integer()) ->
                    erlang_timestamp()

### time_plus_s/2

    time_plus_s(Time :: erlang_timestamp(),
                Delta_Seconds :: non_neg_integer()) ->
                   erlang_timestamp()

### readable_utc_time_feeder/1

    readable_utc_time_feeder(X1 :: {0..1000, 0..1000, 0..1000}) ->
                                {erlang_timestamp()}

### readable_utc_time/1

    readable_utc_time(TimeTriple :: erlang_timestamp()) -> tuple()

### for_to_fold/5

    for_to_fold(I :: integer(),
                N :: integer(),
                Fun :: fun((integer()) -> X),
                AccFun :: fun((X, Acc) -> Acc),
                AccIn :: Acc) ->
                   Acc

### for_to/3

    for_to(I :: integer(),
           N :: integer(),
           Fun :: fun((integer()) -> any())) ->
              ok

### for_to_ex/4

    for_to_ex(I :: integer(),
              N :: integer(),
              Fun :: fun((integer()) -> T),
              T :: [T]) ->
                 [T]

### for_to_ex/3

    for_to_ex(I :: integer(),
              N :: integer(),
              Fun :: fun((integer()) -> T)) ->
                 [T]

### map_with_nr_feeder/3

    map_with_nr_feeder(X1 :: 1..2,
                       List :: [number()],
                       StartNr :: integer()) ->
                          {Fun ::
                               fun((number(), integer()) -> number()),
                           List :: [number()],
                           integer()}

### map_with_nr/3

    map_with_nr(F :: fun((A, integer()) -> B),
                List :: [A],
                StartNr :: integer()) ->
                   [B]

-     A = any()

-     B = any()

Similar to lists:map/2 but also passes the current number to the fun: `[a, b, c,...]` maps to `[fun(a, StartNr), fun(b, StartNr+1), fun(c, StartNr+2),...]`

### par_map_feeder/2

    par_map_feeder(X1 :: 1..2, List :: [number()]) ->
                      {Fun :: fun((number()) -> number()),
                       List :: [number()]}

### par_map/2

    par_map(Fun :: fun((A) -> B), List :: [A]) -> [B]

-     A = any()

-     B = any()

Parallel version of lists:map/2. Spawns a new process for each element in the list!

### par_map_feeder/3

    par_map_feeder(FunNr :: 1..2,
                   List :: [number()],
                   MaxThreads :: 1..50) ->
                      {Fun :: fun((number()) -> number()),
                       List :: [number()],
                       1..50}

### par_map/3

    par_map(Fun :: fun((A) -> B),
            List :: [A],
            MaxThreads :: pos_integer()) ->
               [B]

-     A = any()

-     B = any()

Parallel version of lists:map/2 with the possibility to limit the maximum number of processes being spawned.

### lists_take/2

    lists_take(T, T :: [T]) -> [T] | false

-     T = any()

Delete an element from a list (once). When not found, return false.

### lists_takewith_feeder/2

    lists_takewith_feeder(Elem :: T, T :: [T]) ->
                             {fun((T) -> boolean()), [T]}

-     T = any()

### lists_takewith/2

    lists_takewith(Pred :: fun((T) -> boolean()), T :: [T]) ->
                      {T, [T]} | false

-     T = any()

Delete an element from a list (once) based on a predicate. When not found, return false.

### lists_split/2

    lists_split(A :: [A], Partitions :: pos_integer()) -> [[A]]

-     A = any()

Splits the given list into several partitions, returning a list of parts of the original list. Both the parts and their contents are reversed compared to the original list!

### lists_keystore2/5

    lists_keystore2(Key :: term(),
                    NC :: pos_integer(),
                    List :: [tuple()],
                    NS :: pos_integer(),
                    NewValue :: term()) ->
                       [tuple()]

### lists_partition3_feeder/2

    lists_partition3_feeder(X1 :: will_fill_pred, List :: [integer()]) ->
                               {fun((integer()) -> 1..3), [integer()]}

### lists_partition3/2

    lists_partition3(Pred :: fun((Elem :: T) -> 1..3), List :: [T]) ->
                        {Pred1 :: [T], Pred2 :: [T], Pred3 :: [T]}

-     T = any()

### lists_remove_at_indices/2

    lists_remove_at_indices(List :: [any(), ...],
                            Indices :: [non_neg_integer(), ...]) ->
                               [any()]

### sublist/3

    sublist(List :: [X, ...],
            Start :: pos_integer() | neg_integer(),
            Length :: integer()) ->
               {[X], Length :: non_neg_integer()}

-     X = any()

A more flexible sublist function than lists:sublist/3. Extracts a sublist of length Length starting at Start. If Start is negative, we count from the end, e.g. -1 is the last element, -2 the second last. If Length is negative, the sublist is created in reversed direction, e.g. sublist([a,b,c], -1, -2) gets [c, b]. If Start is less than -ListLength and Length is non-negative, it will be set to 1. If Length is negative in this case, an empty sublist will be returned. If Start is greater than ListLength and Length is non-negative, an empty sublist will be returned. If Length is negative in this case, it will be set to ListLength. Note: sublists never wrap between start and end, i.e. sublist([a,b,c], 1, -2) gets []! Examples: * first 10: sublist(L, 1, 10) | sublist(L, 10, -10) (reverse order) * last 10 : sublist(L, -10, 10) | sublist(L, -1, -10) (reverse order)

### lists_index_of/2

    lists_index_of(Element :: T, List :: [T]) ->
                      pos_integer() | not_found

-     T = any()

If Element is in List, its index is returned (1..length(List) as in lists:nth/2), otherwise 'not_found'.

### lists_check_min_length/2

    lists_check_min_length(List :: [any()], I :: non_neg_integer()) ->
                              boolean()

Checks whether the given list is at least the given length long without going through the whole list like erlang:length/1.

### repeat/3

    repeat(Fun :: function(), Args :: args(), Times :: pos_integer()) ->
              ok

Sequencial (default) or parallel run of function FUN with arguments ARGS TIMES-fold. Options as list/propertylist: collect, parallel, accumulate * collect (atom): all results of FUN will returned as a list * accumulate (tuple): {accumulate, accFun, accInit} all results will be accumulated with accFun * parallel (atom): FUN will be called TIMES-fold in parallel. Combination with collect and accumulate is supported.

### repeat/4

    repeat(Fun :: function(),
           Args :: args(),
           Times :: pos_integer(),
           Params :: [repeat_params()]) ->
              ok | any()

### parallel_run/5

    parallel_run(SrcPid :: pid(),
                 Fun :: function(),
                 Args :: args(),
                 DoAnswer :: boolean(),
                 Id :: any()) ->
                    ok

### collect_while/1

    collect_while(GatherFun ::
                      fun((non_neg_integer()) ->
                              {boolean(), T} | boolean())) ->
                     [T]

### list_set_nth/3

    list_set_nth(A :: [A], Pos :: pos_integer(), B) -> [A | B]

-     A = any()

-     B = any()

### debug_info/0

    debug_info() -> [[{string(), string() | number()}]]

### debug_info/1

    debug_info(PidName :: pid()) -> [{string(), term()}]

### empty/1

    empty(X1 :: any()) -> []

### print_bits/2

    print_bits(FormatFun :: fun((string(), [term()]) -> Result),
               Binary :: binary()) ->
                  Result

### if_verbose/1

    if_verbose(String :: string()) -> ok

### if_verbose/2

    if_verbose(String :: string(), Fmt :: list()) -> ok

### bin_xor/2

    bin_xor(Binary1 :: binary(), Binary2 :: binary()) -> binary()

### extint2atom/1

    extint2atom(X :: atom() | integer()) -> atom()

### sets_map/2

    sets_map(Fun :: fun((V) -> X), Set :: sets:set(V)) -> [X]

-     V = any()

-     X = any()

### sets_equal/2

    sets_equal(Set1 :: sets:set(V), Set2 :: sets:set(V)) -> boolean()

-     V = any()

Compare two sets for equality.

### rrd_combine_timing_slots/3

    rrd_combine_timing_slots(DB :: rrd:rrd(),
                             CurrentTS :: erlang_timestamp(),
                             Interval :: non_neg_integer()) ->
                                {Sum :: number(),
                                 SquaresSum :: number(),
                                 Count :: non_neg_integer(),
                                 Min :: number(),
                                 Max :: number()} |
                                undefined

Combine the last N slots from a dump into one tuple. The number of slots to combine is determined by Interval (in us): Take as many slots as needed to look Interval-Epsilon microseconds back into the past.

### rrd_combine_timing_slots/4

    rrd_combine_timing_slots(DB :: rrd:rrd(),
                             CurrentTS :: erlang_timestamp(),
                             Interval :: non_neg_integer(),
                             Epsilon :: non_neg_integer()) ->
                                {Sum :: number(),
                                 SquaresSum :: number(),
                                 Count :: non_neg_integer(),
                                 Min :: number(),
                                 Max :: number()} |
                                undefined

### rrd_combine_gauge_slots/3

    rrd_combine_gauge_slots(DB :: rrd:rrd(),
                            CurrentTS :: erlang_timestamp(),
                            Interval :: non_neg_integer()) ->
                               Value :: number() | undefined

This function does the same as rrd_combine_timing_slots, but for RRDs of type gauge. It sums up slots until enough slots have been read.

### rrd_combine_gauge_slots/4

    rrd_combine_gauge_slots(DB :: rrd:rrd(),
                            CurrentTS :: erlang_timestamp(),
                            Interval :: non_neg_integer(),
                            Epsilon :: non_neg_integer()) ->
                               Value :: number() | undefined

### rrd_combine_slots/6

    rrd_combine_slots(DB :: rrd:rrd(),
                      CurrentTS :: erlang_timestamp(),
                      Interval :: non_neg_integer(),
                      Epsilon :: non_neg_integer(),
                      InitialValue :: fun((rrd:data_type()) -> Acc),
                      UpdateValue ::
                          fun((Acc, rrd:data_type()) -> Acc)) ->
                         term() | undefined

Accumulates data over RRD slots. This function allows to reduce a number of slots into a single accumulator value. The amount of slots is determined by Interval and Epsilon: it reads as many slots as needed to cover the last Interval - Epsilon us.

### round/2

    round(Number :: float(), Precision :: pos_integer()) -> float()

Rounds a float according to some precision

Generated by EDoc, Apr 22 2017, 15:58:21.