[erlang-questions] Efficiency of a list construction
Kannan
vasdeveloper@REDACTED
Fri May 20 13:28:43 CEST 2011
I saw this function in gen_sctp_SUITE.erl :-(
On Fri, May 20, 2011 at 4:20 PM, Vance Shipley <vances@REDACTED> wrote:
> Kannan,
>
> No, it is not tail recursive. This is:
>
> %% @spec() -> [term()]
> %%
> flush() ->
> flush([]).
>
> %% @hidden
> flush(Msgs) ->
> receive
> Msg ->
> flush([Msg | Msgs]);
> after 17 ->
> Msgs
> end.
>
> On Fri, May 20, 2011 at 03:45:19PM +0530, Kannan wrote:
> } Is the following list construction an efficient one?
> }
> } flush() ->
> } receive
> } Msg ->
> } [Msg|flush()]
> } after 17 ->
> } []
> } end.
>
> --
> -Vance
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20110520/52665c86/attachment.htm>
More information about the erlang-questions
mailing list