Not sure if this helps Michael, but I think that you are using the id to
generate the steps shown here from one of your earlier emails …
>> f =: ((1 0 0 0 0 0 0 0 0 0 0 0 0 0 0) |.!.0~ 3 1 $ -)
>> f move
>> 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0
>> 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0
>> 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0
>> +./f move
>> 1 0 1 0 0 1 0 0 0 0 0 0 0 0 0 NB. Move 0 2 5 expressed as 15 element
which you have tried to substitute with:
(id {~)
However if the goal is to convert <move> (0 2 5) into the 15 element boolean
expressing same, a simpler method may be:
(i.15) e. move NB. e. is “element of” being true (1)
or false (0), so avoids having to expand the 15x15 identity at all
1 0 1 0 0 1 0 0 0 0 0 0 0 0 0
This might obviate the need for id in the first place and simplify your overall
solution.
HTH, Regards Rob
> On 29 May 2017, at 9:22 am, Michael Rice <[email protected]> wrote:
>
> Thanks.
>
> I found that after I couldn't find it and wrote my own, but it seemed to be
> changing one of my function parameters, the left one, so I moved back to my
> definition.
>
> I'm again having a similar problem stringing these verbs, adverbs, etc.
> together to form the function I want.
>
> I created an 15 by 15 identity matrix, call it id, and substituted this
>
> (1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 |.!.0~
> 3 1 $ -)
>
> for this
>
> (id {~)
>
> Much cleaner and, no doubt, faster. Win. Win.
>
> Naively, I thought this simple substitution of the two would work
>
> make_move =: ((+. *. -.@:*.) +./) (id {~)
>
> Nope. Syntax error.
>
> Have already tried several other variations this AM with the same result.
>
> I'm using "Learning J" as a reference and NuVoc.
>
> http://www.jsoftware.com/help/learning/contents.htm
>
>
>
>
>
>
>
> On Sun, May 28, 2017 at 9:57 PM, David Lambert <[email protected]> wrote:
>
>> xor can be not equal ~:
>>
>> or bitwise 2b10110 b.
>>
>>
>>
>> On 05/28/2017 08:00 AM, [email protected] wrote:
>>
>>> Message: 5
>>> Date: Sat, 27 May 2017 23:51:29 -0400
>>> From: Michael Rice<[email protected]>
>>> To: programming<[email protected]>
>>> Subject: Re: [Jprogramming] Function creation, without creating
>>> subfunctions
>>> Message-ID:
>>> <CAGw08vM_5CttMFY45F6zAAto-doycQYkXqRf8uRWC=0Ug9xcOw@mail.
>>> gmail.com>
>>> Content-Type: text/plain; charset="UTF-8"
>>>
>>> Yes, that worked. New board created, without changing the old board or the
>>> move.
>>>
>>> board =: 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1
>>> move =: 0 2 5
>>> make_move =: ((+. *. -.@:*.) +./) (1 0 0 0 0 0 0 0 0 0 0 0 0 0 0
>>> |.!.0~
>>> 3 1 $ -)
>>> board make_move move
>>> 0 1 0 1 1 1 1 1 1 1 1 1 1 1 1
>>> board
>>> 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1
>>> move
>>> 0 2 5
>>>
>>
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/forums.htm
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm