Lambda again: unnamed arguments
Hello, inspired by Greg's post about ideas on making the lambda syntax more concise, like: x,y => x+y I was wondering if using unnamed arguments had already been debated. Something like: \(_1+_2) where basically you're declaring implicitally declaring that your lambda takes two arguments. You wouldn't be able to call them through keyword arguments, nor to accept a variable number of arguments (nor to accept more arguments than they are actually used), but wouldn't it cover most use cases and be really compact? Other examples: k.sort(key=\(_1.foo)) k.sort(key=\(_1[0])) -- Giovanni Bajo
On Thu, Mar 27, 2008 at 4:25 AM, Giovanni Bajo <rasky@develer.com> wrote:
Hello,
inspired by Greg's post about ideas on making the lambda syntax more concise, like:
x,y => x+y
I was wondering if using unnamed arguments had already been debated. Something like:
\(_1+_2)
where basically you're declaring implicitally declaring that your lambda takes two arguments. You wouldn't be able to call them through keyword arguments, nor to accept a variable number of arguments (nor to accept more arguments than they are actually used), but wouldn't it cover most use cases and be really compact?
Other examples:
k.sort(key=\(_1.foo)) k.sort(key=\(_1[0]))
Two reasons for being -1: One is it's just plain ugly to me. Two, why break from how functions and methods work to save a few keystrokes? Explicit is better than implicit. -Brett
participants (2)
-
Brett Cannon
-
Giovanni Bajo