[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Multiple indexing (was: 'in' keyword today)
- From: Javier Guerra Giraldez <javier@...>
- Date: Thu, 10 Apr 2014 02:45:40 -0500
On Thu, Apr 10, 2014 at 2:38 AM, steve donovan
<steve.j.donovan@gmail.com> wrote:
> Given f() that returns multiple values, is t[f()] intended to access
> all those values? Because then we have the classic
> propagation-of-multiple-values problem that gave you such grief with
> string.gsub.
I'd say yes, just like g(f()), where g() gets all return values from
f(). if you want just the first, you have to do g((f())).
specifically, if f() returns 1,2,3:
t[f()] => t[1,2,3] -- like g(f())
t[(f())] = t[1] -- like g((f()))
t[f(),4] => t[1,4] -- like g(f(),4)
t[5,f()] => f[5,1,2,3] -- like g(4,f())
t[f(),f()] => t[1,1,2,3] -- like g(f(),f())
--
Javier