<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Hi,<div class=""><br class=""></div><div class="">What is the return type of a tail-recursive function?</div><div class=""><br class=""></div><div class="">I guess it is a fun(), am I right? (actually I doubt it, but have no idea what the type is)</div><div class=""><br class=""></div><div class="">A strange loop :-)</div><div class=""><br class=""></div><div class="">Please see example as below:</div><div class="">====</div><div class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #7d7ca6" class="">-module</span><span style="font-variant-ligatures: no-common-ligatures" class="">(test).</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255); min-height: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""></span><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(125, 124, 166); background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">-export</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">([</span><span style="font-variant-ligatures: no-common-ligatures; color: #34a327" class="">start/0</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">]).</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(125, 124, 166); background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">-export</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">([</span><span style="font-variant-ligatures: no-common-ligatures; color: #34a327" class="">loop/0</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">]).</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255); min-height: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""></span><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #7d7ca6" class="">-spec</span><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #34a327" class="">start</span><span style="font-variant-ligatures: no-common-ligatures" class="">() -></span><span style="font-variant-ligatures: no-common-ligatures; color: #5e34ff" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #7d7ca6" class="">pid</span><span style="font-variant-ligatures: no-common-ligatures" class="">().</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255); min-height: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""></span><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #5e34ff" class="">start</span><span style="font-variant-ligatures: no-common-ligatures" class="">() -></span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #7d7ca6" class="">spawn</span><span style="font-variant-ligatures: no-common-ligatures" class="">(</span><span style="font-variant-ligatures: no-common-ligatures; color: #d03bff" class="">fun</span><span style="font-variant-ligatures: no-common-ligatures" class="">() -></span><span style="font-variant-ligatures: no-common-ligatures; color: #5e34ff" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #34a327" class="">loop</span><span style="font-variant-ligatures: no-common-ligatures" class="">() </span><span style="font-variant-ligatures: no-common-ligatures; color: #d03bff" class="">end</span><span style="font-variant-ligatures: no-common-ligatures" class="">).</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255); min-height: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""></span><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #7d7ca6" class="">-spec</span><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #34a327" class="">loop</span><span style="font-variant-ligatures: no-common-ligatures" class="">() -></span><span style="font-variant-ligatures: no-common-ligatures; color: #5e34ff" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #d03bff" class="">fun</span><span style="font-variant-ligatures: no-common-ligatures" class="">().</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255); min-height: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""></span><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #5e34ff" class="">loop</span><span style="font-variant-ligatures: no-common-ligatures" class="">() -></span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(208, 59, 255); background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> </span><span style="font-variant-ligatures: no-common-ligatures" class="">receive</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #cd7923" class="">Any</span><span style="font-variant-ligatures: no-common-ligatures" class=""> -></span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #cd7923" class="">Any</span><span style="font-variant-ligatures: no-common-ligatures" class="">,</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #34a327" class="">loop</span><span style="font-variant-ligatures: no-common-ligatures" class="">()</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #d03bff" class="">end</span><span style="font-variant-ligatures: no-common-ligatures" class="">.</span></div></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">====</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><br class=""></span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">Kind Regards,</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">Yao</div></body></html>