I
> > > > > run
> > > > > > > some errands.
> > > > > > >
> > > > > > > Thanks, all.
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > On Mon, May 29, 2
gt;>
> > > > > >>id=: 15 15$16{.1
> > > > > >>
> > > > > >> But (id {~) is invalid syntax, so perhaps, instead use =&(i.15)"0
> > > > > >>
> > > > > >> For example:
> > > &g
>> 0 0 1 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 1 0 0 0 0 0 0 0 0 0
> > > > >>
> > > > >> That said, (id {~ ]) is syntactically valid and does the same
> thing
> &g
t;> --
> > > >> Raul
> > > >>
> > > >>
> > > >> On Mon, May 29, 2017 at 9:22 AM, Michael Rice
> > > wrote:
> > > >> > Thanks.
> > > >> >
> > > >> > I found that after I coul
> > > >>
> > > >> --
> > > >> Raul
> > > >>
> > > >>
> > > >> On Mon, May 29, 2017 at 9:22 AM, Michael Rice
> > > wrote:
> > > >> > Thanks.
> > > >> >
> > > >> > I found that afte
s, 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
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
> for this
> >> >
> >> > (id {~)
> >> >
> >> > Much cleaner and, no doubt, faster. Win. Win.
> >> >
> >> > Naively, I thought this simple substitution of the two would work
> >> >
> >> > make_move
y 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 {~)
> >> >
> >
> I also tried installing J on my RPi and sent the following message back
on 5/23 without getting a reply. It could have been lost due to my account
not yet having been finally approved.
Your message was not posted (see www.jsoftware.com/forumsearch to search
for messages). Incidentally, we prefe
t; >> > for this
> >> >
> >> > (id {~)
> >> >
> >> > Much cleaner and, no doubt, faster. Win. Win.
> >> >
> >> > Naively, I thought this simple substitution of the two would work
> >> >
> >&g
) +./) (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.jso
nce and NuVoc.
> >
> > http://www.jsoftware.com/help/learning/contents.htm
> >
> >
> >
> >
> >
> >
> >
> > On Sun, May 28, 2017 at 9:57 PM, David Lambert
> wrote:
> >
> >> xor can be not equal ~:
> >>
> >> or
t; 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
> wrote:
> >
&g
n, May 28, 2017 at 9:57 PM, David Lambert wrote:
>
>> xor can be not equal ~:
>>
>> or bitwise 2b10110 b.
>>
>>
>>
>> On 05/28/2017 08:00 AM, programming-requ...@forums.jsoftware.com wrote:
>>
>>> Message: 5
>>> Date: Sat,
10110 b.
>>
>>
>>
>> On 05/28/2017 08:00 AM, programming-requ...@forums.jsoftware.com wrote:
>>
>>> Message: 5
>>> Date: Sat, 27 May 2017 23:51:29 -0400
>>> From: Michael Rice
>>> To: programming
>>> Subject: Re: [Jprogramm
>
> or bitwise 2b10110 b.
>
>
>
> On 05/28/2017 08:00 AM, programming-requ...@forums.jsoftware.com wrote:
>
>> Message: 5
>> Date: Sat, 27 May 2017 23:51:29 -0400
>> From: Michael Rice
>> To: programming
>> Subject: Re: [Jprogram
xor can be not equal ~:
or bitwise 2b10110 b.
On 05/28/2017 08:00 AM, programming-requ...@forums.jsoftware.com wrote:
Message: 5
Date: Sat, 27 May 2017 23:51:29 -0400
From: Michael Rice
To: programming
Subject: Re: [Jprogramming] Function creation, without creating
subfunctions
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
Actually, thinking about this further, the parenthesis around f are
not actually needed. But that is because f is a fork, and the default
behavior will be to construct a fork before incorporating the
definition of g. (If f was a hook, you would still need those parens.
The interpreter does not elim
Basically, you put the definition of f in parenthesis (though it
already is, so no actual change needed there), and the definition of g
in parenthesis.
You can even get the interpreter to do this for you:
9!:3]5
make_move
g f
make_move f.
((+. *. -.@:*.) +./) (1 0 0 0 0 0 0 0 0 0 0 0 0
NB. 15 position peg solitaire
NB. The board (position 5 initially vacant)
NB. 0
NB. 1 2
NB. 3 4 5
NB.6 7 8 9
NB. 10 11 12 13 14
xor =: ((+.)*.(-.@:*.))
board =: 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 NB. 0s for vacant, 1s occupied
board
1 1 1 1 1 0 1 1 1 1 1 1
22 matches
Mail list logo