] + 1 doesn't do the job. It is not a verb - it is two verbs applied to a noun, giving the value 1 (noun). You need
1 + ] instead Same with longverb , (*: 5) (*: 5) is just 25, right? So this will be the noun that results from longverb , 25 You need (*: 5) ,~ longverb instead - that's why the implicit generator did that. sq5 =: (*: 5) ,~ (] * (1 + ])) And look - that produce the same result that Roger did: 25 ,~ ] * 1 + ] Henry Rich > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of > Terrence Brannon > Sent: Saturday, June 09, 2007 2:22 PM > To: Programming forum > Subject: [Jprogramming] what is wrong with sq5 =: (] * (] + > 1)) , (*: 5) > > I am trying to implement some simple vedic math formulas as shown here > http://www.vedamu.org/Mathematics/MathematicalFormulae/Sutras/ > sutras.asp > > and > > sq5 =: (] * (] + 1)) , (*: 5) > > leads to syntax errors. The implicit one generated by J looks > much the same: > > sq5 =: 3 : '(y * (y+1)) , (*: 5)' > sq5 22 > 506 25 > sq5 =: 13 : '(y * (y+1)) , (*: 5)' > > except is uses flip for some reason... help appreciated. > > -- > HIV/AIDS on trial - http://www.aliveandwell.org/ > Let's play chess: http://www.SlowChess.com > ---------------------------------------------------------------------- > For information about J forums see > http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
