Use of findall with different conditions at the same time?

The error is saying that isequal(NaN) returns a function, when you are trying to use it as a boolean. isequal(NaN) is a curried function (the Base.Fix2 type, which is equivalent to f(y) = isequal(y, NaN) ) and you are not giving it x (in the anonymous function for findall) as an argument.

The solution:

- findall(x->x>400||x<0||isequal(NaN),t2)
+ findall(x->x>400||x<0||isequal(x,NaN),t2)
+ findall(x->x>400||x<0||isnan(x),t2) # alternately

I have recently been in a similar situation and thought that defining & and | operations for Base.Fix1/Fix2 would be very convenient when multiple curried predicate functions are being used (theoretically also for single argument functions, eg isnan, but that would not be as simple to implement). Something along the lines of findall(>(400)|<(0)|isequal(NaN),t2).

1 Like