Fix typos
This commit is contained in:
parent
4406d56135
commit
8dd7378a75
10 changed files with 42 additions and 42 deletions
|
@ -73,7 +73,7 @@ $ git stash pop
|
||||||
```
|
```
|
||||||
|
|
||||||
You SHOULD use these commands both before working on your patch and before
|
You SHOULD use these commands both before working on your patch and before
|
||||||
submitting the pull request. If conflicts arise it is your responsability
|
submitting the pull request. If conflicts arise it is your responsibility
|
||||||
to deal with them.
|
to deal with them.
|
||||||
|
|
||||||
You MUST create a new branch for your work. First make sure you have
|
You MUST create a new branch for your work. First make sure you have
|
||||||
|
|
|
@ -69,7 +69,7 @@ href="http://www.erlang.org/doc/man/lists.html">lists</a>, making most
|
||||||
list operations parallel. It can operate on each element in parallel,
|
list operations parallel. It can operate on each element in parallel,
|
||||||
for IO-bound operations, on sublists in parallel, for taking advantage
|
for IO-bound operations, on sublists in parallel, for taking advantage
|
||||||
of multi-core machines with CPU-bound operations, and across erlang
|
of multi-core machines with CPU-bound operations, and across erlang
|
||||||
nodes, for parallizing inside a cluster. It handles errors and node
|
nodes, for parallelizing inside a cluster. It handles errors and node
|
||||||
failures. It can be configured, tuned, and tweaked to get optimal
|
failures. It can be configured, tuned, and tweaked to get optimal
|
||||||
performance while minimizing overhead.
|
performance while minimizing overhead.
|
||||||
|
|
||||||
|
@ -77,7 +77,7 @@ Almost all the functions are identical to equivalent functions in
|
||||||
lists, returning exactly the same result, and having both a form with
|
lists, returning exactly the same result, and having both a form with
|
||||||
an identical syntax that operates on each element in parallel and a
|
an identical syntax that operates on each element in parallel and a
|
||||||
form which takes an optional "malt", a specification for how to
|
form which takes an optional "malt", a specification for how to
|
||||||
parallize the operation.
|
parallelize the operation.
|
||||||
|
|
||||||
fold is the one exception, parallel fold is different from linear
|
fold is the one exception, parallel fold is different from linear
|
||||||
fold. This module also include a simple mapreduce implementation, and
|
fold. This module also include a simple mapreduce implementation, and
|
||||||
|
@ -106,7 +106,7 @@ Other languages, have built in support for **Interface** or
|
||||||
**signature** functionality. Java has Interfaces, SML has
|
**signature** functionality. Java has Interfaces, SML has
|
||||||
Signatures. Erlang, though, doesn't currently support this model, at
|
Signatures. Erlang, though, doesn't currently support this model, at
|
||||||
least not directly. There are a few ways you can approximate it. We
|
least not directly. There are a few ways you can approximate it. We
|
||||||
have defined a mechnism called *signatures* and several modules that
|
have defined a mechanism called *signatures* and several modules that
|
||||||
to serve as examples and provide a good set of *dictionary*
|
to serve as examples and provide a good set of *dictionary*
|
||||||
signatures. More information about signatures can be found at
|
signatures. More information about signatures can be found at
|
||||||
[signature](https://github.com/erlware/erlware_commons/blob/master/doc/signatures.md).
|
[signature](https://github.com/erlware/erlware_commons/blob/master/doc/signatures.md).
|
||||||
|
|
|
@ -2,7 +2,7 @@ Signatures
|
||||||
==========
|
==========
|
||||||
|
|
||||||
It often occurs in coding that we need a library, a set of
|
It often occurs in coding that we need a library, a set of
|
||||||
functionaly. Often there are several algorithms that could provide
|
functionally. Often there are several algorithms that could provide
|
||||||
this functionality. However, the code that uses it, either doesn't
|
this functionality. However, the code that uses it, either doesn't
|
||||||
care about the individual algorithm or wishes to delegate choosing
|
care about the individual algorithm or wishes to delegate choosing
|
||||||
that algorithm to some higher level. Lets take the concrete example of
|
that algorithm to some higher level. Lets take the concrete example of
|
||||||
|
@ -26,7 +26,7 @@ characteristics are about as good as that of randomly-built binary
|
||||||
search trees - namely (O log n). So the choice of which to select
|
search trees - namely (O log n). So the choice of which to select
|
||||||
depends very much on memory available, insert/read characteristics,
|
depends very much on memory available, insert/read characteristics,
|
||||||
etc. So delegating the choice to a single point in your code is a very
|
etc. So delegating the choice to a single point in your code is a very
|
||||||
good idea. Unfortunately, in Erlang thats ot so easy to do at the moment.
|
good idea. Unfortunately, in Erlang that's so easy to do at the moment.
|
||||||
|
|
||||||
Other languages, have built in support for this
|
Other languages, have built in support for this
|
||||||
functionality. [Java](http://en.wikipedia.org/wiki/Java_(programming_language))
|
functionality. [Java](http://en.wikipedia.org/wiki/Java_(programming_language))
|
||||||
|
@ -63,7 +63,7 @@ mistakes that you might have made. Tools like
|
||||||
[Dialyzer](http://www.erlang.org/doc/man/dialyzer.html) have just as
|
[Dialyzer](http://www.erlang.org/doc/man/dialyzer.html) have just as
|
||||||
hard a time figuring out the what `ModuleToUse` is pointing to as you
|
hard a time figuring out the what `ModuleToUse` is pointing to as you
|
||||||
do. So they can't give you warnings about potential problems. In fact
|
do. So they can't give you warnings about potential problems. In fact
|
||||||
someone could inadvertantly pass an unexpected function name as
|
someone could inadvertently pass an unexpected function name as
|
||||||
`ModuleToUse` and you would never get any warnings, just an exception
|
`ModuleToUse` and you would never get any warnings, just an exception
|
||||||
at run time.
|
at run time.
|
||||||
|
|
||||||
|
@ -361,7 +361,7 @@ what it looked like.
|
||||||
2>
|
2>
|
||||||
|
|
||||||
So for the direct dict call, we average about 3 mics per call, while
|
So for the direct dict call, we average about 3 mics per call, while
|
||||||
for the Signature Wrapper we average around 4. Thats a 25% cost for
|
for the Signature Wrapper we average around 4. That's a 25% cost for
|
||||||
Signature Wrappers in this example, for a very small number of
|
Signature Wrappers in this example, for a very small number of
|
||||||
calls. Depending on what you are doing that is going to be greater or
|
calls. Depending on what you are doing that is going to be greater or
|
||||||
lesser. In any case, we can see that there is some cost associated
|
lesser. In any case, we can see that there is some cost associated
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
%%% @copyright (C) 2012 Erlware, LLC.
|
%%% @copyright (C) 2012 Erlware, LLC.
|
||||||
%%%
|
%%%
|
||||||
%%% @doc This provides simple output functions for command line apps. You should
|
%%% @doc This provides simple output functions for command line apps. You should
|
||||||
%%% use this to talk to the users if you are wrting code for the system
|
%%% use this to talk to the users if you are writing code for the system
|
||||||
-module(ec_cmd_log).
|
-module(ec_cmd_log).
|
||||||
|
|
||||||
%% Avoid clashing with `error/3` BIF added in Erlang/OTP 24
|
%% Avoid clashing with `error/3` BIF added in Erlang/OTP 24
|
||||||
|
@ -129,7 +129,7 @@ debug(LogState, String) ->
|
||||||
debug(LogState, "~ts~n", [String]).
|
debug(LogState, "~ts~n", [String]).
|
||||||
|
|
||||||
%% @doc log at the debug level given the current log state with a format string
|
%% @doc log at the debug level given the current log state with a format string
|
||||||
%% and argements @see io:format/2
|
%% and arguments @see io:format/2
|
||||||
-spec debug(t(), string(), [any()]) -> ok.
|
-spec debug(t(), string(), [any()]) -> ok.
|
||||||
debug(LogState, FormatString, Args) ->
|
debug(LogState, FormatString, Args) ->
|
||||||
log(LogState, ?EC_DEBUG, colorize(LogState, ?CYAN, false, FormatString), Args).
|
log(LogState, ?EC_DEBUG, colorize(LogState, ?CYAN, false, FormatString), Args).
|
||||||
|
@ -146,7 +146,7 @@ info(LogState, String) ->
|
||||||
info(LogState, "~ts~n", [String]).
|
info(LogState, "~ts~n", [String]).
|
||||||
|
|
||||||
%% @doc log at the info level given the current log state with a format string
|
%% @doc log at the info level given the current log state with a format string
|
||||||
%% and argements @see io:format/2
|
%% and arguments @see io:format/2
|
||||||
-spec info(t(), string(), [any()]) -> ok.
|
-spec info(t(), string(), [any()]) -> ok.
|
||||||
info(LogState, FormatString, Args) ->
|
info(LogState, FormatString, Args) ->
|
||||||
log(LogState, ?EC_INFO, colorize(LogState, ?GREEN, false, FormatString), Args).
|
log(LogState, ?EC_INFO, colorize(LogState, ?GREEN, false, FormatString), Args).
|
||||||
|
@ -163,7 +163,7 @@ error(LogState, String) ->
|
||||||
error(LogState, "~ts~n", [String]).
|
error(LogState, "~ts~n", [String]).
|
||||||
|
|
||||||
%% @doc log at the error level given the current log state with a format string
|
%% @doc log at the error level given the current log state with a format string
|
||||||
%% and argements @see io:format/2
|
%% and arguments @see io:format/2
|
||||||
-spec error(t(), string(), [any()]) -> ok.
|
-spec error(t(), string(), [any()]) -> ok.
|
||||||
error(LogState, FormatString, Args) ->
|
error(LogState, FormatString, Args) ->
|
||||||
log(LogState, ?EC_ERROR, colorize(LogState, ?RED, false, FormatString), Args).
|
log(LogState, ?EC_ERROR, colorize(LogState, ?RED, false, FormatString), Args).
|
||||||
|
@ -178,7 +178,7 @@ warn(LogState, String) ->
|
||||||
warn(LogState, "~ts~n", [String]).
|
warn(LogState, "~ts~n", [String]).
|
||||||
|
|
||||||
%% @doc log at the warn level given the current log state with a format string
|
%% @doc log at the warn level given the current log state with a format string
|
||||||
%% and argements @see io:format/2
|
%% and arguments @see io:format/2
|
||||||
-spec warn(t(), string(), [any()]) -> ok.
|
-spec warn(t(), string(), [any()]) -> ok.
|
||||||
warn(LogState, FormatString, Args) ->
|
warn(LogState, FormatString, Args) ->
|
||||||
log(LogState, ?EC_WARN, colorize(LogState, ?MAGENTA, false, FormatString), Args).
|
log(LogState, ?EC_WARN, colorize(LogState, ?MAGENTA, false, FormatString), Args).
|
||||||
|
@ -243,12 +243,12 @@ format(Log) ->
|
||||||
|
|
||||||
colorize(#state_t{intensity=none}, _, _, Msg) ->
|
colorize(#state_t{intensity=none}, _, _, Msg) ->
|
||||||
Msg;
|
Msg;
|
||||||
%% When it is suposed to be bold and we already have a uppercase
|
%% When it is supposed to be bold and we already have a uppercase
|
||||||
%% (bold color) we don't need to modify the color
|
%% (bold color) we don't need to modify the color
|
||||||
colorize(State, Color, true, Msg) when ?VALID_COLOR(Color),
|
colorize(State, Color, true, Msg) when ?VALID_COLOR(Color),
|
||||||
Color >= $A, Color =< $Z ->
|
Color >= $A, Color =< $Z ->
|
||||||
colorize(State, Color, false, Msg);
|
colorize(State, Color, false, Msg);
|
||||||
%% We're sneaky we can substract 32 to get the uppercase character if we want
|
%% We're sneaky we can subtract 32 to get the uppercase character if we want
|
||||||
%% bold but have a non bold color.
|
%% bold but have a non bold color.
|
||||||
colorize(State, Color, true, Msg) when ?VALID_COLOR(Color) ->
|
colorize(State, Color, true, Msg) when ?VALID_COLOR(Color) ->
|
||||||
colorize(State, Color - 32, false, Msg);
|
colorize(State, Color - 32, false, Msg);
|
||||||
|
|
|
@ -174,7 +174,7 @@ remove(Path, Options) ->
|
||||||
remove(Path) ->
|
remove(Path) ->
|
||||||
remove(Path, []).
|
remove(Path, []).
|
||||||
|
|
||||||
%% @doc indicates witha boolean if the path supplied refers to symlink.
|
%% @doc indicates with a boolean if the path supplied refers to symlink.
|
||||||
-spec is_symlink(file:name()) -> boolean().
|
-spec is_symlink(file:name()) -> boolean().
|
||||||
is_symlink(Path) ->
|
is_symlink(Path) ->
|
||||||
case file:read_link_info(Path) of
|
case file:read_link_info(Path) of
|
||||||
|
@ -252,7 +252,7 @@ mkdir_path(Path) ->
|
||||||
mkdir_p(Path).
|
mkdir_p(Path).
|
||||||
|
|
||||||
|
|
||||||
%% @doc read a file from the file system. Provide UEX exeption on failure.
|
%% @doc read a file from the file system. Provide UEX exception on failure.
|
||||||
-spec read(FilePath::file:filename()) -> {ok, binary()} | {error, Reason::term()}.
|
-spec read(FilePath::file:filename()) -> {ok, binary()} | {error, Reason::term()}.
|
||||||
read(FilePath) ->
|
read(FilePath) ->
|
||||||
%% Now that we are moving away from exceptions again this becomes
|
%% Now that we are moving away from exceptions again this becomes
|
||||||
|
@ -261,7 +261,7 @@ read(FilePath) ->
|
||||||
file:read_file(FilePath).
|
file:read_file(FilePath).
|
||||||
|
|
||||||
|
|
||||||
%% @doc write a file to the file system. Provide UEX exeption on failure.
|
%% @doc write a file to the file system. Provide UEX exception on failure.
|
||||||
-spec write(FileName::file:filename(), Contents::string()) -> ok | {error, Reason::term()}.
|
-spec write(FileName::file:filename(), Contents::string()) -> ok | {error, Reason::term()}.
|
||||||
write(FileName, Contents) ->
|
write(FileName, Contents) ->
|
||||||
%% Now that we are moving away from exceptions again this becomes
|
%% Now that we are moving away from exceptions again this becomes
|
||||||
|
|
|
@ -52,7 +52,7 @@ find(_Fun, []) ->
|
||||||
error.
|
error.
|
||||||
|
|
||||||
%% @doc Fetch a value from the list. If the function returns true the
|
%% @doc Fetch a value from the list. If the function returns true the
|
||||||
%% value is returend. If processing reaches the end of the list and
|
%% value is returned. If processing reaches the end of the list and
|
||||||
%% the function has never returned true an exception not_found is
|
%% the function has never returned true an exception not_found is
|
||||||
%% thrown.
|
%% thrown.
|
||||||
-spec fetch(fun(), list()) -> term().
|
-spec fetch(fun(), list()) -> term().
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
%%% most list operations parallel. It can operate on each element in
|
%%% most list operations parallel. It can operate on each element in
|
||||||
%%% parallel, for IO-bound operations, on sublists in parallel, for
|
%%% parallel, for IO-bound operations, on sublists in parallel, for
|
||||||
%%% taking advantage of multi-core machines with CPU-bound operations,
|
%%% taking advantage of multi-core machines with CPU-bound operations,
|
||||||
%%% and across erlang nodes, for parallizing inside a cluster. It
|
%%% and across erlang nodes, for parallelizing inside a cluster. It
|
||||||
%%% handles errors and node failures. It can be configured, tuned, and
|
%%% handles errors and node failures. It can be configured, tuned, and
|
||||||
%%% tweaked to get optimal performance while minimizing overhead.
|
%%% tweaked to get optimal performance while minimizing overhead.
|
||||||
%%%
|
%%%
|
||||||
|
@ -38,7 +38,7 @@
|
||||||
%%% lists, returning exactly the same result, and having both a form
|
%%% lists, returning exactly the same result, and having both a form
|
||||||
%%% with an identical syntax that operates on each element in parallel
|
%%% with an identical syntax that operates on each element in parallel
|
||||||
%%% and a form which takes an optional "malt", a specification for how
|
%%% and a form which takes an optional "malt", a specification for how
|
||||||
%%% to parallize the operation.
|
%%% to parallelize the operation.
|
||||||
%%%
|
%%%
|
||||||
%%% fold is the one exception, parallel fold is different from linear
|
%%% fold is the one exception, parallel fold is different from linear
|
||||||
%%% fold. This module also include a simple mapreduce implementation,
|
%%% fold. This module also include a simple mapreduce implementation,
|
||||||
|
@ -169,7 +169,7 @@
|
||||||
%%% processes. If one of them does a non-normal exit, plists receives
|
%%% processes. If one of them does a non-normal exit, plists receives
|
||||||
%%% the 'DOWN' message believing it to be from one of its own
|
%%% the 'DOWN' message believing it to be from one of its own
|
||||||
%%% processes. The error propagation system goes into effect, which
|
%%% processes. The error propagation system goes into effect, which
|
||||||
%%% results in the error occuring in the calling process.
|
%%% results in the error occurring in the calling process.
|
||||||
%%%
|
%%%
|
||||||
-module(ec_plists).
|
-module(ec_plists).
|
||||||
|
|
||||||
|
@ -330,14 +330,14 @@ fold(Fun, Fuse, InitAcc, List, Malt) ->
|
||||||
end,
|
end,
|
||||||
runmany(Fun2, Fuse, List, Malt).
|
runmany(Fun2, Fuse, List, Malt).
|
||||||
|
|
||||||
%% @doc Similiar to foreach in module
|
%% @doc Similar to foreach in module
|
||||||
%% <a href="http://www.erlang.org/doc/man/lists.html">lists</a>
|
%% <a href="http://www.erlang.org/doc/man/lists.html">lists</a>
|
||||||
%% except it makes no guarantee about the order it processes list elements.
|
%% except it makes no guarantee about the order it processes list elements.
|
||||||
-spec foreach(fun(), list()) -> ok.
|
-spec foreach(fun(), list()) -> ok.
|
||||||
foreach(Fun, List) ->
|
foreach(Fun, List) ->
|
||||||
foreach(Fun, List, 1).
|
foreach(Fun, List, 1).
|
||||||
|
|
||||||
%% @doc Similiar to foreach in module
|
%% @doc Similar to foreach in module
|
||||||
%% <a href="http://www.erlang.org/doc/man/lists.html">lists</a>
|
%% <a href="http://www.erlang.org/doc/man/lists.html">lists</a>
|
||||||
%% except it makes no guarantee about the order it processes list elements.
|
%% except it makes no guarantee about the order it processes list elements.
|
||||||
-spec foreach(fun(), list(), malt()) -> ok.
|
-spec foreach(fun(), list(), malt()) -> ok.
|
||||||
|
@ -432,8 +432,8 @@ sort(Fun, List) ->
|
||||||
%%
|
%%
|
||||||
%% sort splits the list into sublists and sorts them, and it merges the
|
%% sort splits the list into sublists and sorts them, and it merges the
|
||||||
%% sorted lists together. These are done in parallel. Each sublist is
|
%% sorted lists together. These are done in parallel. Each sublist is
|
||||||
%% sorted in a seperate process, and each merging of results is done in a
|
%% sorted in a separate process, and each merging of results is done in a
|
||||||
%% seperate process. Malt defaults to 100, causing the list to be split into
|
%% separate process. Malt defaults to 100, causing the list to be split into
|
||||||
%% 100-element sublists.
|
%% 100-element sublists.
|
||||||
-spec sort(fun(), list(), malt()) -> list().
|
-spec sort(fun(), list(), malt()) -> list().
|
||||||
sort(Fun, List, Malt) ->
|
sort(Fun, List, Malt) ->
|
||||||
|
@ -464,11 +464,11 @@ usort(Fun, List) ->
|
||||||
%%
|
%%
|
||||||
%% usort splits the list into sublists and sorts them, and it merges the
|
%% usort splits the list into sublists and sorts them, and it merges the
|
||||||
%% sorted lists together. These are done in parallel. Each sublist is
|
%% sorted lists together. These are done in parallel. Each sublist is
|
||||||
%% sorted in a seperate process, and each merging of results is done in a
|
%% sorted in a separate process, and each merging of results is done in a
|
||||||
%% seperate process. Malt defaults to 100, causing the list to be split into
|
%% separate process. Malt defaults to 100, causing the list to be split into
|
||||||
%% 100-element sublists.
|
%% 100-element sublists.
|
||||||
%%
|
%%
|
||||||
%% usort removes duplicate elments while it sorts.
|
%% usort removes duplicate elements while it sorts.
|
||||||
-spec usort(fun(), list(), malt()) -> list().
|
-spec usort(fun(), list(), malt()) -> list().
|
||||||
usort(Fun, List, Malt) ->
|
usort(Fun, List, Malt) ->
|
||||||
Fun2 = fun (L) ->
|
Fun2 = fun (L) ->
|
||||||
|
@ -514,7 +514,7 @@ mapreduce(MapFunc, List, MapMalt) ->
|
||||||
%% reducer's final state.
|
%% reducer's final state.
|
||||||
%%
|
%%
|
||||||
%% MapMalt is the malt for the mapping operation, with a default value of 1,
|
%% MapMalt is the malt for the mapping operation, with a default value of 1,
|
||||||
%% meaning each element of the list is mapped by a seperate process.
|
%% meaning each element of the list is mapped by a separate process.
|
||||||
%%
|
%%
|
||||||
%% mapreduce requires OTP R11B, or it may leave monitoring messages in the
|
%% mapreduce requires OTP R11B, or it may leave monitoring messages in the
|
||||||
%% message queue.
|
%% message queue.
|
||||||
|
@ -586,7 +586,7 @@ add_key(Dict, Key, Value) ->
|
||||||
end.
|
end.
|
||||||
|
|
||||||
%% @doc Like below, but assumes a Malt of 1,
|
%% @doc Like below, but assumes a Malt of 1,
|
||||||
%% meaning each element of the list is processed by a seperate process.
|
%% meaning each element of the list is processed by a separate process.
|
||||||
-spec runmany(fun(), fuse(), list()) -> term().
|
-spec runmany(fun(), fuse(), list()) -> term().
|
||||||
runmany(Fun, Fuse, List) ->
|
runmany(Fun, Fuse, List) ->
|
||||||
runmany(Fun, Fuse, List, 1).
|
runmany(Fun, Fuse, List, 1).
|
||||||
|
@ -615,7 +615,7 @@ runmany(Fun, Fuse, List) ->
|
||||||
%% continues fusing pairs of results until it is down to one.
|
%% continues fusing pairs of results until it is down to one.
|
||||||
%%
|
%%
|
||||||
%% Recursive fuse is down in parallel with processing the sublists, and a
|
%% Recursive fuse is down in parallel with processing the sublists, and a
|
||||||
%% process is spawned to fuse each pair of results. It is a parallized
|
%% process is spawned to fuse each pair of results. It is a parallelized
|
||||||
%% algorithm. Linear fuse is done after all results of processing sublists
|
%% algorithm. Linear fuse is done after all results of processing sublists
|
||||||
%% have been collected, and can only run in a single process.
|
%% have been collected, and can only run in a single process.
|
||||||
%%
|
%%
|
||||||
|
@ -691,7 +691,7 @@ runmany(Fun, {recursive, Fuse}, List, local, Split, []) ->
|
||||||
%% or {nodes, NodeList}. Degenerates recursive fuse into linear fuse.
|
%% or {nodes, NodeList}. Degenerates recursive fuse into linear fuse.
|
||||||
runmany(Fun, Fuse, List, local, Split, []);
|
runmany(Fun, Fuse, List, local, Split, []);
|
||||||
runmany(Fun, Fuse, List, Nodes, no_split, []) ->
|
runmany(Fun, Fuse, List, Nodes, no_split, []) ->
|
||||||
%% by default, operate on each element seperately
|
%% by default, operate on each element separately
|
||||||
runmany(Fun, Fuse, List, Nodes, 1, []);
|
runmany(Fun, Fuse, List, Nodes, 1, []);
|
||||||
runmany(Fun, Fuse, List, local, Split, []) ->
|
runmany(Fun, Fuse, List, local, Split, []) ->
|
||||||
List2 = splitmany(List, Split),
|
List2 = splitmany(List, Split),
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
%%% representation of a dictionary, where a red-black tree is used to
|
%%% representation of a dictionary, where a red-black tree is used to
|
||||||
%%% store the keys and values.
|
%%% store the keys and values.
|
||||||
%%%
|
%%%
|
||||||
%%% This module implents exactly the same interface as the module
|
%%% This module implements exactly the same interface as the module
|
||||||
%%% ec_dictionary but with a defined representation. One difference is
|
%%% ec_dictionary but with a defined representation. One difference is
|
||||||
%%% that while dict considers two keys as different if they do not
|
%%% that while dict considers two keys as different if they do not
|
||||||
%%% match (=:=), this module considers two keys as different if and
|
%%% match (=:=), this module considers two keys as different if and
|
||||||
|
@ -296,7 +296,7 @@ to_list(empty, List) -> List;
|
||||||
to_list({_, A, Xk, Xv, B}, List) ->
|
to_list({_, A, Xk, Xv, B}, List) ->
|
||||||
to_list(A, [{Xk, Xv} | to_list(B, List)]).
|
to_list(A, [{Xk, Xv} | to_list(B, List)]).
|
||||||
|
|
||||||
%% Balance a tree afer (possibly) adding a node to the left/right.
|
%% Balance a tree after (possibly) adding a node to the left/right.
|
||||||
-spec lbalance(color(), dictionary(K, V),
|
-spec lbalance(color(), dictionary(K, V),
|
||||||
ec_dictionary:key(K), ec_dictionary:value(V),
|
ec_dictionary:key(K), ec_dictionary:value(V),
|
||||||
dictionary(K, V)) ->
|
dictionary(K, V)) ->
|
||||||
|
|
|
@ -202,13 +202,13 @@ pes(VsnA, VsnB) ->
|
||||||
%%%===================================================================
|
%%%===================================================================
|
||||||
%%% Friend Functions
|
%%% Friend Functions
|
||||||
%%%===================================================================
|
%%%===================================================================
|
||||||
%% @doc helper function for the peg grammer to parse the iolist into a semver
|
%% @doc helper function for the peg grammar to parse the iolist into a semver
|
||||||
-spec internal_parse_version(iolist()) -> semver().
|
-spec internal_parse_version(iolist()) -> semver().
|
||||||
internal_parse_version([MMP, AlphaPart, BuildPart, _]) ->
|
internal_parse_version([MMP, AlphaPart, BuildPart, _]) ->
|
||||||
{parse_major_minor_patch_minpatch(MMP), {parse_alpha_part(AlphaPart),
|
{parse_major_minor_patch_minpatch(MMP), {parse_alpha_part(AlphaPart),
|
||||||
parse_alpha_part(BuildPart)}}.
|
parse_alpha_part(BuildPart)}}.
|
||||||
|
|
||||||
%% @doc helper function for the peg grammer to parse the iolist into a major_minor_patch
|
%% @doc helper function for the peg grammar to parse the iolist into a major_minor_patch
|
||||||
-spec parse_major_minor_patch_minpatch(iolist()) -> major_minor_patch_minpatch().
|
-spec parse_major_minor_patch_minpatch(iolist()) -> major_minor_patch_minpatch().
|
||||||
parse_major_minor_patch_minpatch([MajVsn, [], [], []]) ->
|
parse_major_minor_patch_minpatch([MajVsn, [], [], []]) ->
|
||||||
strip_maj_version(MajVsn);
|
strip_maj_version(MajVsn);
|
||||||
|
@ -224,7 +224,7 @@ parse_major_minor_patch_minpatch([MajVsn,
|
||||||
[<<".">>, MinPatch]]) ->
|
[<<".">>, MinPatch]]) ->
|
||||||
{strip_maj_version(MajVsn), MinVsn, PatchVsn, MinPatch}.
|
{strip_maj_version(MajVsn), MinVsn, PatchVsn, MinPatch}.
|
||||||
|
|
||||||
%% @doc helper function for the peg grammer to parse the iolist into an alpha part
|
%% @doc helper function for the peg grammar to parse the iolist into an alpha part
|
||||||
-spec parse_alpha_part(iolist()) -> [alpha_part()].
|
-spec parse_alpha_part(iolist()) -> [alpha_part()].
|
||||||
parse_alpha_part([]) ->
|
parse_alpha_part([]) ->
|
||||||
[];
|
[];
|
||||||
|
|
|
@ -75,7 +75,7 @@ ask(Prompt) ->
|
||||||
ask_default(Prompt, Default) ->
|
ask_default(Prompt, Default) ->
|
||||||
ask_convert(Prompt, fun get_string/1, string, Default).
|
ask_convert(Prompt, fun get_string/1, string, Default).
|
||||||
|
|
||||||
%% @doc Asks the user to respond to the prompt. Trys to return the
|
%% @doc Asks the user to respond to the prompt. Tries to return the
|
||||||
%% value in the format specified by 'Type'.
|
%% value in the format specified by 'Type'.
|
||||||
-spec ask(prompt(), type()) -> supported().
|
-spec ask(prompt(), type()) -> supported().
|
||||||
ask(Prompt, boolean) ->
|
ask(Prompt, boolean) ->
|
||||||
|
@ -85,7 +85,7 @@ ask(Prompt, number) ->
|
||||||
ask(Prompt, string) ->
|
ask(Prompt, string) ->
|
||||||
ask_convert(Prompt, fun get_string/1, string, none).
|
ask_convert(Prompt, fun get_string/1, string, none).
|
||||||
|
|
||||||
%% @doc Asks the user to respond to the prompt. Trys to return the
|
%% @doc Asks the user to respond to the prompt. Tries to return the
|
||||||
%% value in the format specified by 'Type'.
|
%% value in the format specified by 'Type'.
|
||||||
-spec ask_default(prompt(), type(), supported()) -> supported().
|
-spec ask_default(prompt(), type(), supported()) -> supported().
|
||||||
ask_default(Prompt, boolean, Default) ->
|
ask_default(Prompt, boolean, Default) ->
|
||||||
|
@ -145,7 +145,7 @@ ask_convert(Prompt, TransFun, Type, Default) ->
|
||||||
Ret
|
Ret
|
||||||
end.
|
end.
|
||||||
|
|
||||||
%% @doc Trys to translate the result into a boolean
|
%% @doc Tries to translate the result into a boolean
|
||||||
-spec get_boolean(string()) -> boolean().
|
-spec get_boolean(string()) -> boolean().
|
||||||
get_boolean([]) ->
|
get_boolean([]) ->
|
||||||
no_data;
|
no_data;
|
||||||
|
@ -172,7 +172,7 @@ get_boolean([$N | _]) ->
|
||||||
get_boolean(_) ->
|
get_boolean(_) ->
|
||||||
no_clue.
|
no_clue.
|
||||||
|
|
||||||
%% @doc Trys to translate the result into an integer
|
%% @doc Tries to translate the result into an integer
|
||||||
-spec get_integer(string()) -> integer().
|
-spec get_integer(string()) -> integer().
|
||||||
get_integer([]) ->
|
get_integer([]) ->
|
||||||
no_data;
|
no_data;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue