Talk:Scheme (programming language): Difference between revisions

Content deleted Content added
El oso (talk | contribs)
cryptic tail-recursive factorial example
cryptic tail-recursive factorial example: On named LET and tail recursion
Line 68:
 
I don't know the specifics of the rest of the discussion, but I really liked the article aside from these rough edges, Good Job!!
 
:The "named <CODE>let</CODE>" form sets up a local subroutine, here called <CODE>loop</CODE>. This routine has two local variables, called <CODE>fact</CODE> and <CODE>n</CODE>. (I'd call them <CODE>total</CODE> and <CODE>iter</CODE> or some such, but whatever.) Inside this subroutine, you can think of a tail-call to <CODE>loop</CODE> as just a GOTO back up to the top of the named <CODE>let</CODE>, only with these variables modified.
 
:One of the lessons to learn from Scheme is that if you can assume tail-call optimization, then a tail-recursive call is just a GOTO with arguments, and is just as efficient (while still being a lot more readable). --[[User:Fubar Obfusco|FOo]] 05:23, 21 Jun 2005 (UTC)