On Mon, Dec 27, 2021 at 4:07 PM Steven D'Aprano
> Julia (if I recall correctly) has a nice syntax for automatically
> turning any function or method into an element-wise function:
And numpy has an even easier one:
np.log(a_scalar)
np.log(an_array)
I’m only being a little bit silly.
In fact,
On Tue, Dec 28, 2021 at 12:49:13AM +0900, Stephen J. Turnbull wrote:
> The point is that you focus on the lambdas, but what I'm interested in
> is the dataflows (the implicitly constructed iterators). In fact you
> also created a whole new subordinate data flow that doesn't exist in
> the origina
Stephen J. Turnbull wrote:
> In fact you
also created a whole new subordinate data flow that doesn't exist in
the original (the [x+1]). I bet that a complex
> comprehension in your style will need to create a singleton iterable
> per source element for every mapping except the first.
I don't thin
Stefan Pochmann writes:
> Stephen J. Turnbull wrote:
> > But you didn't, really.
>
> Yes I did, really. Compare (in fixed-width font):
I had no trouble reading the Python as originally written. Obviously
you wrote a comprehension that gets the right answer, and uses the
bodies of the lambda
On Sun, 26 Dec 2021 at 14:19, Steven D'Aprano wrote:
>
> Using a hypothetical pipeline syntax with an even more hypothetical
> arrow-lambda syntax:
>
> [1, 2, 3] | map(x=>x+1) | filter(a=>a%2) | list
>
What is the pipeline syntax like indeed? It looks as if your ``|`` is
an operator which pr
Stephen J. Turnbull wrote:
> But you didn't, really.
Yes I did, really. Compare (in fixed-width font):
( [x
source [1,2,3].iter() for x in [1,2,3]
increment .map(lambda x: x+1) for x in [x + 1]
if even .filter(lam