[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Not / lambda calculus / :)
- From: "XenoLiz" <xenoliz@...>
- Date: Thu, 29 Nov 2007 09:02:43 +0600
|> From: KHMan <keinhong@gmail.com>
|> Subject: Re: Lua Digest, Vol 78, Issue 2
|> To: Lua list <lua@bazar2.conectiva.com.br>
|> Message-ID: <474CD4CA.1080400@gmail.com>
|> Content-Type: text/plain; charset=ISO-8859-1
|>
|> Hi,
|>
|> BTW, for an active list participant like you, it will be easier if
|> you don't receive postings in digest form, otherwise, it's normal
|> to paste the correct subject in the place of the "Lua Digest"
|> thingy. Just go and change your list settings. Also, text postings
|> work best. For an apostrophe, use "'", not a backtick "`". HTH.
Hi,
I am sorry, it's automatic,
|> > |> > 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 }
|> Okay, I don't claim to be an expert or anything, and I've never
|> formally studied lambda calculus. So, anyway...
|>
|> >From the little I know or understand of lambda calculus, it's
|> about anonymous functions. Now, in the above, you seem to be using
|> local_f in a recursive fashion, but I don't understand why you
|> define a function with two arguments and then call it with one
|> argument. For non-math people, Lua syntax support recursive
|> functions just fine. But, really, I'm not exactly sure what you
|> are trying to code in the above example. Perhaps a real, practical
|> example will be better.
It is not LAMBDA trouble, its release trouble only.
In current Lua release have 2 type function:
1) a=function(...)... end - w/o SELF(fields)
2) function a:b() end - w SELF(methods)
To use ?2
a ={}
function a:b() return self end
function a:c() return self end
and anowher (straight) path hasn`t, its Trouble 1
I can`t test its method or field {type(a.b) == "function", :) I can`t type
"type(a:b)" }, its Trouble 2
I can`t type "a.b()", I must type "a:b()", its Trouble 3, so it's no big
problem
If reserve only methods the Lua be simple, regular, so may be more works by
regs moving.
In sample use only methods call with self.
|> As a practical engineer, I sure wouldn't want to maintain code
|> like the above when I can write it in a more simple way. It may be
|> elegant or even beautiful in the eyes of a math person, but well,
|> the average developer will shy away from these things. Given a
|> choice between a programming language that is procedural and one
|> that looks like math, I think the market will choose the former.
May by. Problems in that You can`t say, what Lua set full. You can say,
only, what Lua - simple "Markup Language". In's normal?
|> Yeah, I guess with a syntax for lambda functions, there is no need
|> to explicitly name the function in the body. That's one advantage.
In Lua be only lambda functions, its basis of Lua, they everywhere. Main
chunk - lambda functions, too :)
calm, just calm ;) they peace
|> local f = function(x)
|> if x == 0 then return 0 end
|> return self(x-1)+x
|> end
|> print(f(10))
Into Lua 5.1 Reference Manual you can see this trouble, higher.
local f
f = function(x)
if x == 0 then return 0 end
return f(x-1)+x
end
print(f(10))
|>
|> > PS: '*'lambda'*' its bold text only from html, and may be
|> you suggestion
|> > better way?
|>
|> Old timers prefer straight text, on some other lists (e.g. mingw
|> :-)), people might flame you for using HTML.
No comment, I am not flamer. I am think about language, now I want "Markup
Language", yes. And Lua is beauty. Not perfection there is achievement,
only.
|>
|> --
|> Cheers,
|> Kein-Hong Man (esq.)
|> Kuala Lumpur, Malaysia
Thanks,
For All, too