There are other similar questions on this site about using the Infix operator for more than two arguments, which I have read. But there is one thing that I wasn't able to understand and couldn't figure out why. Consider this line:
#~If~Sequence[2, 3] & /@ {False, True, False}
which gives the output {3, 2, 3} as expected. Now if I understand correctly, Sequence @@ {2, 3} is the same as Sequence[2, 3], but if you put this in the above line:
#~If~(Sequence @@ {2, 3}) & /@ {False, True, False}
it results in {Null, 2, 3, Null}. Why does this happen?
Is there some kind of workaround to make it work?
I tried playing around with Hold and its variations without any luck.
#~If~Evaluate[Sequence @@ {2, 3}] & /@ {False, True, False}gives the desired result – polfosol Dec 09 '21 at 12:53