Summary
A composed predicate works correctly when evaluated directly against a scalar input, but fails when the same predicate is passed as the predicate argument of filter.
This suggests the composed predicate is not receiving the current array element correctly when it is bound/invoked as a function argument.
Minimal reproduction
.\expressif evaluate "filter(less-than(150) |AND greater-than(0))" -i "{30}"
Actual:
Expected:
A broader case shows the same behavior:
.\expressif evaluate "filter(less-than(150) |AND greater-than(0))" -i "{-10,30,200}"
Actual:
Expected:
Control cases
Each predicate works independently inside filter:
.\expressif evaluate "filter(less-than(150))" -i "{30,70}"
# {30, 70}
.\expressif evaluate "filter(greater-than(0))" -i "{30,70}"
# {30, 70}
The composed predicate also works correctly when evaluated directly against a scalar:
.\expressif evaluate "less-than(150) |AND greater-than(0)" -i "30"
# true
.\expressif evaluate "less-than(150) |OR greater-than(0)" -i "30"
# true
So the Boolean combinators themselves appear to be correct. The failure is specific to composed predicates bound as arguments to filter.
Expected behavior
filter should evaluate the complete composed predicate against each element of the input array. For example, for input 30, both less-than(150) and greater-than(0) must receive 30 as their input before their Boolean results are combined.
Regression coverage
Add tests covering at least:
- composed
AND predicate as a filter argument;
- composed
OR predicate as a filter argument;
- multiple input elements where only a subset should pass;
- direct scalar evaluation of the same composed predicates as a control case.
This behavior is likely related to the predicate-as-Boolean-function refactoring from #663.
Summary
A composed predicate works correctly when evaluated directly against a scalar input, but fails when the same predicate is passed as the predicate argument of
filter.This suggests the composed predicate is not receiving the current array element correctly when it is bound/invoked as a function argument.
Minimal reproduction
Actual:
Expected:
A broader case shows the same behavior:
Actual:
Expected:
Control cases
Each predicate works independently inside
filter:The composed predicate also works correctly when evaluated directly against a scalar:
So the Boolean combinators themselves appear to be correct. The failure is specific to composed predicates bound as arguments to
filter.Expected behavior
filtershould evaluate the complete composed predicate against each element of the input array. For example, for input30, bothless-than(150)andgreater-than(0)must receive30as their input before their Boolean results are combined.Regression coverage
Add tests covering at least:
ANDpredicate as afilterargument;ORpredicate as afilterargument;This behavior is likely related to the predicate-as-Boolean-function refactoring from #663.