Re: Arrow operator and empty sequences

I guess you can define => in 2 different ways: either by calling RHS
once for each item in LHS, something a bit more "object oriented",
syntactic sugar for "$s ! f(.)", or by calling RHS exactly once,
syntactic sugar for "f($s)".

Because we chose the latter, there is no reason why treating the empty
sequence in a special way (that'd be dangerous I think).

Regards,

-- 
Florent Georges
http://fgeorges.org/
http://h2oconsulting.be/


On 17 December 2015 at 19:14, Abel Braaksma wrote:
>>
>> I agree with Christian.  I think a key difference with path expressions is that
>> the RHS operand is not called once per item in the result of evaluating the
>> LHS operand (which indeed, is zero times for the empty sequence).
>>
>> With the arrow operator, the RHS is called exactly once, whatever the result
>> of evaluating the LHS.
>>
>
> Yes, I think that makes sense, albeit a trifle unintuitive. So the LHS cannot work as a filter (but we have "/" and "!" for that, which *does* work that way, i.e., if LHS is empty, RHS needs no eval)
>
>

Received on Thursday, 17 December 2015 20:18:15 UTC