Bart wrote:
>  The only thing I don't understand in it is the '1'
>    o.i:6j99
>  oh, I see, times  pi
>    1 o.i:6j99
>  huh? Ah got it. If you put 1 before, you get the sine.

Even this isn't so mysterious.  Here's an analogous situation:

           - 3
        _3
           
           5 - 3
        2
           
We can see that the symbol (verb) "-" has two distinct meanings 
(interpretations).  In the first case,  -  means "negate", in the second, it 
means "minus".

In J parlance, these interpretations are termed "valences"; and, as you can 
see, which valence is invoked depends on the number of arguments supplied to 
the verb.  If the verb has a single argument (on the left), the "monadic" 
valence is invoked.  If the verb has two arguments (one on the left, one on the 
right), the "dyadic" valence is invoked [1].  

So the "monadic valence", or "one argument interpretation" of  -  is negate, 
and the "dyadic valence", or "two argument interpretation" is subtract.  As 
shorthand for "monadic valence" and "dyadic valence" one may refer to the 
"monad" or "dyad" respectively [2].  

So the explanation of the  1  in  1 o. i:6j99  is simple:  o. is being given 
two arguments.  On the right, the argument is  i:6j99  .  On the left, the 
argument is  1  .  To find out what that means, we'd read the Vocabulary page 
for  o.  .  

To bring that page up, put your caret between the  o  and the  .  in  o.  , 
then press CTRL+F1 .   you may also read it online at  
http://www.jsoftware.com/help/dictionary/dodot.htm  . There, we see something 
like this:


---------------------------------------+-------------------------------------------------
Monad                                  |    Dyad
---------------------------------------+-------------------------------------------------
  o. y   yields ? times y . Thus  o. 1 |    The function  x&o.  is even or odd 
as  x  is 
is approximately 3.14159 .             |    even or odd;  (-x)&o.  is its 
inverse (that
                                       |    is,  y = (-x) o. x o. y  for  y  in 
a 
                                       |    significant sub-domain).
---------------------------------------+-------------------------------------------------

Knowing that our  o.  is being given two arguments, we refer to the dyadic 
definition, and discover that the left argument controls which specific 
trigonometric function will be applied to the right argument.  Reading further, 
we discover the list of possible left arguments, and which trig function they 
specify.  In particular, in when  x=.1  then  x o. y  produces  sin(y)  , as 
you deduced.

-Dan


[1]  "Monadic" and "dyadic" (verbs) in J are essentially synonymous 
     with "unary" and "binary" (operators) in other languages.

[2]  Usually the monad and dyad are related; at least in spirit.  
     For example, "negate y" is merely "zero minus y"; that is,
     (-y) = (0-y)  .  So, in the case of  -  , the monad is just
     the dyad with a fixed left argument.  

     The relation between the valences  o.  is not quite as
     concrete, but is still fairly mnemonic.  The monad multiples
     its argument by pi.  The dyad provides a set of 
     trigonometric functions, which have an interesting 
     relationship to pi.


----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to