Article:
 |
|
An Introduction to Erlang
|
| Subject: |
|
Recursion? Goto? |
| Date: |
|
2007-12-21 18:20:52 |
| From: |
|
rickhg12hs
|
Response to: Recursion? Goto?
|
|
Thanks for the response.
I'll have to learn more about Erlang and how it does recursion. Seems like after some enormous number of messages, the chat system would run out of memory by the ever increasing stack ... so I guess that's not how Erlang handles it. Very interesting.
|
Showing messages 1 through 1 of 1.
-
Recursion? Goto?
2008-01-09 21:19:11
MattKangas
[View]
To quote the book ("Programming In Erlang", pp.149)
"A tail-recursive function can be compiled so that the last function call in a sequence of statements can be replaced by a single jump to the start of the function being called. This means that a tail-recursive function can loop forever without consuming stack space."
This is standard behavior for functional languages like Erlang, Scheme, Lisp, et al.