Linda wrote:
"Would it be possible to write a recursive function that would get your list
directly as numbers."

   t4=. (1:`(1 0"_)`(,&>/@:($:&.>)@:(1 2 -~ ]))@.(] + (1 < ]) * 2 - ]))M.

   (t3 -: t4) 18
1

   erase't4'
1

   t4=. (1:`(1 0"_)`(,&>/@:($:&.>)@:(1 2 -~ ]))@.(] + (1 < ]) * 2 - ]))M.

   100 st&>'t3 18' ; 't4 18'
┌─────┬─────┬─────────────┬─────────────┐
│t3 18│23424│1.52657098e_5│0.357583985  │
├─────┼─────┼─────────────┼─────────────┤
│t4 18│1664 │3.51598e_6   │0.00585059071│
└─────┴─────┴─────────────┴─────────────┘

   t5 f. cap
1:`(1 0"_)`([: ([: ,&>/ $:&.>) 1 2 -~ ])@.(] + (1 < ]) * 2 - ])M.



On Tue, Jun 3, 2014 at 6:57 AM, Linda Alvord <[email protected]>
wrote:

> Raul,  Both  F_Words and  f  deal with characters.  However when you get to
> plot you need numbers.
>
>     '0'=_1{::F_Words 8
> 1 0 1 1 0 1 0 1 1 0 1 1 0 1 0 1 1 0 1 0 1
>    '0'=_1{::f 8
> 1 0 1 1 0 1 0 1 1 0 1 1 0 1 0 1 1 0 1 0 1
>
> Would it be possible to write a recursive function that would get your list
> directly as numbers.
>
>    'A B'=:1 `0
>    ]A
> 1
>    ]B
> 0
>    ]A=:B,A
> 0 1
>    ]B=:A,B
> 0 1 0
>    ]A=:B,A
> 0 1 0 0 1
>    ]B=:A,B
> 0 1 0 0 1 0 1 0
>    ]A=:B,A
> 0 1 0 0 1 0 1 0 0 1 0 0 1
>    ]B=:A,B
> 0 1 0 0 1 0 1 0 0 1 0 0 1 0 1 0 0 1 0 1 0
>
>
>    (-.0 1 0 0 1 0 1 0 0 1 0 0 1 0 1 0 0 1 0 1 0)-:'0'=_1{::f 8
> 1
>
> I'm not yet very good at doing that yet.
>
> Linda
>
>
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to