What is the return type of a tail-recursive function

by by@REDACTED
Thu Feb 13 07:21:33 CET 2020


Hi,

What is the return type of a tail-recursive function?

I guess it is a fun(), am I right? (actually I doubt it, but have no idea what the type is)

A strange loop :-)

Please see example as below:
====
-module(test).

-export([start/0]).
-export([loop/0]).

-spec start() -> pid().

start() ->
    spawn(fun() -> loop() end).

-spec loop() -> fun().

loop() ->
    receive
        Any ->
            Any,
            loop()
    end.
====

Kind Regards,
Yao
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20200213/6ea7d162/attachment.htm>


More information about the erlang-questions mailing list