Based on the previous message, is this what you are looking for?
<"0 (>c2)}(>b2),:>a2 ---T-T--┐ │10│2│30│ L--+-+--- Linda -----Original Message----- From: programming-boun...@jsoftware.com [mailto:programming-boun...@jsoftware.com] On Behalf Of Johann Hibschman Sent: Wednesday, December 21, 2011 10:15 AM To: programming@jsoftware.com Subject: [Jprogramming] choosing between alternates (iif, ifelse) (I'm re-sending this, since I think I had my list subscription mis-configured. Hopefully, no one is getting this twice.) What's the J idiom for choosing between alternates, based on a boolean vector? In other languages, this is called something like "iif" or "ifelse". If I have: a=: 10 20 30 b=: 1 2 3 c=: 1 0 1 I want to get (10 2 30). I can get this by something like ((a*c)+b*-.c), but that breaks if a and b are boxes. For example, with a2=:10;20;30 b2=: 1;2;3 then that trick doesn't work. Is there a more direct way? I tried looking for this in the Phrases, but I couldn't find it there. There was a merge, but that was a more complex operation. Regards, Johann ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm