I suppose the simplest explanation is that defining fact =: */ >: i. in effect 
puts parentheses around */ >: i. and

   (*/ >: i.) 5

is different from

   */ >: i. 5

As others have explained, the first of these is interpreted as

  (*/ 5) >: (i. 5)

and the second as

  */ (>: (i. 5))

You could have defined

   fact =: 3 : '*/ >: i. y'
   fact 5
120

or

   fact =: 13 : '*/ >: i. y'
   fact 5
120
   fact
[: */ [: >: i.

Kip Murray

Sent from my iPad


On Nov 15, 2012, at 11:20 PM, Vijay Lulla <vijaylu...@gmail.com> wrote:

> Please forgive me for asking a novice question.
> 
> I tried
> */>:i.5   NB. results in 120
> 
> But I define
> fact=: */>:i.
> fact 5  NB. results in 1 1 1 1 1
> 
> I remember reading about this somewhere but I cannot seem to find the
> relevant pages now. Any pointers as to where I could find these documents
> or a brief explanation (which can be easily remembered) will be very
> helpful and is highly appreciated.
> Thanks,
> Vijay Lulla.
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm)
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to