Thanks Raul,  That is very helpful.  I'll keep working on your solution.

Linda

-----Original Message-----
From: [email protected] 
[mailto:[email protected]] On Behalf Of Raul Miller
Sent: Tuesday, January 6, 2015 1:27 PM
To: Programming forum
Subject: Re: [Jprogramming] During lulls in the games can you simplify this 
code?

On Tue, Jan 6, 2015 at 10:26 AM, Linda Alvord <[email protected]> wrote:
> Raul, Here’s a lesson I made to understand  &. Better.
...
> How would you write b without  & is my question for you.
>
> t=: '';'Hi';'';'';'Ho';'';'hee';'';'';'haw';'';'';'Yo';''
> b=: 13 :'*#&>y'
> b t
> 0 1 0 0 1 0 1 0 0 1 0 0 1 0

In general,
   u&v

is
   ([: u v)"v

Inspecting what that means for this case, by trying it out with # for u and > 
for v, and with verb display set to linear:

   ([: # >)">
([: # >)"0 0 0

Thus:
   b=: [: * ([: # >)"0 0 0

You can simplify that by replacing 0 0 0 with a single 0.

There are, of course, other ways of achieving this same result.

Thanks,

--
Raul
----------------------------------------------------------------------
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