Re: [Jprogramming] Function creation, without creating, subfunctions

2017-05-30 Thread Michael Rice
I > > > > > run > > > > > > > some errands. > > > > > > > > > > > > > > Thanks, all. > > > > > > > > > > > > > > > > > > > > > > > > > > > > On Mon, May 29, 2

Re: [Jprogramming] Function creation, without creating, subfunctions

2017-05-30 Thread bill lam
gt;> > > > > > >>id=: 15 15$16{.1 > > > > > >> > > > > > >> But (id {~) is invalid syntax, so perhaps, instead use =&(i.15)"0 > > > > > >> > > > > > >> For example: > > > &g

Re: [Jprogramming] Function creation, without creating, subfunctions

2017-05-30 Thread Michael Rice
>> 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

Re: [Jprogramming] Function creation, without creating, subfunctions

2017-05-29 Thread bill lam
t;> -- > > > >> Raul > > > >> > > > >> > > > >> On Mon, May 29, 2017 at 9:22 AM, Michael Rice > > > wrote: > > > >> > Thanks. > > > >> > > > > >> > I found that after I coul

Re: [Jprogramming] Function creation, without creating, subfunctions

2017-05-29 Thread Michael Rice
> > > >> > > > >> -- > > > >> Raul > > > >> > > > >> > > > >> On Mon, May 29, 2017 at 9:22 AM, Michael Rice > > > wrote: > > > >> > Thanks. > > > >> > > > > >> > I found that afte

Re: [Jprogramming] Function creation, without creating, subfunctions

2017-05-29 Thread bill lam
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

Re: [Jprogramming] Function creation, without creating, subfunctions

2017-05-29 Thread Michael Rice
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

Re: [Jprogramming] Function creation, without creating, subfunctions

2017-05-29 Thread bill lam
> for this > >> > > >> > (id {~) > >> > > >> > Much cleaner and, no doubt, faster. Win. Win. > >> > > >> > Naively, I thought this simple substitution of the two would work > >> > > >> > make_move

Re: [Jprogramming] Function creation, without creating, subfunctions

2017-05-29 Thread Michael Rice
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 {~) > >> > > >

Re: [Jprogramming] Function creation, without creating, subfunctions

2017-05-29 Thread chris burke
> 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

Re: [Jprogramming] Function creation, without creating, subfunctions

2017-05-29 Thread Michael Rice
t; >> > for this > >> > > >> > (id {~) > >> > > >> > Much cleaner and, no doubt, faster. Win. Win. > >> > > >> > Naively, I thought this simple substitution of the two would work > >> > > >&g

Re: [Jprogramming] Function creation, without creating, subfunctions

2017-05-29 Thread Raul Miller
) +./) (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

Re: [Jprogramming] Function creation, without creating, subfunctions

2017-05-29 Thread Michael Rice
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

Re: [Jprogramming] Function creation, without creating, subfunctions

2017-05-29 Thread Michael Rice
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

Re: [Jprogramming] Function creation, without creating, subfunctions

2017-05-29 Thread Raul Miller
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,

Re: [Jprogramming] Function creation, without creating, subfunctions

2017-05-29 Thread Rob Hodgkinson
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

Re: [Jprogramming] Function creation, without creating, subfunctions

2017-05-29 Thread Michael Rice
> > 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

Re: [Jprogramming] Function creation, without creating, subfunctions

2017-05-28 Thread David Lambert
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

Re: [Jprogramming] Function creation, without creating subfunctions

2017-05-27 Thread Michael Rice
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

Re: [Jprogramming] Function creation, without creating subfunctions

2017-05-27 Thread Raul Miller
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

Re: [Jprogramming] Function creation, without creating subfunctions

2017-05-27 Thread Raul Miller
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

[Jprogramming] Function creation, without creating subfunctions

2017-05-27 Thread Michael Rice
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