[prev in list] [next in list] [prev in thread] [next in thread] 

List:       lua-l
Subject:    Re: Self-awareness of functions?
From:       <jgiors () threeeyessoftware ! com>
Date:       2010-12-31 4:58:24
Message-ID: 20101230215824.1f05e918426bb2e3d00030bbd04c88bd.06370f4ae9.wbe () email06 ! secureserver ! net
[Download RAW message or body]

> -------- Original Message --------
> Date: Thu, 30 Dec 2010 23:27:35 +0200
> From: Dirk Laurie <dpl@sun.ac.za>
> Subject: Re: Self-awareness of functions?
> To: Lua mailing list <lua-l@lists.lua.org>
> Message-ID: <20101230212735.GC6428@rondloper>
> Content-Type: text/plain; charset=us-ascii
> 
> On Thu, Dec 30, 2010 at 10:37:41PM +0200, jgiors@threeeyessoftware.com wrote:
> > What Steve wrote had a typo (missing keyword "then"), but was 
> > otherwise correct. It should have been this:
> > 
> > local fact
> > function fact(n)
> >     if n == 2 then return 2 else return n*fact(n-1) end
> > end
> > 
> Alas, no.  Try that code for n=0 and n=1.

Yes, I had noticed that, but didn't think it worth mentioning given the
topic of local recursive functions.

> The rest of your post deals with things that others have already
> responded to.
> 
> Dirk

I reviewed the posts in the archive and see that your initial example
has the do...end wrap (to make it work in the console). I had forgotten
it and misinterpreted your reply to Steve.

John Giors
Independent Programmer
Three Eyes Software
jgiors@ThreeEyesSoftware.com
http://ThreeEyesSoftware.com




[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic