Linda

>Wow that is super understandable and compact! Of course its domain is limited, 
>Eg it does not like negative numbers:

    d=:  1 2 3 2 2 4 2 1
    dn=: _1 2 _3 2 2 _4 2 _1
    dn=: (]* _1&^ @ (2~:]))  d

    fLA=: ] >. +: * 1 |. 2 = ]
    fLA dn
_1 2 _3 4 2 _4 2 0

>It did take me a _long_ time to penetrate Aai`s sophistry! Finally the key was 
>that /. was really oblique, not key! ...but it does survive this negative 
>number test:

     fA=: [: }. 2&*//.@(2&=,:])
     fA dn
_2 2 _6 4 2 _8 2 _1

>Anyway i think i am awake this am, thanks! i could be fooled though, only 
>dreaming i was awake;)

greg
~krsnadas.org

--

from: Linda Alvord <[email protected]>
to: [email protected]
date: 16 May 2014 21:51
subject: Re: [Jprogramming] ^: and boxes

Maybe you'll like this.


   f=: 13 :'y >.(1 |. 2 = y)*+:y'
   f 1 2 3 2 2 4 2
2 2 6 4 2 8 2

   f
] >. +: * 1 |. 2 = ]

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

Reply via email to