lua-users home
lua-l archive

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




On 2017-04-27 04:00 PM, Russell Haley wrote:
On Thu, Apr 27, 2017 at 11:39 AM, Soni L. <fakedme@gmail.com> wrote:

On 2017-04-27 03:12 PM, Egor Skriptunoff wrote:
On Thu, Apr 27, 2017 at 8:59 PM, Soni L. <fakedme@gmail.com
<mailto:fakedme@gmail.com>> wrote:


     You need to use select() if you want multiple return values.


That's awkward.
local function nop(...) = select(1, ...)

local function swap(a,b) = nop(b,a)

It's the best way to add lambdas without introducing wildly different
syntax.


--
Disclaimer: these emails may be made public at any given time, with or
without reason. If you don't agree with this, DO NOT REPLY.


I was just contemplating how one would add a linq like feature to Lua
for searching and returning result sets as tables without having to
write iterators. This syntax would solve that problem quite nicely,
wouldn't it? However, would that mean the need to add other functions
like where(), join() and similar 'SQL like' concepts?

Russ


... Linq?

Anyway, a DSL for SQL queries in Lua sounds awesome. I guess this "lambda syntax" I proposed would do for some impressive DSLs.

--
Disclaimer: these emails may be made public at any given time, with or without reason. If you don't agree with this, DO NOT REPLY.