xor =: ((+.)*.(-.@:*.))
board =: 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1
move =: 0 2 5
((1 0 0 0 0 0 0 0 0 0 0 0 0 0 0) |.!.0~ 3 1 $ -) 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
NB. Identity matrix
positions =: (15 1 $ -i.15) |.!.0 (15{.1)
id =: (15 1 $ -i.15) |.!.0 (15{.1)
move { id
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
(* & 2) 3
6
({ & id) 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
make_move =: ((+. *. -.@:*.) +./) ({ & id)
board make_move move
0 1 0 1 1 1 1 1 1 1 1 1 1 1 1
I don't know how I wandered away from that solution. I had it written down,
as shown above, in my latest text save. I believe my trouble began when I
began trying {~ when it wasn't needed.
Will try to jibe what I have above with what you sent, later.
Put aside Fedora installation of J for the moment. I'm going to have to
retrace my steps for that. 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.
========================
Installing J (j805_armhf.deb) on the RP seemed to go ok until I tried to
install the Qt interface. I then get this message: "Load library
/usr/bin/libj.so failed."
A run button icon (a J w/JConsole) was installed in the Pi menu, which when
clicked yields this message in an error dialog: Invalid desktop entry file:
'usr/share/applications/ijconsole.desktop'
Is there a fix for this?
On Mon, May 29, 2017 at 12:05 PM, Raul Miller <[email protected]> wrote:
> ] is an identify function. Specifically, the value of its result is
> its right argument.
>
> An expression of the form f g h (where f, g and h are verbs) is a
> fork: the arguments to g are the results of f and h applied to the
> arguments of the fork.
>
> And, finally, an expression of the form i g h (where i is a noun) is
> also a fork, because i gets converted to the verb i"_ (which basically
> just means that the left argument to g is i).
>
> ------
>
> Meanwhile, these expressions have equivalent results, for nouns id and k:
>
> k { id
> {&id k
>
> k { id
> id {~ k
> (id {~ ]) k
>
> ------
>
> Meanwhile, these are different from the above, but equivalent to each
> other:
> id&{~ k
> k id&{ k
>
> ... but you probably do not want to go there right now...
>
> ------
>
> Finally, for installation problems (getting J to run on fedora), if
> you have time, maybe post the errors you were getting (along with what
> you did to get them) to the general@jsoftware list?
>
> Thanks,
>
> --
> Raul
>
>
> On Mon, May 29, 2017 at 11:15 AM, Michael Rice <[email protected]>
> wrote:
> > (id {~ ])?
> >
> > I don't understand the usage of ] in the above.
> >
> > From the NuVoc docs:
> >
> > Use in the J session to both display a noun and assign it to a name with
> a
> > single sentence
> >
> > ] z=: i:2
> > _2 _1 0 1 2
> >
> > Typo?
> >
> > (id {~ ]) move?
> >
> > What does it expand to? Where's the assignment of a function to a name?
> >
> > Earlier, I tried to curry the { function
> >
> > move { id
> >
> > to
> >
> > f =: (id & {~)
> >
> > Seemed like that should work, like this
> >
> > f 0 2 5 => 3 by 15 array
> >
> > but I think I got a syntax error when I tried it.
> >
> > I couldn't get get J running on my Fedora 24 install (where I am now), so
> > put it on Win 10 on my dual-boot box and will get back to it after I run
> > some errands.
> >
> > Thanks, all.
> >
> >
> >
> > On Mon, May 29, 2017 at 10:27 AM, Raul Miller <[email protected]>
> wrote:
> >
> >> Hmm...
> >>
> >> First, here's an expression for a 15 by 15 identity matrix:
> >>
> >> id=: 15 15$16{.1
> >>
> >> But (id {~) is invalid syntax, so perhaps, instead use =&(i.15)"0
> >>
> >> For example:
> >>
> >> =&(i.15)"0 ] 2 3 5
> >> 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
> >> (except for arguments outside the domain).
> >>
> >> I hope this helps,
> >>
> >> --
> >> Raul
> >>
> >>
> >> On Mon, May 29, 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/forum
> s.htm
> >> > ------------------------------------------------------------
> ----------
> >> > For information about J forums see http://www.jsoftware.com/forum
> s.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
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm