lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


|> From: KHMan <keinhong@gmail.com>
|> Subject: Re: 
|> 
|> XenoLiz wrote:
|> > On the contentious issue(problem) of lambda function can 
|> look imposing 
|> > new keyword:
|> > Lua :
|> >     local local_f = function(x,y) return 
|> local_f(x)+local_f(y) end --- 
|> > not work
|> >     local local_g
|> >     local_g = function(x,y) return local_g(x)+local_g(y) 
|> end  -- it`s 
|> > half decision
|> >  
|> > Lua_New:
|> >     local local_f = function(x,y) return *lambda*(self, 
|> > x)+*lambda*(self, y) end
|> >     a={ __main=function(x) return *lambda*(self.super, 
|> x.value) end,
|> > __run=function(x,y) if x>1 then return function(a,b) return 
|> > *lambda:1:*(self, x-1, a) | *lambda:1:*(self, y-1, b) end  
|> return 1/y 
|> > end }
|> >  
|> > or something of this kind
|> 
|> Unnecessary verbiage. The function definition syntax sugar 
|> does this well enough, please read the reference manual again.
|> 
|> --
|> Cheers,
|> Kein-Hong Man (esq.)
|> Kuala Lumpur, Malaysia

About questions you can see into Lua 5.1 Reference Manual $ (2.5.9 -
Function Definitions)
	The statement 
	     local function f () body end
	translates to 
	     local f; f = function () body end
	not to 
	     local f = function () body end
	(This only makes a difference when the body of the function contains
references to f.) 

It`s not unnecessary verbiage. It`s release limitation. And may be resolve
in future. I understand  what its "verbiage", so you can use different
keyword?
[self(...)] may be use to normal call in current Lua, [function(...)] in
this context use as function declaration, others?
May be use "verbiage" better?
I sayd what it`s "dark" question, so you not believe :) Go to light :)))

PS: '*'lambda'*' its bold text only from html, and may be you suggestion
better way?