[Jprogramming] Times Table Therapy

Peter B. Kessler Peter.B.Kessler at Oracle.COM
Thu Dec 5 19:56:37 UTC 2013


Does it make it clearer to write the monadic and dyadic forms together with the "long-form" of Monad-Dyad?  E.g.,

        NB. Define a "table" adverb.  The monad is reflexive.
        h=: 1 : 0
            y u/ y
            :
            x u/ y
        )

        NB. An example use as a monad.
        % h i. 4
     0 0   0        0
     _ 1 0.5 0.333333
     _ 2   1 0.666667
     _ 3 1.5        1

        NB. An example use as a dyad.
        (i. 3) % h i: 3
             0    0  0 0 0   0        0
     _0.333333 _0.5 _1 _ 1 0.5 0.333333
     _0.666667   _1 _2 _ 2   1 0.666667

Raul Miller condenses the dyad form to one line, but that might not make it easier to read.  And if you want both forms, you might as well write them together.

			... peter

On 12/03/13 19:48, Raul Miller wrote:
> g=: 1 :(':';'x u /y')
>
> Without the ':' the verb %g is a monad.
>
> Thanks,
>
> --
> Raul
>
> On Tue, Dec 3, 2013 at 10:20 PM, Linda Alvord <lindaalvord at verizon.net> wrote:
>> Raul,  We've been moving for the last several weeks and I haven't studied this yet.
>>
>> It seems odd that f is so simple and g is impossible.
>>
>>    f=: 1 :'y u / y'
>>    a=:%
>>    a f i.4
>> 0 0   0        0
>> _ 1 0.5 0.333333
>> _ 2   1 0.666667
>> _ 3 1.5        1
>>
>>    (i.3)%/i:3
>>         0    0  0 0 0   0        0
>> _0.333333 _0.5 _1 _ 1 0.5 0.333333
>> _0.666667   _1 _2 _ 2   1 0.666667
>>
>>    g=: 1 :'x u /y'
>>    (i.3) a g i:3
>> |domain error: scriptd
>> |   (i.3)    a g i:3
>> |[-17] c:\users\owner\j801-user\temp\113.ijs
>>
>> Is there an easy way to write  g ?
>>
>> Linda



More information about the Programming mailing list