Is there a symbol or a known idiom of conditional function in any of the APL dialects?
I am sure that something is missing for me, because it is such a basic language element. In other languages, it is called a conditional statement, but I will avoid this term here because the APL statement is something completely different.
For example, do C and friends have x ? T : F x ? T : F
LISP have (if x TF)
Python has T if x else F
etc.
I know that modern APLs have :If and friends, but they are required to control the program flow: they do not return a value, cannot be used inside an expression, and, of course, cannot be applied to arrays of boolean values. They have a completely different goal, and this is very good.
The only decent expression that I could do for a functional choice is (FT)[⎕IO+x] , which doesn’t look particularly shortened or readable for me, although it does its job even on arrays:
('no' 'yes')[⎕IO+(⍳5)∘.>(⍳5)] no no no no no yes no no no no yes yes no no no yes yes yes no no yes yes yes yes no
I tried to come up with a similar expression using the ⌷ command, but failed unsuccessfully in boolean arrays. Even if I could, he would still have to insert ⎕IO or hardcoded 1, which is even worse in terms of readability.
Before moving on to defining my own if and using it in every program I will ever write, is there any canon? Am I missing an obvious function or operator?
(Are there any APL programmers on SO ?:-)