I was just trying to make clearer my intentions with that fragment of C. It looks like dyad ~: will serve my purposes, thanks.
___________________________ David Vaughan On 12 Jul 2011, at 18:19, Raul Miller <[email protected]> wrote: > On Tue, Jul 12, 2011 at 11:52 AM, David Vaughan > <[email protected]> wrote: >> You misunderstood Raul, the second line is simply "in C" the programming >> language. I just meant I wanted the first line's equivalent in J. > > Ok... except that's not valid C, it's a fragment of C. And, worse, > it's a fragment which has a purpose which relates to C's structure > where best practice in J is to use different kinds of structures. > > For example, > A=:1 2 3 2 1 > B=: 3 2 3 2 3 > N=:2 3 5 7 11 > > A ~: B > 1 0 0 0 1 > > I would argue that this serves the same role in J that the if > statement served in C. It performs the stated comparison. But your > dangling "if" statement suggested that something else was intended. > But what? > > Let's pick out some values from N where the condition is true: > N * A ~: B > 2 0 0 0 11 > > Or let's say that we do not want to maintain N's structure, we just > want the selected values: > N#~A~:B > 2 11 > > Or let's say that we want to negate values in N where A does not match B: > N * _1 ^ A ~: B > _2 3 5 7 _11 > > ... and ... so on... > > The point I am trying to make is that you can do a lot of things -- in > essence, any J expression which allows for numeric values might be > appropriate. But that's a lot of ground to cover. > > Meanwhile, in C, you have micro management control over what happens > after an if. And while you can do that in J > (http://www.jsoftware.com/help/dictionary/ctrl.htm) we often have > better alternatives. You can construct arbitrary problems where there > is no better alternative, but you can also often change problems to > allow for better alternatives. > > -- > Raul > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
