Backquotes for deferred expression

One thing that I’d find exciting is a new way to write lambda functions. But I mean real lambda functions, that are manually called, not implicitly evaluated.

Specifically because of the context of piping (another ongoing discussion in the ideas forum). And because you could generalise the concept to include 1-argument lambda functions.

For example, adapting one bit of example code from there to use the “`” notation:

Q = 'abcde'
    |> `batched(_, 2)`
    |> `map(''.join, _)`
    |> list
assert Q == ["ab","bc","cd","de"]

Or instead with using @ for function composition:

Q = list @ `map(''.join, _)` @ `batched(_, 2)` ("abcde")

compared with the current lambda functions:

Q = list @ (lambda P: map(''.join, P)) @ (lambda P: batched(P, 2)) ("abcde")

compared with the “normal” python

Q = list(map(''.join, batched("abcde", 2)))

(This is not the best example to demonstrate why piping might be useful, but I think it shows how better lambda functions could play a role in piping.)


Another thing is that I think deferred expressions are cute, but I’m pretty sure I’d want to manually control when they’re evaluated.
Eg I would immagine:

a = 3
b = "abcdef"
x = defer: b[a]
assert type(x) == DeferExpr
y = x * a
assert type(y) == DeferExpr
assert y() == "ccc"
a = 4
assert y() == "ddd"

finally there’s late-bound function arguments, which I mentioned earlier, and care a lot about.