dry-python/lambdas

How to get access to args/kwargs inside lambda?

gtors opened this issue · 1 comments

gtors commented

Is it possible to express this kind of lambda?
lambda a, b: a * b

I intuitively tried this approach, but it doesn't work...
_._1 * _._2

gtors commented

So, I implemented my own version 🤖

from lambdaz import a0, a1, a2

fn = ((a0 + a1) / a2)._
fn(1, 2, 3)  # out: 1.0

fn = a0.strip().title()._
fn("    hello world   ") # out: Hello World