> if. 0>(*:b)-4*a*c do. 'complex roots' else. 'real roots' end.
Can be re-written sans-controls (with expression-grade value) 'complex roots' [^:(0>(*:b)-4*a*c) 'real roots' or more fancily if=: [^: else=: ] 'complex roots' if (0>(*:b)-4*a*c) else 'real roots' > From: Roger Hui <[email protected]> > > The more general question is, why have control structures > in J at all. > > a. Having control structures makes the explicit definition > more expressive. > > b. Gerunds and other tacit phrases are not so convenient > when there are >2 names or expressions involved. > As a simple example: > > if. 0>(*:b)-4*a*c do. 'complex roots' else. 'real roots' end. > > A tacit version would involve catenating a,b,c and then > picking out the items. > > > > ----- Original Message ----- > From: David Ward Lambert > Date: Tuesday, February 2, 2010 9:19 > Subject: Re: [Jprogramming] loopless programming question > To: [email protected] > > > I don't understand why j has a select/case statement. > > Gerunds ought to be sufficient. > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
