[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: support for functional style
- From: Boyko Bantchev <boykobb@...>
- Date: Sat, 13 Aug 2005 14:03:05 +0300
Hi all,
Are there any plans to provide more support for
functional-style programming in Lua? Lua is
already equipped with anonymous functions and
closures, so the question seems reasonable.
I know of the work being done within the Lua
standard library effort, but I was thinking more
along the lines of syntactic support for function
composition and partial application.
A particularly useful form of the latter seems to
be what is called a `section' in Haskell, or a `bond'
in J.
For those that do not know: a section is a syntax
form for a partially applied operator. Say, (/e) and (e/)
in Haskell are equivalent to
function (x) return x/e end and
function (x) return e/x end in Lua.
Similarly, given, in Haskell, a function f x y
of two arguments x and y, then (`f` y) and (x `f`)
(equivalent to the non-sectioned f x) are sections
of f w.r.t y and x, respectively.